1/* 2 * Ext JS Library 3.4.0 Copyright(c) 2006-2011 Sencha Inc. [email protected] 3 * http://www.sencha.com/license 4 */ 5(function() { 6 var h = Ext.util, j = Ext.each, g = true, i = false; 7 h.Observable = function() { 8 var k = this, l = k.events; 9 if (k.listeners) { 10 k.on(k.listeners); 11 delete k.listeners 12 } 13 k.events = l || {} 14 }; 15 h.Observable.prototype = { 16 filterOptRe : /^(?:scope|delay|buffer|single)$/, 17 fireEvent : function() { 18 var k = Array.prototype.slice.call(arguments, 0), m = k[0] 19 .toLowerCase(), n = this, l = g, p = n.events[m], s, o, r; 20 if (n.eventsSuspended === g) { 21 if (o = n.eventQueue) { 22 o.push(k) 23 } 24 } else { 25 if (typeof p == "object") { 26 if (p.bubble) { 27 if (p.fire.apply(p, k.slice(1)) === i) { 28 return i 29 } 30 r = n.getBubbleTarget && n.getBubbleTarget(); 31 if (r && r.enableBubble) { 32 s = r.events[m]; 33 if (!s || typeof s != "object" || !s.bubble) { 34 r.enableBubble(m) 35 } 36 return r.fireEvent.apply(r, k) 37 } 38 } else { 39 k.shift(); 40 l = p.fire.apply(p, k) 41 } 42 } 43 } 44 return l 45 }, 46 addListener : function(k, m, l, r) { 47 var n = this, q, s, p; 48 if (typeof k == "object") { 49 r = k; 50 for (q in r) { 51 s = r[q]; 52 if (!n.filterOptRe.test(q)) { 53 n.addListener(q, s.fn || s, s.scope || r.scope, s.fn 54 ? s 55 : r) 56 } 57 } 58 } else { 59 k = k.toLowerCase(); 60 p = n.events[k] || g; 61 if (typeof p == "boolean") { 62 n.events[k] = p = new h.Event(n, k) 63 } 64 p.addListener(m, l, typeof r == "object" ? r : {}) 65 } 66 }, 67 removeListener : function(k, m, l) { 68 var n = this.events[k.toLowerCase()]; 69 if (typeof n == "object") { 70 n.removeListener(m, l) 71 } 72 }, 73 purgeListeners : function() { 74 var m = this.events, k, l; 75 for (l in m) { 76 k = m[l]; 77 if (typeof k == "object") { 78 k.clearListeners() 79 } 80 } 81 }, 82 addEvents : function(n) { 83 var m = this; 84 m.events = m.events || {}; 85 if (typeof n == "string") { 86 var k = arguments, l = k.length; 87 while (l--) { 88 m.events[k[l]] = m.events[k[l]] || g 89 } 90 } else { 91 Ext.applyIf(m.events, n) 92 } 93 }, 94 hasListener : function(k) { 95 var l = this.events[k.toLowerCase()]; 96 return typeof l == "object" && l.listeners.length > 0 97 }, 98 suspendEvents : function(k) { 99 this.eventsSuspended = g; 100 if (k && !this.eventQueue) { 101 this.eventQueue = [] 102 } 103 }, 104 resumeEvents : function() { 105 var k = this, l = k.eventQueue || []; 106 k.eventsSuspended = i; 107 delete k.eventQueue; 108 j(l, function(m) { 109 k.fireEvent.apply(k, m) 110 }) 111 } 112 }; 113 var d = h.Observable.prototype; 114 d.on = d.addListener; 115 d.un = d.removeListener; 116 h.Observable.releaseCapture = function(k) { 117 k.fireEvent = d.fireEvent 118 }; 119 function e(l, m, k) { 120 return function() { 121 if (m.target == arguments[0]) { 122 l.apply(k, Array.prototype.slice.call(arguments, 0)) 123 } 124 } 125 } 126 function b(n, p, k, m) { 127 k.task = new h.DelayedTask(); 128 return function() { 129 k.task.delay(p.buffer, n, m, Array.prototype.slice.call(arguments, 130 0)) 131 } 132 } 133 function c(m, n, l, k) { 134 return function() { 135 n.removeListener(l, k); 136 return m.apply(k, arguments) 137 } 138 } 139 function a(n, p, k, m) { 140 return function() { 141 var l = new h.DelayedTask(), o = Array.prototype.slice.call( 142 arguments, 0); 143 if (!k.tasks) { 144 k.tasks = [] 145 } 146 k.tasks.push(l); 147 l.delay(p.delay || 10, function() { 148 k.tasks.remove(l); 149 n.apply(m, o) 150 }, m) 151 } 152 } 153 h.Event = function(l, k) { 154 this.name = k;
155 this.obj = l; 156 this.listeners = [] 157 }; 158 h.Event.prototype = { 159 addListener : function(o, n, m) { 160 var p = this, k; 161 n = n || p.obj; 162 if (!p.isListening(o, n)) { 163 k = p.createListener(o, n, m); 164 if (p.firing) { 165 p.listeners = p.listeners.slice(0) 166 } 167 p.listeners.push(k) 168 } 169 }, 170 createListener : function(p, n, q) { 171 q = q || {}; 172 n = n || this.obj; 173 var k = { 174 fn : p, 175 scope : n, 176 options : q 177 }, m = p; 178 if (q.target) { 179 m = e(m, q, n) 180 } 181 if (q.delay) { 182 m = a(m, q, k, n) 183 } 184 if (q.single) { 185 m = c(m, this, p, n) 186 } 187 if (q.buffer) { 188 m = b(m, q, k, n) 189 } 190 k.fireFn = m; 191 return k 192 }, 193 findListener : function(o, n) { 194 var p = this.listeners, m = p.length, k; 195 n = n || this.obj; 196 while (m--) { 197 k = p[m]; 198 if (k) { 199 if (k.fn == o && k.scope == n) { 200 return m 201 } 202 } 203 } 204 return -1 205 }, 206 isListening : function(l, k) { 207 return this.findListener(l, k) != -1 208 }, 209 removeListener : function(r, q) { 210 var p, m, n, s = this, o = i; 211 if ((p = s.findListener(r, q)) != -1) { 212 if (s.firing) { 213 s.listeners = s.listeners.slice(0) 214 } 215 m = s.listeners[p]; 216 if (m.task) { 217 m.task.cancel(); 218 delete m.task 219 } 220 n = m.tasks && m.tasks.length; 221 if (n) { 222 while (n--) { 223 m.tasks[n].cancel() 224 } 225 delete m.tasks 226 } 227 s.listeners.splice(p, 1); 228 o = g 229 } 230 return o 231 }, 232 clearListeners : function() { 233 var n = this, k = n.listeners, m = k.length; 234 while (m--) { 235 n.removeListener(k[m].fn, k[m].scope) 236 } 237 }, 238 fire : function() { 239 var q = this, p = q.listeners, k = p.length, o = 0, m; 240 if (k > 0) { 241 q.firing = g; 242 var n = Array.prototype.slice.call(arguments, 0); 243 for (; o < k; o++) { 244 m = p[o]; 245 if (m 246 && m.fireFn.apply(m.scope || q.obj || window, n) === i) { 247 return (q.firing = i) 248 } 249 } 250 } 251 q.firing = i; 252 return g 253 } 254 } 255})(); 256Ext.DomHelper = function() { 257 var x = null, k = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i, m = /^table|tbody|tr|td$/i, d = /tag|children|cn|html$/i, t = /td|tr|tbody/i, o = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi, v = /end/i, r, n = "afterbegin", p = "afterend", c = "beforebegin", q = "beforeend", a = "<table>", i = "</table>", b = a 258 + "<tbody>", j = "</tbody>" + i, l = b + "<tr>", w = "</tr>" + j; 259 function h(B, D, C, E, A, y) { 260 var z = r.insertHtml(E, Ext.getDom(B), u(D)); 261 return C ? Ext.get(z, true) : z 262 } 263 function u(D) { 264 var z = "", y, C, B, E; 265 if (typeof D == "string") { 266 z = D 267 } else { 268 if (Ext.isArray(D)) { 269 for (var A = 0; A < D.length; A++) { 270 if (D[A]) { 271 z += u(D[A]) 272 } 273 } 274 } else { 275 z += "<" + (D.tag = D.tag || "div"); 276 for (y in D) { 277 C = D[y]; 278 if (!d.test(y)) { 279 if (typeof C == "object") { 280 z += " " + y + '="'; 281 for (B in C) { 282 z += B + ":" + C[B] + ";" 283 } 284 z += '"' 285 } else { 286 z += " " + ({ 287 cls : "class", 288 htmlFor : "for" 289 }[y] || y) + '="' + C + '"' 290 } 291 } 292 } 293 if (k.test(D.tag)) { 294 z += "/>" 295 } else { 296 z += ">"; 297 if ((E = D.children || D.cn)) { 298 z += u(E) 299 } else { 300 if (D.html) { 301 z += D.html 302 } 303 } 304 z += "</" + D.tag + ">" 305 } 306 } 307 } 308 return z 309 } 310 function g(F, C, B, D) { 311 x.innerHTML = [C, B, D].join(""); 312 var y = -1, A = x, z; 313 while (++y < F) { 314 A = A.firstChild 315 } 316 if (z = A.nextSibling) { 317 var E = document.createDocumentFragment(); 318 while (A) { 319 z = A.nextSibling; 320 E.appendChild(A); 321 A = z 322 } 323 A = E 324 } 325 return A 326 } 327 function e(y, z, B, A) { 328 var C, D; 329 x = x || document.createElement("div"); 330 if (y == "td" && (z == n || z == q) || !t.test(y) && (z == c || z == p)) { 331 return 332 } 333 D = z == c ? B : z == p ? B.nextSibling : z == n ? B.firstChild : null; 334 if (z == c || z == p) { 335 B = B.parentNode 336 } 337 if (y == "td" || (y == "tr" && (z == q || z == n))) { 338 C = g(4, l, A, w) 339 } else { 340 if ((y == "tbody" && (z == q || z == n)) 341 || (y == "tr" && (z == c || z == p))) { 342 C = g(3, b, A, j) 343 } else { 344 C = g(2, a, A, i) 345 } 346 } 347 B.insertBefore(C, D); 348 return C 349 } 350 function s(A) { 351 var D = document.createElement("div"), y = document 352 .createDocumentFragment(), z = 0, B, C; 353 D.innerHTML = A; 354 C = D.childNodes; 355 B = C.length; 356 for (; z < B; z++) { 357 y.appendChild(C[z].cloneNode(true)) 358 } 359 return y 360 } 361 r = { 362 markup : function(y) { 363 return u(y) 364 }, 365 applyStyles : function(y, z) { 366 if (z) { 367 var A; 368 y = Ext.fly(y); 369 if (typeof z == "function") { 370 z = z.call() 371 } 372 if (typeof z == "string") { 373 o.lastIndex = 0; 374 while ((A = o.exec(z))) { 375 y.setStyle(A[1], A[2]) 376 } 377 } else { 378 if (typeof z == "object") { 379 y.setStyle(z) 380 } 381 } 382 } 383 }, 384 insertHtml : function(D, y, E) { 385 var B = {}, A, F, C, G, H, z; 386 D = D.toLowerCase(); 387 B[c] = ["BeforeBegin", "previousSibling"]; 388 B[p] = ["AfterEnd", "nextSibling"]; 389 if (y.insertAdjacentHTML) { 390 if (m.test(y.tagName) 391 && (z = e(y.tagName.toLowerCase(), D, y, E))) { 392 return z 393 } 394 B[n] = ["AfterBegin", "firstChild"]; 395 B[q] = ["BeforeEnd", "lastChild"]; 396 if ((A = B[D])) { 397 y.insertAdjacentHTML(A[0], E); 398 return y[A[1]] 399 } 400 } else { 401 F = y.ownerDocument.createRange(); 402 G = "setStart" + (v.test(D) ? "After" : "Before");
403 if (B[D]) { 404 F[G](y); 405 if (!F.createContextualFragment) { 406 H = s(E) 407 } else { 408 H = F.createContextualFragment(E) 409 } 410 y.parentNode.insertBefore(H, D == c ? y : y.nextSibling); 411 return y[(D == c ? "previous" : "next") + "Sibling"] 412 } else { 413 C = (D == n ? "first" : "last") + "Child"; 414 if (y.firstChild) { 415 F[G](y[C]); 416 if (!F.createContextualFragment) { 417 H = s(E) 418 } else { 419 H = F.createContextualFragment(E) 420 } 421 if (D == n) { 422 y.insertBefore(H, y.firstChild) 423 } else { 424 y.appendChild(H) 425 } 426 } else { 427 y.innerHTML = E 428 } 429 return y[C] 430 } 431 } 432 throw 'Illegal insertion point -> "' + D + '"' 433 }, 434 insertBefore : function(y, A, z) { 435 return h(y, A, z, c) 436 }, 437 insertAfter : function(y, A, z) { 438 return h(y, A, z, p, "nextSibling") 439 }, 440 insertFirst : function(y, A, z) { 441 return h(y, A, z, n, "firstChild") 442 }, 443 append : function(y, A, z) { 444 return h(y, A, z, q, "", true) 445 }, 446 overwrite : function(y, A, z) { 447 y = Ext.getDom(y); 448 y.innerHTML = u(A); 449 return z ? Ext.get(y.firstChild) : y.firstChild 450 }, 451 createHtml : u 452 }; 453 return r 454}(); 455Ext.Template = function(h) { 456 var j = this, c = arguments, e = [], d; 457 if (Ext.isArray(h)) { 458 h = h.join("") 459 } else { 460 if (c.length > 1) { 461 for (var g = 0, b = c.length; g < b; g++) { 462 d = c[g]; 463 if (typeof d == "object") { 464 Ext.apply(j, d) 465 } else { 466 e.push(d) 467 } 468 } 469 h = e.join("") 470 } 471 } 472 j.html = h; 473 if (j.compiled) { 474 j.compile() 475 } 476}; 477Ext.Template.prototype = { 478 re : /\{([\w\-]+)\}/g, 479 applyTemplate : function(a) { 480 var b = this; 481 return b.compiled ? b.compiled(a) : b.html.replace(b.re, 482 function(c, d) { 483 return a[d] !== undefined ? a[d] : "" 484 }) 485 }, 486 set : function(a, c) { 487 var b = this; 488 b.html = a; 489 b.compiled = null; 490 return c ? b.compile() : b 491 }, 492 compile : function() { 493 var me = this, sep = Ext.isGecko ? "+" : ","; 494 function fn(m, name) { 495 name = "values['" + name + "']"; 496 return "'" + sep + "(" + name + " == undefined ? '' : " + name 497 + ")" + sep + "'" 498 } 499 eval("this.compiled = function(values){ return " 500 + (Ext.isGecko ? "'" : "['") 501 + me.html.replace(/\\/g, "\\\\").replace(/(\r\n|\n)/g, "\\n") 502 .replace(/'/g, "\\'").replace(this.re, fn) 503 + (Ext.isGecko ? "';};" : "'].join('');};")); 504 return me 505 }, 506 insertFirst : function(b, a, c) { 507 return this.doInsert("afterBegin", b, a, c) 508 }, 509 insertBefore : function(b, a, c) { 510 return this.doInsert("beforeBegin", b, a, c) 511 }, 512 insertAfter : function(b, a, c) { 513 return this.doInsert("afterEnd", b, a, c) 514 }, 515 append : function(b, a, c) { 516 return this.doInsert("beforeEnd", b, a, c) 517 }, 518 doInsert : function(c, e, b, a) { 519 e = Ext.getDom(e); 520 var d = Ext.DomHelper.insertHtml(c, e, this.applyTemplate(b)); 521 return a ? Ext.get(d, true) : d 522 }, 523 overwrite : function(b, a, c) { 524 b = Ext.getDom(b); 525 b.innerHTML = this.applyTemplate(a); 526 return c ? Ext.get(b.firstChild, true) : b.firstChild 527 } 528}; 529Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; 530Ext.Template.from = function(b, a) { 531 b = Ext.getDom(b); 532 return new Ext.Template(b.value || b.innerHTML, a || "") 533}; 534Ext.DomQuery = function() { 535 var cache = {}, simpleCache = {}, valueCache = {}, nonSpace = /\S/, trimRe = /^\s+|\s+$/g, tplRe = /\{(\d+)\}/g, modeRe = /^(\s?[\/>
535+~]\s?|\s|$)/, tagTokenRe = /^(#)?([\w\-\*]+)/, nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/, isIE = window.ActiveXObject 536 ? true 537 : false, key = 30803; 538 eval("var batch = 30803;"); 539 function child(parent, index) { 540 var i = 0, n = parent.firstChild; 541 while (n) { 542 if (n.nodeType == 1) { 543 if (++i == index) { 544 return n 545 } 546 } 547 n = n.nextSibling 548 } 549 return null 550 } 551 function next(n) { 552 while ((n = n.nextSibling) && n.nodeType != 1) { 553 } 554 return n 555 } 556 function prev(n) { 557 while ((n = n.previousSibling) && n.nodeType != 1) { 558 } 559 return n 560 } 561 function children(parent) { 562 var n = parent.firstChild, nodeIndex = -1, nextNode; 563 while (n) { 564 nextNode = n.nextSibling; 565 if (n.nodeType == 3 && !nonSpace.test(n.nodeValue)) { 566 parent.removeChild(n) 567 } else { 568 n.nodeIndex = ++nodeIndex 569 } 570 n = nextNode 571 } 572 return this 573 } 574 function byClassName(nodeSet, cls) { 575 if (!cls) { 576 return nodeSet 577 } 578 var result = [], ri = -1; 579 for (var i = 0, ci; ci = nodeSet[i]; i++) { 580 if ((" " + ci.className + " ").indexOf(cls) != -1) { 581 result[++ri] = ci 582 } 583 } 584 return result 585 } 586 function attrValue(n, attr) { 587 if (!n.tagName && typeof n.length != "undefined") { 588 n = n[0] 589 } 590 if (!n) { 591 return null 592 } 593 if (attr == "for") { 594 return n.htmlFor 595 } 596 if (attr == "class" || attr == "className") { 597 return n.className 598 } 599 return n.getAttribute(attr) || n[attr] 600 } 601 function getNodes(ns, mode, tagName) { 602 var result = [], ri = -1, cs; 603 if (!ns) { 604 return result 605 } 606 tagName = tagName || "*"; 607 if (typeof ns.getElementsByTagName != "undefined") { 608 ns = [ns] 609 } 610 if (!mode) { 611 for (var i = 0, ni; ni = ns[i]; i++) { 612 cs = ni.getElementsByTagName(tagName); 613 for (var j = 0, ci; ci = cs[j]; j++) { 614 result[++ri] = ci 615 } 616 } 617 } else { 618 if (mode == "/" || mode == ">") { 619 var utag = tagName.toUpperCase(); 620 for (var i = 0, ni, cn; ni = ns[i]; i++) { 621 cn = ni.childNodes; 622 for (var j = 0, cj; cj = cn[j]; j++) { 623 if (cj.nodeName == utag || cj.nodeName == tagName 624 || tagName == "*") { 625 result[++ri] = cj 626 } 627 } 628 } 629 } else { 630 if (mode == "+") { 631 var utag = tagName.toUpperCase(); 632 for (var i = 0, n; n = ns[i]; i++) { 633 while ((n = n.nextSibling) && n.nodeType != 1) { 634 } 635 if (n 636 && (n.nodeName == utag || n.nodeName == tagName || tagName == "*")) { 637 result[++ri] = n 638 } 639 } 640 } else { 641 if (mode == "~") { 642 var utag = tagName.toUpperCase(); 643 for (var i = 0, n; n = ns[i]; i++) { 644 while ((n = n.nextSibling)) { 645 if (n.nodeName == utag || n.nodeName == tagName 646 || tagName == "*") { 647 result[++ri] = n 648 } 649 } 650 } 651 } 652 } 653 } 654 } 655 return result 656 } 657 function concat(a, b) { 658 if (b.slice) { 659 return a.concat(b) 660 } 661 for (var i = 0, l = b.length; i < l; i++) { 662 a[a.length] = b[i] 663 } 664 return a 665 } 666 function byTag(cs, tagName) { 667 if (cs.tagName || cs == document) { 668 cs = [cs] 669 } 670 if (!tagName) { 671 return cs 672 } 673 var result = [], ri = -1; 674 tagName = tagName.toLowerCase(); 675 for (var i = 0, ci; ci = cs[i]; i++) { 676 if (ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName) { 677 result[++ri] = ci 678 } 679 } 680 return result 681 } 682 function byId(cs, id) { 683 if (cs.tagName || cs == document) { 684 cs = [cs] 685 } 686 if (!id) { 687 return cs 688 } 689 var result = [], ri = -1; 690 for (var i = 0, ci; ci = cs[i]; i++) { 691 if (ci && ci.id == id) { 692 result[++ri] = ci; 693 return result 694 } 695 } 696 return result 697 } 698 function byAttribute(cs, attr, value, op, custom) { 699 var result = [], ri = -1, useGetStyle = custom == "{", fn = Ext.DomQuery.operators[op], a, xml, hasXml; 700 for (var i = 0, ci; ci = cs[i]; i++) { 701 if (ci.nodeType != 1) { 702 continue 703 } 704 if (!hasXml) { 705 xml = Ext.DomQuery.isXml(ci); 706 hasXml = true 707 } 708 if (!xml) { 709 if (useGetStyle) { 710 a = Ext.DomQuery.getStyle(ci, attr) 711 } else { 712 if (attr == "class" || attr == "className") { 713 a = ci.className 714 } else { 715 if (attr == "for") { 716 a = ci.htmlFor 717 } else { 718 if (attr == "href") { 719 a = ci.getAttribute("href", 2) 720 } else { 721 a = ci.getAttribute(attr) 722 } 723 } 724 } 725 } 726 } else { 727 a = ci.getAttribute(attr) 728 } 729 if ((fn && fn(a, value)) || (!fn && a)) { 730 result[++ri] = ci 731 } 732 } 733 return result 734 } 735 function byPseudo(cs, name, value) { 736 return Ext.DomQuery.pseudos[name](cs, value) 737 } 738 function nodupIEXml(cs) { 739 var d = ++key, r; 740 cs[0].setAttribute("_nodup", d); 741 r = [cs[0]];
742 for (var i = 1, len = cs.length; i < len; i++) { 743 var c = cs[i]; 744 if (!c.getAttribute("_nodup") != d) { 745 c.setAttribute("_nodup", d); 746 r[r.length] = c 747 } 748 } 749 for (var i = 0, len = cs.length; i < len; i++) { 750 cs[i].removeAttribute("_nodup") 751 } 752 return r 753 } 754 function nodup(cs) { 755 if (!cs) { 756 return [] 757 } 758 var len = cs.length, c, i, r = cs, cj, ri = -1; 759 if (!len || typeof cs.nodeType != "undefined" || len == 1) { 760 return cs 761 } 762 if (isIE && typeof cs[0].selectSingleNode != "undefined") { 763 return nodupIEXml(cs) 764 } 765 var d = ++key; 766 cs[0]._nodup = d; 767 for (i = 1; c = cs[i]; i++) { 768 if (c._nodup != d) { 769 c._nodup = d 770 } else { 771 r = []; 772 for (var j = 0; j < i; j++) { 773 r[++ri] = cs[j] 774 } 775 for (j = i + 1; cj = cs[j]; j++) { 776 if (cj._nodup != d) { 777 cj._nodup = d; 778 r[++ri] = cj 779 } 780 } 781 return r 782 } 783 } 784 return r 785 } 786 function quickDiffIEXml(c1, c2) { 787 var d = ++key, r = []; 788 for (var i = 0, len = c1.length; i < len; i++) { 789 c1[i].setAttribute("_qdiff", d) 790 } 791 for (var i = 0, len = c2.length; i < len; i++) { 792 if (c2[i].getAttribute("_qdiff") != d) { 793 r[r.length] = c2[i] 794 } 795 } 796 for (var i = 0, len = c1.length; i < len; i++) { 797 c1[i].removeAttribute("_qdiff") 798 } 799 return r 800 } 801 function quickDiff(c1, c2) { 802 var len1 = c1.length, d = ++key, r = []; 803 if (!len1) { 804 return c2 805 } 806 if (isIE && typeof c1[0].selectSingleNode != "undefined") { 807 return quickDiffIEXml(c1, c2) 808 } 809 for (var i = 0; i < len1; i++) { 810 c1[i]._qdiff = d 811 } 812 for (var i = 0, len = c2.length; i < len; i++) { 813 if (c2[i]._qdiff != d) { 814 r[r.length] = c2[i] 815 } 816 } 817 return r 818 } 819 function quickId(ns, mode, root, id) { 820 if (ns == root) { 821 var d = root.ownerDocument || root; 822 return d.getElementById(id) 823 } 824 ns = getNodes(ns, mode, "*"); 825 return byId(ns, id) 826 } 827 return { 828 getStyle : function(el, name) { 829 return Ext.fly(el).getStyle(name) 830 }, 831 compile : function(path, type) { 832 type = type || "select"; 833 var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"], mode, lastPath, matchers = Ext.DomQuery.matchers, matchersLn = matchers.length, modeMatch, lmode = path 834 .match(modeRe); 835 if (lmode && lmode[1]) { 836 fn[fn.length] = 'mode="' + lmode[1].replace(trimRe, "") + '";'; 837 path = path.replace(lmode[1], "") 838 } 839 while (path.substr(0, 1) == "/") { 840 path = path.substr(1) 841 } 842 while (path && lastPath != path) { 843 lastPath = path; 844 var tokenMatch = path.match(tagTokenRe); 845 if (type == "select") { 846 if (tokenMatch) { 847 if (tokenMatch[1] == "#") { 848 fn[fn.length] = 'n = quickId(n, mode, root, "' 849 + tokenMatch[2] + '");' 850 } else { 851 fn[fn.length] = 'n = getNodes(n, mode, "' 852 + tokenMatch[2] + '");' 853 } 854 path = path.replace(tokenMatch[0], "") 855 } else { 856 if (path.substr(0, 1) != "@") { 857 fn[fn.length] = 'n = getNodes(n, mode, "*");' 858 } 859 } 860 } else { 861 if (tokenMatch) { 862 if (tokenMatch[1] == "#") { 863 fn[fn.length] = 'n = byId(n, "' + tokenMatch[2] 864 + '");' 865 } else { 866 fn[fn.length] = 'n = byTag(n, "' + tokenMatch[2] 867 + '");' 868 } 869 path = path.replace(tokenMatch[0], "") 870 } 871 } 872 while (!(modeMatch = path.match(modeRe))) { 873 var matched = false; 874 for (var j = 0; j < matchersLn; j++) { 875 var t = matchers[j]; 876 var m = path.match(t.re); 877 if (m) { 878 fn[fn.length] = t.select.replace(tplRe, function(x, 879 i) { 880 return m[i] 881 }); 882 path = path.replace(m[0], ""); 883 matched = true; 884 break 885 } 886 } 887 if (!matched) { 888 throw 'Error parsing selector, parsing failed at "' 889 + path + '"' 890 } 891 } 892 if (modeMatch[1]) { 893 fn[fn.length] = 'mode="' + modeMatch[1].replace(trimRe, "") 894 + '";'; 895 path = path.replace(modeMatch[1], "") 896 } 897 } 898 fn[fn.length] = "return nodup(n);\n}"; 899 eval(fn.join("")); 900 return f 901 }, 902 jsSelect : function(path, root, type) { 903 root = root || document; 904 if (typeof root == "string") { 905 root = document.getElementById(root) 906 } 907 var paths = path.split(","), results = []; 908 for (var i = 0, len = paths.length; i < len; i++) { 909 var subPath = paths[i].replace(trimRe, ""); 910 if (!cache[subPath]) { 911 cache[subPath] = Ext.DomQuery.compile(subPath); 912 if (!cache[subPath]) { 913 throw subPath + " is not a valid selector" 914 } 915 } 916 var result = cache[subPath](root); 917 if (result && result != document) { 918 results = results.concat(result) 919 } 920 } 921 if (paths.length > 1) { 922 return nodup(results) 923 } 924 return results 925 }, 926 isXml : function(el) { 927 var docEl = (el ? el.ownerDocument || el : 0).documentElement; 928 return docEl ? docEl.nodeName !== "HTML" : false 929 }, 930 select : document.querySelectorAll ? function(path, root, type) { 931 root = root || document; 932 if (!Ext.DomQuery.isXml(root)) { 933 try { 934 var cs = root.querySelectorAll(path); 935 return Ext.toArray(cs) 936 } catch (ex) { 937 } 938 } 939 return Ext.DomQuery.jsSelect.call(this, path, root, type) 940 } : function(path, root, type) { 941 return Ext.DomQuery.jsSelect.call(this, path, root, type) 942 }, 943 selectNode : function(path, root) { 944 return Ext.DomQuery.select(path, root)[0] 945 }, 946 selectValue : function(path, root, defaultValue) { 947 path = path.replace(trimRe, ""); 948 if (!valueCache[path]) { 949 valueCache[path] = Ext.DomQuery.compile(path, "select") 950 } 951 var n = valueCache[path](root), v; 952 n = n[0] ? n[0] : n; 953 if (typeof n.normalize == "function") { 954 n.normalize() 955 } 956 v = (n && n.firstChild ? n.firstChild.nodeValue : null); 957 return ((v === null || v === undefined || v === "") 958 ? defaultValue 959 : v) 960 }, 961 selectNumber : function(path, root, defaultValue) { 962 var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0
962); 963 return parseFloat(v) 964 }, 965 is : function(el, ss) { 966 if (typeof el == "string") { 967 el = document.getElementById(el) 968 } 969 var isArray = Ext.isArray(el), result = Ext.DomQuery.filter(isArray 970 ? el 971 : [el], ss); 972 return isArray ? (result.length == el.length) : (result.length > 0) 973 }, 974 filter : function(els, ss, nonMatches) { 975 ss = ss.replace(trimRe, ""); 976 if (!simpleCache[ss]) { 977 simpleCache[ss] = Ext.DomQuery.compile(ss, "simple") 978 } 979 var result = simpleCache[ss](els); 980 return nonMatches ? quickDiff(result, els) : result 981 }, 982 matchers : [{ 983 re : /^\.([\w\-]+)/, 984 select : 'n = byClassName(n, " {1} ");' 985 }, { 986 re : /^\:([\w\-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/, 987 select : 'n = byPseudo(n, "{1}", "{2}");' 988 }, { 989 re : /^(?:([\[\{])(?:@)?([\w\-]+)\s?(?:(=|.=)\s?(["']?)(.*?)\4)?[\]\}])/, 990 select : 'n = byAttribute(n, "{2}", "{5}", "{3}", "{1}");' 991 }, { 992 re : /^#([\w\-]+)/, 993 select : 'n = byId(n, "{1}");' 994 }, { 995 re : /^@([\w\-]+)/, 996 select : 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};' 997 }], 998 operators : { 999 "=" : function(a, v) { 1000 return a == v 1001 }, 1002 "!=" : function(a, v) { 1003 return a != v 1004 }, 1005 "^=" : function(a, v) { 1006 return a && a.substr(0, v.length) == v 1007 }, 1008 "$=" : function(a, v) { 1009 return a && a.substr(a.length - v.length) == v 1010 }, 1011 "*=" : function(a, v) { 1012 return a && a.indexOf(v) !== -1 1013 }, 1014 "%=" : function(a, v) { 1015 return (a % v) == 0 1016 }, 1017 "|=" : function(a, v) { 1018 return a && (a == v || a.substr(0, v.length + 1) == v + "-") 1019 }, 1020 "~=" : function(a, v) { 1021 return a && (" " + a + " ").indexOf(" " + v + " ") != -1 1022 } 1023 }, 1024 pseudos : { 1025 "first-child" : function(c) { 1026 var r = [], ri = -1, n; 1027 for (var i = 0, ci; ci = n = c[i]; i++) { 1028 while ((n = n.previousSibling) && n.nodeType != 1) { 1029 } 1030 if (!n) { 1031 r[++ri] = ci 1032 } 1033 } 1034 return r 1035 }, 1036 "last-child" : function(c) { 1037 var r = [], ri = -1, n; 1038 for (var i = 0, ci; ci = n = c[i]; i++) { 1039 while ((n = n.nextSibling) && n.nodeType != 1) { 1040 } 1041 if (!n) { 1042 r[++ri] = ci 1043 } 1044 } 1045 return r 1046 }, 1047 "nth-child" : function(c, a) { 1048 var r = [], ri = -1, m = nthRe.exec(a == "even" && "2n" 1049 || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a 1050 || a), f = (m[1] || 1) - 0, l = m[2] - 0; 1051 for (var i = 0, n; n = c[i]; i++) { 1052 var pn = n.parentNode; 1053 if (batch != pn._batch) { 1054 var j = 0; 1055 for (var cn = pn.firstChild; cn; cn = cn.nextSibling) { 1056 if (cn.nodeType == 1) { 1057 cn.nodeIndex = ++j 1058 } 1059 } 1060 pn._batch = batch 1061 } 1062 if (f == 1) { 1063 if (l == 0 || n.nodeIndex == l) { 1064 r[++ri] = n 1065 } 1066 } else { 1067 if ((n.nodeIndex + l) % f == 0) { 1068 r[++ri] = n 1069 } 1070 } 1071 } 1072 return r 1073 }, 1074 "only-child" : function(c) { 1075 var r = [], ri = -1; 1076 for (var i = 0, ci; ci = c[i]; i++) { 1077 if (!prev(ci) && !next(ci)) { 1078 r[++ri] = ci 1079 } 1080 } 1081 return r 1082 }, 1083 empty : function(c) { 1084 var r = [], ri = -1; 1085 for (var i = 0, ci; ci = c[i]; i++) { 1086 var cns = ci.childNodes, j = 0, cn, empty = true; 1087 while (cn = cns[j]) { 1088 ++j; 1089 if (cn.nodeType == 1 || cn.nodeType == 3) { 1090 empty = false; 1091 break 1092 } 1093 } 1094 if (empty) { 1095 r[++ri] = ci 1096 } 1097 } 1098 return r 1099 }, 1100 contains : function(c, v) { 1101 var r = [], ri = -1; 1102 for (var i = 0, ci; ci = c[i]; i++) { 1103 if ((ci.textContent || ci.innerText || "").indexOf(v) != -1) { 1104 r[++ri] = ci 1105 } 1106 } 1107 return r 1108 }, 1109 nodeValue : function(c, v) { 1110 var r = [], ri = -1; 1111 for (var i = 0, ci; ci = c[i]; i++) { 1112 if (ci.firstChild && ci.firstChild.nodeValue == v) { 1113 r[++ri] = ci 1114 } 1115 } 1116 return r 1117 }, 1118 checked : function(c) { 1119 var r = [], ri = -1; 1120 for (var i = 0, ci; ci = c[i]; i++) { 1121 if (ci.checked == true) { 1122 r[++ri] = ci 1123 } 1124 } 1125 return r 1126 }, 1127 not : function(c, ss) { 1128 return Ext.DomQuery.filter(c, ss, true) 1129 }, 1130 any : function(c, selectors) { 1131 var ss = selectors.split("|"), r = [], ri = -1, s; 1132 for (var i = 0, ci; ci = c[i]; i++) { 1133 for (var j = 0; s = ss[j]; j++) { 1134 if (Ext.DomQuery.is(ci, s)) { 1135 r[++ri] = ci; 1136 break 1137 } 1138 } 1139 } 1140 return r 1141 }, 1142 odd : function(c) { 1143 return this["nth-child"](c, "odd") 1144 }, 1145 even : function(c) { 1146 return this["nth-child"](c, "even") 1147 }, 1148 nth : function(c, a) { 1149 return c[a - 1] || [] 1150 }, 1151 first : function(c) { 1152 return c[0] || [] 1153 }, 1154 last : function(c) { 1155 return c[c.length - 1] || [] 1156 }, 1157 has : function(c, ss) { 1158 var s = Ext.DomQuery.select, r = [], ri = -1; 1159 for (var i = 0, ci; ci = c[i]; i++) { 1160 if (s(ss, ci).length > 0) { 1161 r[++ri] = ci 1162 } 1163 } 1164 return r 1165 }, 1166 next : function(c, ss) { 1167 var is = Ext.DomQuery.is, r = [], ri = -1; 1168 for (var i = 0, ci; ci = c[i]; i++) { 1169 var n = next(ci); 1170 if (n && is(n, ss)) { 1171 r[++ri] = ci 1172 } 1173 } 1174 return r 1175 }, 1176 prev : function(c, ss) { 1177 var is = Ext.DomQuery.is, r = [], ri = -1; 1178 for (var i = 0, ci; ci = c[i]; i++) { 1179 var n = prev(ci); 1180 if (n && is(n, ss)) { 1181 r[++ri] = ci 1182 } 1183 } 1184 return r 1185 } 1186 } 1187 } 1188}(); 1189Ext.query = Ext.DomQuery.select; 1190Ext.util.DelayedTask = function(d, c, a) { 1191 var e = this, g, b = function() { 1192 clearInterval(g); 1193 g = null; 1194 d.apply(c, a || []) 1195 }; 1196 e.delay = function(i, k, j, h) { 1197 e.cancel(); 1198 d = k || d; 1199 c = j || c; 1200 a = h || a; 1201 g = setInterval(b, i) 1202 }; 1203 e.cancel = function() { 1204 if (g) { 1205 clearInterval(g); 1206 g = null 1207 } 1208 } 1209}; 1210(function() { 1211 var h = document; 1212 Ext.Element = function(l, m) { 1213 var n = typeof l == "string" ? h.getElementById(l) : l, o; 1214 if (!n) { 1215 return null 1216 } 1217 o = n.id; 1218 if (!m && o && Ext.elCache[o]) { 1219 return Ext.elCache[o].el 1220 } 1221 this.dom = n; 1222 this.id = o || Ext.id(n) 1223 }; 1224 var d = Ext.DomHelper, e = Ext.Element, a = Ext.elCache; 1225 e.prototype = { 1226 set : function(q, m) { 1227 var n = this.dom, l, p, m = (m !== false) && !!n.setAttribute; 1228 for (l in q) { 1229 if (q.hasOwnProperty(l)) { 1230 p = q[l]; 1231 if (l == "style") { 1232 d.applyStyles(n, p) 1233 } else { 1234 if (l == "cls") { 1235 n.className = p 1236 } else { 1237 if (m) { 1238 n.setAttribute(l, p) 1239 } else { 1240 n[l] = p 1241 } 1242 } 1243 } 1244 } 1245 } 1246 return this 1247 }, 1248 defaultUnit : "px", 1249 is : function(l) { 1250 return Ext.DomQuery.is(this.dom, l) 1251 }, 1252 focus : function(o, n) { 1253 var l = this, n = n || l.dom; 1254 try { 1255 if (Number(o)) { 1256 l.focus.defer(o, null, [null, n]) 1257 } else { 1258 n.focus() 1259 } 1260 } catch (m) { 1261 } 1262 return l 1263 }, 1264 blur : function() { 1265 try { 1266 this.dom.blur() 1267 } catch (l) { 1268 } 1269 return this 1270 }, 1271 getValue : function(l) { 1272 var m = this.dom.value; 1273 return l ? parseInt(m, 10) : m 1274 }, 1275 addListener : function(l, o, n, m) { 1276 Ext.EventManager.on(this.dom, l, o, n || this, m); 1277 return this 1278 }, 1279 removeListener : function(l, n, m) { 1280 Ext.EventManager.removeListener(this.dom, l, n, m || this); 1281 return this 1282 }, 1283 removeAllListeners : function() { 1284 Ext.EventManager.removeAll(this.dom); 1285 return this 1286 }, 1287 purgeAllListeners : function() { 1288 Ext.EventManager.purgeElement(this, true); 1289 return this 1290 }, 1291 addUnits : function(l) { 1292 if (l === "" || l == "auto" || l === undefined) { 1293 l = l || "" 1294 } else { 1295 if (!isNaN(l) || !i.test(l)) { 1296 l = l + (this.defaultUnit || "px") 1297 } 1298 } 1299 return l 1300 }, 1301 load : function(m, n, l) { 1302 Ext.Ajax.request(Ext.apply({
1303 params : n, 1304 url : m.url || m, 1305 callback : l, 1306 el : this.dom, 1307 indicatorText : m.indicatorText || "" 1308 }, Ext.isObject(m) ? m : {})); 1309 return this 1310 }, 1311 isBorderBox : function() { 1312 return Ext.isBorderBox || Ext.isForcedBorderBox 1313 || g[(this.dom.tagName || "").toLowerCase()] 1314 }, 1315 remove : function() { 1316 var l = this, m = l.dom; 1317 if (m) { 1318 delete l.dom; 1319 Ext.removeNode(m) 1320 } 1321 }, 1322 hover : function(m, l, o, n) { 1323 var p = this; 1324 p.on("mouseenter", m, o || p.dom, n); 1325 p.on("mouseleave", l, o || p.dom, n); 1326 return p 1327 }, 1328 contains : function(l) { 1329 return !l ? false : Ext.lib.Dom.isAncestor(this.dom, l.dom 1330 ? l.dom 1331 : l) 1332 }, 1333 getAttributeNS : function(m, l) { 1334 return this.getAttribute(l, m) 1335 }, 1336 getAttribute : (function() { 1337 var p = document.createElement("table"), o = false, m = "getAttribute" in p, l = /undefined|unknown/; 1338 if (m) { 1339 try { 1340 p.getAttribute("ext:qtip") 1341 } catch (n) { 1342 o = true 1343 } 1344 return function(q, s) { 1345 var r = this.dom, t; 1346 if (r.getAttributeNS) { 1347 t = r.getAttributeNS(s, q) || null 1348 } 1349 if (t == null) { 1350 if (s) { 1351 if (o && r.tagName.toUpperCase() == "TABLE") { 1352 try { 1353 t = r.getAttribute(s + ":" + q) 1354 } catch (u) { 1355 t = "" 1356 } 1357 } else { 1358 t = r.getAttribute(s + ":" + q) 1359 } 1360 } else { 1361 t = r.getAttribute(q) || r[q] 1362 } 1363 } 1364 return t || "" 1365 } 1366 } else { 1367 return function(q, s) { 1368 var r = this.om, u, t; 1369 if (s) { 1370 t = r[s + ":" + q]; 1371 u = l.test(typeof t) ? undefined : t 1372 } else { 1373 u = r[q] 1374 } 1375 return u || "" 1376 } 1377 } 1378 p = null 1379 })(), 1380 update : function(l) { 1381 if (this.dom) { 1382 this.dom.innerHTML = l 1383 } 1384 return this 1385 } 1386 }; 1387 var k = e.prototype; 1388 e.addMethods = function(l) { 1389 Ext.apply(k, l) 1390 }; 1391 k.on = k.addListener; 1392 k.un = k.removeListener; 1393 k.autoBoxAdjust = true; 1394 var i = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i, c; 1395 e.get = function(m) { 1396 var l, p, o; 1397 if (!m) { 1398 return null 1399 } 1400 if (typeof m == "string") { 1401 if (!(p = h.getElementById(m))) { 1402 return null 1403 } 1404 if (a[m] && a[m].el) { 1405 l = a[m].el; 1406 l.dom = p 1407 } else { 1408 l = e.addToCache(new e(p)) 1409 } 1410 return l 1411 } else { 1412 if (m.tagName) { 1413 if (!(o = m.id)) { 1414 o = Ext.id(m) 1415 } 1416 if (a[o] && a[o].el) { 1417 l = a[o].el; 1418 l.dom = m 1419 } else { 1420 l = e.addToCache(new e(m)) 1421 } 1422 return l 1423 } else { 1424 if (m instanceof e) { 1425 if (m != c) { 1426 if (Ext.isIE && (m.id == undefined || m.id == "")) { 1427 m.dom = m.dom 1428 } else { 1429 m.dom = h.getElementById(m.id) || m.dom 1430 } 1431 } 1432 return m 1433 } else { 1434 if (m.isComposite) { 1435 return m 1436 } else { 1437 if (Ext.isArray(m)) { 1438 return e.select(m) 1439 } else { 1440 if (m == h) { 1441 if (!c) { 1442 var n = function() { 1443 }; 1444 n.prototype = e.prototype; 1445 c = new n(); 1446 c.dom = h 1447 } 1448 return c 1449 } 1450 } 1451 } 1452 } 1453 } 1454 } 1455 return null 1456 }; 1457 e.addToCache = function(l, m) { 1458 m = m || l.id; 1459 a[m] = { 1460 el : l, 1461 data : {}, 1462 events : {} 1463 }; 1464 return l 1465 }; 1466 e.data = function(m, l, n) { 1467 m = e.get(m); 1468 if (!m) { 1469 return null 1470 } 1471 var o = a[m.id].data; 1472 if (arguments.length == 2) { 1473 return o[l] 1474 } else { 1475 return (o[l] = n) 1476 } 1477 }; 1478 function j() { 1479 if (!Ext.enableGarbageCollector) { 1480 if (e && e.collectorThreadId) { 1481 clearInterval(e.collectorThreadId) 1482 } 1483 } else { 1484 var l, n, q, p; 1485 for (l in a) { 1486 p = a[l]; 1487 if (p.skipGC) { 1488 continue 1489 } 1490 n = p.el; 1491 q = n.dom; 1492 try { 1493 if (!q || !q.parentNode 1494 || (!q.offsetParent && !h.getElementById(l))) { 1495 if (Ext.enableListenerCollection) { 1496 Ext.EventManager.removeAll(q) 1497 } 1498 delete a[l] 1499 } 1500 } catch (e){} 1501 } 1502 if (Ext.isIE) { 1503 var m = {}; 1504 for (l in a) { 1505 m[l] = a[l] 1506 } 1507 a = Ext.elCache = m 1508 } 1509 } 1510 }
1511 e.collectorThreadId = setInterval(j, 30000); 1512 var b = function() { 1513 }; 1514 b.prototype = e.prototype; 1515 e.Flyweight = function(l) { 1516 this.dom = l 1517 }; 1518 e.Flyweight.prototype = new b(); 1519 e.Flyweight.prototype.isFlyweight = true; 1520 e._flyweights = {}; 1521 e.fly = function(n, l) { 1522 var m = null; 1523 l = l || "_global"; 1524 if (n = Ext.getDom(n)) { 1525 (e._flyweights[l] = e._flyweights[l] || new e.Flyweight()).dom = n; 1526 m = e._flyweights[l] 1527 } 1528 return m 1529 }; 1530 Ext.get = e.get; 1531 Ext.fly = e.fly; 1532 var g = Ext.isStrict ? { 1533 select : 1 1534 } : { 1535 input : 1, 1536 select : 1, 1537 textarea : 1 1538 }; 1539 if (Ext.isIE || Ext.isGecko) { 1540 g.button = 1 1541 } 1542})(); 1543Ext.Element.addMethods(function() { 1544 var d = "parentNode", b = "nextSibling", c = "previousSibling", e = Ext.DomQuery, a = Ext.get; 1545 return { 1546 findParent : function(m, l, h) { 1547 var j = this.dom, g = document.body, k = 0, i; 1548 if (Ext.isGecko 1549 && Object.prototype.toString.call(j) == "[object XULElement]") { 1550 return null 1551 } 1552 l = l || 50; 1553 if (isNaN(l)) { 1554 i = Ext.getDom(l); 1555 l = Number.MAX_VALUE 1556 } 1557 while (j && j.nodeType == 1 && k < l && j != g && j != i) { 1558 if (e.is(j, m)) { 1559 return h ? a(j) : j 1560 } 1561 k++; 1562 j = j.parentNode 1563 } 1564 return null 1565 }, 1566 findParentNode : function(j, i, g) { 1567 var h = Ext.fly(this.dom.parentNode, "_internal"); 1568 return h ? h.findParent(j, i, g) : null 1569 }, 1570 up : function(h, g) { 1571 return this.findParentNode(h, g, true) 1572 }, 1573 select : function(g) { 1574 return Ext.Element.select(g, this.dom) 1575 }, 1576 query : function(g) { 1577 return e.select(g, this.dom) 1578 }, 1579 child : function(g, h) { 1580 var i = e.selectNode(g, this.dom); 1581 return h ? i : a(i) 1582 }, 1583 down : function(g, h) { 1584 var i = e.selectNode(" > " + g, this.dom); 1585 return h ? i : a(i) 1586 }, 1587 parent : function(g, h) { 1588 return this.matchNode(d, d, g, h) 1589 }, 1590 next : function(g, h) { 1591 return this.matchNode(b, b, g, h) 1592 }, 1593 prev : function(g, h) { 1594 return this.matchNode(c, c, g, h) 1595 }, 1596 first : function(g, h) { 1597 return this.matchNode(b, "firstChild", g, h) 1598 }, 1599 last : function(g, h) { 1600 return this.matchNode(c, "lastChild", g, h) 1601 }, 1602 matchNode : function(h, k, g, i) { 1603 var j = this.dom[k]; 1604 while (j) { 1605 if (j.nodeType == 1 && (!g || e.is(j, g))) { 1606 return !i ? a(j) : j 1607 } 1608 j = j[h] 1609 } 1610 return null 1611 } 1612 } 1613}()); 1614Ext.Element.addMethods(function() { 1615 var c = Ext.getDom, a = Ext.get, b = Ext.DomHelper; 1616 return { 1617 appendChild : function(d) { 1618 return a(d).appendTo(this) 1619 }, 1620 appendTo : function(d) { 1621 c(d).appendChild(this.dom); 1622 return this 1623 }, 1624 insertBefore : function(d) { 1625 (d = c(d)).parentNode.insertBefore(this.dom, d); 1626 return this 1627 }, 1628 insertAfter : function(d) { 1629 (d = c(d)).parentNode.insertBefore(this.dom, d.nextSibling); 1630 return this 1631 }, 1632 insertFirst : function(e, d) { 1633 e = e || {}; 1634 if (e.nodeType || e.dom || typeof e == "string") { 1635 e = c(e); 1636 this.dom.insertBefore(e, this.dom.firstChild); 1637 return !d ? a(e) : e 1638 } else { 1639 return this.createChild(e, this.dom.firstChild, d) 1640 } 1641 }, 1642 replace : function(d) { 1643 d = a(d); 1644 this.insertBefore(d); 1645 d.remove(); 1646 return this 1647 }, 1648 replaceWith : function(d) { 1649 var e = this; 1650 if (d.nodeType || d.dom || typeof d == "string") { 1651 d = c(d); 1652 e.dom.parentNode.insertBefore(d, e.dom) 1653 } else { 1654 d = b.insertBefore(e.dom, d) 1655 } 1656 delete Ext.elCache[e.id]; 1657 Ext.removeNode(e.dom); 1658 e.id = Ext.id(e.dom = d); 1659 Ext.Element.addToCache(e.isFlyweight 1660 ? new Ext.Element(e.dom) 1661 : e); 1662 return e 1663 }, 1664 createChild : function(e, d, g) { 1665 e = e || { 1666 tag : "div" 1667 }; 1668 return d 1669 ? b.insertBefore(d, e, g !== true) 1670 : b[!this.dom.firstChild ? "overwrite" : "append"]( 1671 this.dom, e, g !== true) 1672 }, 1673 wrap : function(d, e) { 1674 var g = b.insertBefore(this.dom, d || { 1675 tag : "div" 1676 }, !e); 1677 g.dom ? g.dom.appendChild(this.dom) : g 1678 .appendChild(this.dom); 1679 return g 1680 }, 1681 insertHtml : function(e, g, d) { 1682 var h = b.insertHtml(e, this.dom, g); 1683 return d ? Ext.get(h) : h 1684 } 1685 } 1686 }()); 1687Ext.Element.addMethods(function() {
1688 var A = Ext.supports, h = {}, x = /(-[a-z])/gi, s = document.defaultView, D = /alpha\(opacity=(.*)\)/i, l = /^\s+|\s+$/g, B = Ext.Element, u = /\s+/, b = /\w/g, d = "padding", c = "margin", y = "border", t = "-left", q = "-right", w = "-top", o = "-bottom", j = "-width", r = Math, z = "hidden", e = "isClipped", k = "overflow", n = "overflow-x", m = "overflow-y", C = "originalClip", i = { 1689 l : y + t + j, 1690 r : y + q + j, 1691 t : y + w + j, 1692 b : y + o + j 1693 }, g = { 1694 l : d + t, 1695 r : d + q, 1696 t : d + w, 1697 b : d + o 1698 }, a = { 1699 l : c + t, 1700 r : c + q, 1701 t : c + w, 1702 b : c + o 1703 }, E = Ext.Element.data; 1704 function p(F, G) { 1705 return G.charAt(1).toUpperCase() 1706 } 1707 function v(F) { 1708 return h[F] 1709 || (h[F] = F == "float" ? (A.cssFloat 1710 ? "cssFloat" 1711 : "styleFloat") : F.replace(x, p)) 1712 } 1713 return { 1714 adjustWidth : function(F) { 1715 var G = this; 1716 var H = (typeof F == "number"); 1717 if (H && G.autoBoxAdjust && !G.isBorderBox()) { 1718 F -= (G.getBorderWidth("lr") + G.getPadding("lr")) 1719 } 1720 return (H && F < 0) ? 0 : F 1721 }, 1722 adjustHeight : function(F) { 1723 var G = this; 1724 var H = (typeof F == "number"); 1725 if (H && G.autoBoxAdjust && !G.isBorderBox()) { 1726 F -= (G.getBorderWidth("tb") + G.getPadding("tb")) 1727 } 1728 return (H && F < 0) ? 0 : F 1729 }, 1730 addClass : function(J) { 1731 var K = this, I, F, H, G = []; 1732 if (!Ext.isArray(J)) { 1733 if (typeof J == "string" && !this.hasClass(J)) { 1734 K.dom.className += " " + J 1735 } 1736 } else { 1737 for (I = 0, F = J.length; I < F; I++) { 1738 H = J[I]; 1739 if (typeof H == "string" 1740 && (" " + K.dom.className + " ").indexOf(" " + H 1741 + " ") == -1) { 1742 G.push(H) 1743 } 1744 } 1745 if (G.length) { 1746 K.dom.className += " " + G.join(" ") 1747 } 1748 } 1749 return K 1750 }, 1751 removeClass : function(K) { 1752 var L = this, J, G, F, I, H; 1753 if (!Ext.isArray(K)) { 1754 K = [K] 1755 } 1756 if (L.dom && L.dom.className) { 1757 H = L.dom.className.replace(l, "").split(u); 1758 for (J = 0, F = K.length; J < F; J++) { 1759 I = K[J]; 1760 if (typeof I == "string") { 1761 I = I.replace(l, ""); 1762 G = H.indexOf(I); 1763 if (G != -1) { 1764 H.splice(G, 1) 1765 } 1766 } 1767 } 1768 L.dom.className = H.join(" ") 1769 } 1770 return L 1771 }, 1772 radioClass : function(I) { 1773 var J = this.dom.parentNode.childNodes, G, H, F; 1774 I = Ext.isArray(I) ? I : [I]; 1775 for (H = 0, F = J.length; H < F; H++) { 1776 G = J[H]; 1777 if (G && G.nodeType == 1) { 1778 Ext.fly(G, "_internal").removeClass(I) 1779 } 1780 } 1781 return this.addClass(I) 1782 }, 1783 toggleClass : function(F) { 1784 return this.hasClass(F) ? this.removeClass(F) : this.addClass(F) 1785 }, 1786 hasClass : function(F) { 1787 return F 1788 && (" " + this.dom.className + " ").indexOf(" " + F + " ") != -1 1789 }, 1790 replaceClass : function(G, F) { 1791 return this.removeClass(G).addClass(F) 1792 }, 1793 isStyle : function(F, G) { 1794 return this.getStyle(F) == G 1795 }, 1796 getStyle : function() { 1797 return s && s.getComputedStyle ? function(K) { 1798 var I = this.dom, F, H, G, J; 1799 if (I == document) { 1800 return null 1801 } 1802 K = v(K); 1803 G = (F = I.style[K]) ? F : (H = s.getComputedStyle(I, "")) 1804 ? H[K] 1805 : null; 1806 if (K == "marginRight" && G != "0px" && !A.correctRightMargin) { 1807 J = I.style.display; 1808 I.style.display = "inline-block"; 1809 G = s.getComputedStyle(I, "").marginRight; 1810 I.style.display = J 1811 } 1812 if (K == "backgroundColor" && G == "rgba(0, 0, 0, 0)" 1813 && !A.correctTransparentColor) { 1814 G = "transparent" 1815 } 1816 return G 1817 } : function(J) { 1818 var H = this.dom, F, G; 1819 if (H == document) { 1820 return null 1821 } 1822 if (J == "opacity") { 1823 if (H.style.filter.match) { 1824 if (F = H.style.filter.match(D)) { 1825 var I = parseFloat(F[1]); 1826 if (!isNaN(I)) { 1827 return I ? I / 100 : 0 1828 } 1829 } 1830 } 1831 return 1 1832 } 1833 J = v(J); 1834 return H.style[J] || ((G = H.currentStyle) ? G[J] : null) 1835 } 1836 }(), 1837 getColor : function(F, G, K) { 1838 var I = this.getStyle(F), H = (typeof K != "undefined") ? K : "#", J; 1839 if (!I || (/transparent|inherit/.test(I))) { 1840 return G 1841 } 1842 if (/^r/.test(I)) { 1843 Ext.each(I.slice(4, I.length - 1).split(","), function(L) { 1844 J = parseInt(L, 10); 1845 H += (J < 16 ? "0" : "") + J.toString(16) 1846 }) 1847 } else { 1848 I = I.replace("#", ""); 1849 H += I.length == 3 ? I 1850 .replace(/^(\w)(\w)(\w)$/, "$1$1$2$2$3$3") : I 1851 } 1852 return (H.length > 5 ? H.toLowerCase() : G) 1853 }, 1854 setStyle : function(I, H) { 1855 var F, G; 1856 if (typeof I != "object") { 1857 F = {}; 1858 F[I] = H; 1859 I = F 1860 } 1861 for (G in I) { 1862 H = I[G]; 1863 G == "opacity" ? this.setOpacity(H) : this.dom.style[v(G)] = H 1864 } 1865 return this 1866 }, 1867 setOpacity : function(G, F) { 1868 var J = this, H = J.dom.style; 1869 if (!F || !J.anim) { 1870 if (Ext.isIE) { 1871 var I = G < 1 ? "alpha(opacity=" + G * 100 + ")" : "", K = H.filter 1872 .replace(D, "").replace(l, ""); 1873 H.zoom = 1; 1874 H.filter = K + (K.length > 0 ? " " : "") + I 1875 } else { 1876 H.opacity = G 1877 } 1878 } else { 1879 J.anim({ 1880 opacity : { 1881 to : G 1882 } 1883 }, J.preanim(arguments, 1), null, 0.35, "easeIn") 1884 } 1885 return J 1886 }, 1887 clearOpacity : function() { 1888 var F = this.dom.style; 1889 if (Ext.isIE) { 1890 if (!Ext.isEmpty(F.filter)) { 1891 F.filter = F.filter.replace(D, "").replace(l, "") 1892 } 1893 } else { 1894 F.opacity = F["-moz-opacity"] = F["-khtml-opacity"] = "" 1895 } 1896 return this 1897 }, 1898 getHeight : function(H) { 1899 var G = this, J = G.dom, I = Ext.isIE 1900 && G.isStyle("display", "none"), F = r.max(J.offsetHeight, 1901 I ? 0 : J.clientHeight) 1902 || 0; 1903 F = !H ? F : F - G.getBorderWidth("tb") - G.getPadding("tb"); 1904 return F < 0 ? 0 : F 1905 }, 1906 getWidth : function(G) { 1907 var H = this, J = H.dom, I = Ext.isIE 1908 && H.isStyle("display", "none"), F = r.max(J.offsetWidth, I 1909 ? 0 1910 : J.clientWidth) 1911 || 0; 1912 F = !G ? F : F - H.getBorderWidth("lr") - H.getPadding("lr"); 1913 return F < 0 ? 0 : F 1914 }, 1915 setWidth : function(G, F) { 1916 var H = this; 1917 G = H.adjustWidth(G); 1918 !F || !H.anim ? H.dom.style.width = H.addUnits(G) : H.anim({ 1919 width : { 1920 to : G 1921 } 1922 }, H.preanim(arguments, 1)); 1923 return H 1924 }, 1925 setHeight : function(F, G) { 1926 var H = this; 1927 F = H.adjustHeight(F);
1928 !G || !H.anim ? H.dom.style.height = H.addUnits(F) : H.anim({ 1929 height : { 1930 to : F 1931 } 1932 }, H.preanim(arguments, 1)); 1933 return H 1934 }, 1935 getBorderWidth : function(F) { 1936 return this.addStyles(F, i) 1937 }, 1938 getPadding : function(F) { 1939 return this.addStyles(F, g) 1940 }, 1941 clip : function() { 1942 var F = this, G = F.dom; 1943 if (!E(G, e)) { 1944 E(G, e, true); 1945 E(G, C, { 1946 o : F.getStyle(k), 1947 x : F.getStyle(n), 1948 y : F.getStyle(m) 1949 }); 1950 F.setStyle(k, z); 1951 F.setStyle(n, z); 1952 F.setStyle(m, z) 1953 } 1954 return F 1955 }, 1956 unclip : function() { 1957 var F = this, H = F.dom; 1958 if (E(H, e)) { 1959 E(H, e, false); 1960 var G = E(H, C); 1961 if (G.o) { 1962 F.setStyle(k, G.o) 1963 } 1964 if (G.x) { 1965 F.setStyle(n, G.x) 1966 } 1967 if (G.y) { 1968 F.setStyle(m, G.y) 1969 } 1970 } 1971 return F 1972 }, 1973 addStyles : function(M, L) { 1974 var J = 0, K = M.match(b), I, H, G, F = K.length; 1975 for (G = 0; G < F; G++) { 1976 I = K[G]; 1977 H = I && parseInt(this.getStyle(L[I]), 10); 1978 if (H) { 1979 J += r.abs(H) 1980 } 1981 } 1982 return J 1983 }, 1984 margins : a 1985 } 1986}()); 1987(function() { 1988 var a = Ext.lib.Dom, b = "left", g = "right", d = "top", i = "bottom", h = "position", c = "static", e = "relative", j = "auto", k = "z-index"; 1989 Ext.Element.addMethods({ 1990 getX : function() { 1991 return a.getX(this.dom) 1992 }, 1993 getY : function() { 1994 return a.getY(this.dom) 1995 }, 1996 getXY : function() { 1997 return a.getXY(this.dom) 1998 }, 1999 getOffsetsTo : function(l) { 2000 var n = this.getXY(), m = Ext.fly(l, "_internal").getXY(); 2001 return [n[0] - m[0], n[1] - m[1]] 2002 }, 2003 setX : function(l, m) { 2004 return this.setXY([l, this.getY()], this.animTest( 2005 arguments, m, 1)) 2006 }, 2007 setY : function(m, l) { 2008 return this.setXY([this.getX(), m], this.animTest( 2009 arguments, l, 1)) 2010 }, 2011 setLeft : function(l) { 2012 this.setStyle(b, this.addUnits(l)); 2013 return this 2014 }, 2015 setTop : function(l) { 2016 this.setStyle(d, this.addUnits(l)); 2017 return this 2018 }, 2019 setRight : function(l) { 2020 this.setStyle(g, this.addUnits(l)); 2021 return this 2022 }, 2023 setBottom : function(l) { 2024 this.setStyle(i, this.addUnits(l)); 2025 return this 2026 }, 2027 setXY : function(n, l) { 2028 var m = this; 2029 if (!l || !m.anim) { 2030 a.setXY(m.dom, n) 2031 } else { 2032 m.anim({ 2033 points : { 2034 to : n 2035 } 2036 }, m.preanim(arguments, 1), "motion") 2037 } 2038 return m 2039 }, 2040 setLocation : function(l, n, m) { 2041 return this.setXY([l, n], this.animTest(arguments, m, 2)) 2042 }, 2043 moveTo : function(l, n, m) { 2044 return this.setXY([l, n], this.animTest(arguments, m, 2)) 2045 }, 2046 getLeft : function(l) { 2047 return !l ? this.getX() : parseInt(this.getStyle(b), 10) 2048 || 0 2049 }, 2050 getRight : function(l) { 2051 var m = this; 2052 return !l ? m.getX() + m.getWidth() : (m.getLeft(true) + m 2053 .getWidth()) 2054 || 0 2055 }, 2056 getTop : function(l) { 2057 return !l ? this.getY() : parseInt(this.getStyle(d), 10) 2058 || 0 2059 }, 2060 getBottom : function(l) { 2061 var m = this; 2062 return !l ? m.getY() + m.getHeight() : (m.getTop(true) + m 2063 .getHeight()) 2064 || 0 2065 }, 2066 position : function(p, o, l, n) { 2067 var m = this; 2068 if (!p && m.isStyle(h, c)) { 2069 m.setStyle(h, e) 2070 } else { 2071 if (p) { 2072 m.setStyle(h, p) 2073 } 2074 } 2075 if (o) { 2076 m.setStyle(k, o) 2077 } 2078 if (l || n) { 2079 m.setXY([l || false, n || false]) 2080 } 2081 }, 2082 clearPositioning : function(l) { 2083 l = l || ""; 2084 this.setStyle({ 2085 left : l, 2086 right : l, 2087 top : l, 2088 bottom : l, 2089 "z-index" : "", 2090 position : c 2091 }); 2092 return this 2093 }, 2094 getPositioning : function() { 2095 var m = this.getStyle(b); 2096 var n = this.getStyle(d); 2097 return { 2098 position : this.getStyle(h), 2099 left : m, 2100 right : m ? "" : this.getStyle(g), 2101 top : n,
2102 bottom : n ? "" : this.getStyle(i), 2103 "z-index" : this.getStyle(k) 2104 } 2105 }, 2106 setPositioning : function(l) { 2107 var n = this, m = n.dom.style; 2108 n.setStyle(l); 2109 if (l.right == j) { 2110 m.right = "" 2111 } 2112 if (l.bottom == j) { 2113 m.bottom = "" 2114 } 2115 return n 2116 }, 2117 translatePoints : function(m, u) { 2118 u = isNaN(m[1]) ? u : m[1]; 2119 m = isNaN(m[0]) ? m : m[0]; 2120 var q = this, r = q.isStyle(h, e), s = q.getXY(), n = parseInt( 2121 q.getStyle(b), 10), p = parseInt(q.getStyle(d), 10); 2122 n = !isNaN(n) ? n : (r ? 0 : q.dom.offsetLeft); 2123 p = !isNaN(p) ? p : (r ? 0 : q.dom.offsetTop); 2124 return { 2125 left : (m - s[0] + n), 2126 top : (u - s[1] + p) 2127 } 2128 }, 2129 animTest : function(m, l, n) { 2130 return !!l && this.preanim ? this.preanim(m, n) : false 2131 } 2132 }) 2133})(); 2134Ext.Element.addMethods({ 2135 isScrollable : function() { 2136 var a = this.dom; 2137 return a.scrollHeight > a.clientHeight || a.scrollWidth > a.clientWidth 2138 }, 2139 scrollTo : function(a, b) { 2140 this.dom["scroll" + (/top/i.test(a) ? "Top" : "Left")] = b; 2141 return this 2142 }, 2143 getScroll : function() { 2144 var i = this.dom, h = document, a = h.body, c = h.documentElement, b, g, e; 2145 if (i == h || i == a) { 2146 if (Ext.isIE && Ext.isStrict) { 2147 b = c.scrollLeft; 2148 g = c.scrollTop 2149 } else { 2150 b = window.pageXOffset; 2151 g = window.pageYOffset 2152 } 2153 e = { 2154 left : b || (a ? a.scrollLeft : 0), 2155 top : g || (a ? a.scrollTop : 0) 2156 } 2157 } else { 2158 e = { 2159 left : i.scrollLeft, 2160 top : i.scrollTop 2161 } 2162 } 2163 return e 2164 } 2165}); 2166Ext.Element.VISIBILITY = 1; 2167Ext.Element.DISPLAY = 2; 2168Ext.Element.OFFSETS = 3; 2169Ext.Element.ASCLASS = 4; 2170Ext.Element.visibilityCls = "x-hide-nosize"; 2171Ext.Element.addMethods(function() { 2172 var e = Ext.Element, p = "opacity", j = "visibility", g = "display", d = "hidden", n = "offsets", k = "asclass", m = "none", a = "nosize", b = "originalDisplay", c = "visibilityMode", h = "isVisible", i = e.data, l = function( 2173 r) { 2174 var q = i(r, b); 2175 if (q === undefined) { 2176 i(r, b, q = "") 2177 } 2178 return q 2179 }, o = function(r) { 2180 var q = i(r, c); 2181 if (q === undefined) { 2182 i(r, c, q = 1) 2183 } 2184 return q 2185 }; 2186 return { 2187 originalDisplay : "", 2188 visibilityMode : 1, 2189 setVisibilityMode : function(q) { 2190 i(this.dom, c, q); 2191 return this 2192 }, 2193 animate : function(r, t, s, u, q) { 2194 this.anim(r, { 2195 duration : t, 2196 callback : s, 2197 easing : u 2198 }, q); 2199 return this 2200 }, 2201 anim : function(t, u, r, w, s, q) { 2202 r = r || "run"; 2203 u = u || {}; 2204 var v = this, x = Ext.lib.Anim[r](v.dom, t, (u.duration || w) 2205 || 0.35, (u.easing || s) || "easeOut", function() { 2206 if (q) { 2207 q.call(v) 2208 } 2209 if (u.callback) { 2210 u.callback.call(u.scope || v, v, u) 2211 } 2212 }, v); 2213 u.anim = x; 2214 return x 2215 }, 2216 preanim : function(q, r) { 2217 return !q[r] ? false : (typeof q[r] == "object" ? q[r] : { 2218 duration : q[r + 1], 2219 callback : q[r + 2], 2220 easing : q[r + 3] 2221 }) 2222 }, 2223 isVisible : function() { 2224 var q = this, s = q.dom, r = i(s, h); 2225 if (typeof r == "boolean") { 2226 return r 2227 } 2228 r = !q.isStyle(j, d) 2229 && !q.isStyle(g, m) 2230 && !((o(s) == e.ASCLASS) && q.hasClass(q.visibilityCls 2231 || e.visibilityCls)); 2232 i(s, h, r); 2233 return r 2234 }, 2235 setVisible : function(t, q) { 2236 var w = this, r, y, x, v, u = w.dom, s = o(u); 2237 if (typeof q == "string") { 2238 switch (q) { 2239 case g : 2240 s = e.DISPLAY; 2241 break; 2242 case j : 2243 s = e.VISIBILITY; 2244 break; 2245 case n : 2246 s = e.OFFSETS; 2247 break; 2248 case a : 2249 case k : 2250 s = e.ASCLASS; 2251 break 2252 } 2253 w.setVisibilityMode(s); 2254 q = false 2255 } 2256 if (!q || !w.anim) { 2257 if (s == e.ASCLASS) { 2258 w[t ? "removeClass" : "addClass"](w.visibilityCls 2259 || e.visibilityCls) 2260 } else { 2261 if (s == e.DISPLAY) { 2262 return w.setDisplayed(t) 2263 } else { 2264 if (s == e.OFFSETS) { 2265 if (!t) { 2266 w.hideModeStyles = { 2267 position : w.getStyle("position"), 2268 top : w.getStyle("top"), 2269 left : w.getStyle("left") 2270 }; 2271 w.applyStyles({ 2272 position : "absolute",
2273 top : "-10000px", 2274 left : "-10000px" 2275 }) 2276 } else { 2277 w.applyStyles(w.hideModeStyles || { 2278 position : "", 2279 top : "", 2280 left : "" 2281 }); 2282 delete w.hideModeStyles 2283 } 2284 } else { 2285 w.fixDisplay(); 2286 u.style.visibility = t ? "visible" : d 2287 } 2288 } 2289 } 2290 } else { 2291 if (t) { 2292 w.setOpacity(0.01); 2293 w.setVisible(true) 2294 } 2295 w.anim({ 2296 opacity : { 2297 to : (t ? 1 : 0) 2298 } 2299 }, w.preanim(arguments, 1), null, 0.35, "easeIn", 2300 function() { 2301 t || w.setVisible(false).setOpacity(1) 2302 }) 2303 } 2304 i(u, h, t); 2305 return w 2306 }, 2307 hasMetrics : function() { 2308 var q = this.dom; 2309 return this.isVisible() || (o(q) == e.VISIBILITY) 2310 }, 2311 toggle : function(q) { 2312 var r = this; 2313 r.setVisible(!r.isVisible(), r.preanim(arguments, 0)); 2314 return r 2315 }, 2316 setDisplayed : function(q) { 2317 if (typeof q == "boolean") { 2318 q = q ? l(this.dom) : m 2319 } 2320 this.setStyle(g, q); 2321 return this 2322 }, 2323 fixDisplay : function() { 2324 var q = this; 2325 if (q.isStyle(g, m)) { 2326 q.setStyle(j, d); 2327 q.setStyle(g, l(this.dom)); 2328 if (q.isStyle(g, m)) { 2329 q.setStyle(g, "block") 2330 } 2331 } 2332 }, 2333 hide : function(q) { 2334 if (typeof q == "string") { 2335 this.setVisible(false, q); 2336 return this 2337 } 2338 this.setVisible(false, this.preanim(arguments, 0)); 2339 return this 2340 }, 2341 show : function(q) { 2342 if (typeof q == "string") { 2343 this.setVisible(true, q); 2344 return this 2345 } 2346 this.setVisible(true, this.preanim(arguments, 0)); 2347 return this 2348 } 2349 } 2350}()); 2351(function() { 2352 var y = null, A = undefined, k = true, t = false, j = "setX", h = "setY", a = "setXY", n = "left", l = "bottom", s = "top", m = "right", q = "height", g = "width", i = "points", w = "hidden", z = "absolute", u = "visible", e = "motion", o = "position", r = "easeOut", d = new Ext.Element.Flyweight(), v = {}, x = function( 2353 B) { 2354 return B || {} 2355 }, p = function(B) { 2356 d.dom = B; 2357 d.id = Ext.id(B); 2358 return d 2359 }, c = function(B) { 2360 if (!v[B]) { 2361 v[B] = [] 2362 } 2363 return v[B] 2364 }, b = function(C, B) { 2365 v[C] = B 2366 }; 2367 Ext.enableFx = k; 2368 Ext.Fx = { 2369 switchStatements : function(C, D, B) { 2370 return D.apply(this, B[C]) 2371 }, 2372 slideIn : function(H, E) { 2373 E = x(E); 2374 var J = this, G = J.dom, M = G.style, O, B, L, D, C, M, I, N, K, F; 2375 H = H || "t"; 2376 J.queueFx(E, function() { 2377 O = p(G).getXY(); 2378 p(G).fixDisplay(); 2379 B = p(G).getFxRestore(); 2380 L = { 2381 x : O[0], 2382 y : O[1], 2383 0 : O[0], 2384 1 : O[1], 2385 width : G.offsetWidth, 2386 height : G.offsetHeight 2387 }; 2388 L.right = L.x + L.width; 2389 L.bottom = L.y + L.height; 2390 p(G).setWidth(L.width).setHeight(L.height); 2391 D = p(G).fxWrap(B.pos, E, w); 2392 M.visibility = u; 2393 M.position = z; 2394 function P() { 2395 p(G).fxUnwrap(D, B.pos, E); 2396 M.width = B.width; 2397 M.height = B.height; 2398 p(G).afterFx(E) 2399 } 2400 N = { 2401 to : [L.x, L.y] 2402 }; 2403 K = { 2404 to : L.width 2405 }; 2406 F = { 2407 to : L.height 2408 }; 2409 function Q(U, R, V, S, X, Z, ac, ab, aa, W, T) { 2410 var Y = {}; 2411 p(U).setWidth(V).setHeight(S); 2412 if (p(U)[X]) { 2413 p(U)[X](Z) 2414 } 2415 R[ac] = R[ab] = "0"; 2416 if (aa) { 2417 Y.width = aa 2418 } 2419 if (W) { 2420 Y.height = W 2421 } 2422 if (T) { 2423 Y.points = T 2424 } 2425 return Y 2426 } 2427 I = p(G).switchStatements(H.toLowerCase(), Q, { 2428 t : [D, M, L.width, 0, y, y, n, l, y, F, y], 2429 l : [D, M, 0, L.height, y, y, m, s, K, y, y], 2430 r : [D, M, L.width, L.height, j, L.right, n, s, y, 2431 y, N], 2432 b : [D, M, L.width, L.height, h, L.bottom, n, s, y, 2433 F, N], 2434 tl : [D, M, 0, 0, y, y, m, l, K, F, N], 2435 bl : [D, M, 0, 0, h, L.y + L.height, m, s, K, F, N], 2436 br : [D, M, 0, 0, a, [L.right, L.bottom], n, s, K, 2437 F, N], 2438 tr : [D, M, 0, 0, j, L.x + L.width, n, l, K, F, N] 2439 }); 2440 M.visibility = u; 2441 p(D).show(); 2442 arguments.callee.anim = p(D).fxanim(I, E, e, 0.5, r, P) 2443 }); 2444 return J 2445 }, 2446 slideOut : function(F, D) { 2447 D = x(D); 2448 var H = this, E = H.dom, K = E.style, L = H.getXY(), C, B, I, J, G = { 2449 to : 0 2450 }; 2451 F = F || "t"; 2452 H.queueFx(D, function() { 2453 B = p(E).getFxRestore(); 2454 I = { 2455 x : L[0], 2456 y : L[1], 2457 0 : L[0],
2458 1 : L[1], 2459 width : E.offsetWidth, 2460 height : E.offsetHeight 2461 }; 2462 I.right = I.x + I.width; 2463 I.bottom = I.y + I.height; 2464 p(E).setWidth(I.width).setHeight(I.height); 2465 C = p(E).fxWrap(B.pos, D, u); 2466 K.visibility = u; 2467 K.position = z; 2468 p(C).setWidth(I.width).setHeight(I.height); 2469 function M() { 2470 D.useDisplay ? p(E).setDisplayed(t) : p(E).hide(); 2471 p(E).fxUnwrap(C, B.pos, D); 2472 K.width = B.width; 2473 K.height = B.height; 2474 p(E).afterFx(D) 2475 } 2476 function N(O, W, U, X, S, V, R, T, Q) { 2477 var P = {}; 2478 O[W] = O[U] = "0"; 2479 P[X] = S; 2480 if (V) { 2481 P[V] = R 2482 } 2483 if (T) { 2484 P[T] = Q 2485 } 2486 return P 2487 } 2488 J = p(E).switchStatements(F.toLowerCase(), N, { 2489 t : [K, n, l, q, G], 2490 l : [K, m, s, g, G], 2491 r : [K, n, s, g, G, i, { 2492 to : [I.right, I.y] 2493 }], 2494 b : [K, n, s, q, G, i, { 2495 to : [I.x, I.bottom] 2496 }], 2497 tl : [K, m, l, g, G, q, G], 2498 bl : [K, m, s, g, G, q, G, i, { 2499 to : [I.x, I.bottom] 2500 }], 2501 br : [K, n, s, g, G, q, G, i, { 2502 to : [I.x + I.width, I.bottom] 2503 }], 2504 tr : [K, n, l, g, G, q, G, i, { 2505 to : [I.right, I.y] 2506 }] 2507 });
2508 arguments.callee.anim = p(C).fxanim(J, D, e, 0.5, r, M) 2509 }); 2510 return H 2511 }, 2512 puff : function(H) { 2513 H = x(H); 2514 var F = this, G = F.dom, C = G.style, D, B, E; 2515 F.queueFx(H, function() { 2516 D = p(G).getWidth(); 2517 B = p(G).getHeight(); 2518 p(G).clearOpacity(); 2519 p(G).show(); 2520 E = p(G).getFxRestore(); 2521 function I() { 2522 H.useDisplay ? p(G).setDisplayed(t) : p(G).hide(); 2523 p(G).clearOpacity(); 2524 p(G).setPositioning(E.pos); 2525 C.width = E.width; 2526 C.height = E.height; 2527 C.fontSize = ""; 2528 p(G).afterFx(H) 2529 } 2530 arguments.callee.anim = p(G).fxanim({ 2531 width : { 2532 to : p(G).adjustWidth(D * 2) 2533 }, 2534 height : { 2535 to : p(G).adjustHeight(B * 2) 2536 }, 2537 points : { 2538 by : [-D * 0.5, -B * 0.5] 2539 }, 2540 opacity : { 2541 to : 0 2542 }, 2543 fontSize : { 2544 to : 200, 2545 unit : "%" 2546 } 2547 }, H, e, 0.5, r, I) 2548 }); 2549 return F 2550 }, 2551 switchOff : function(F) { 2552 F = x(F); 2553 var D = this, E = D.dom, B = E.style, C; 2554 D.queueFx(F, function() { 2555 p(E).clearOpacity(); 2556 p(E).clip(); 2557 C = p(E).getFxRestore(); 2558 function G() { 2559 F.useDisplay ? p(E).setDisplayed(t) : p(E).hide(); 2560 p(E).clearOpacity(); 2561 p(E).setPositioning(C.pos); 2562 B.width = C.width; 2563 B.height = C.height; 2564 p(E).afterFx(F) 2565 } 2566 p(E).fxanim({ 2567 opacity : { 2568 to : 0.3 2569 } 2570 }, y, y, 0.1, y, function() { 2571 p(E).clearOpacity(); 2572 (function() { 2573 p(E).fxanim({ 2574 height : { 2575 to : 1 2576 }, 2577 points : { 2578 by : [0, p(E).getHeight() * 0.5] 2579 } 2580 }, F, e, 0.3, "easeIn", G) 2581 }).defer(100) 2582 }) 2583 }); 2584 return D 2585 }, 2586 highlight : function(D, H) { 2587 H = x(H); 2588 var F = this, G = F.dom, B = H.attr || "backgroundColor", C = {}, E; 2589 F.queueFx(H, function() { 2590 p(G).clearOpacity(); 2591 p(G).show(); 2592 function I() { 2593 G.style[B] = E; 2594 p(G).afterFx(H) 2595 } 2596 E = G.style[B]; 2597 C[B] = { 2598 from : D || "ffff9c", 2599 to : H.endColor || p(G).getColor(B) || "ffffff" 2600 }; 2601 arguments.callee.anim = p(G).fxanim(C, H, "color", 1, 2602 "easeIn", I) 2603 }); 2604 return F 2605 }, 2606 frame : function(B, E, H) { 2607 H = x(H); 2608 var D = this, G = D.dom, C, F; 2609 D.queueFx(H, function() { 2610 B = B || "#C3DAF9"; 2611 if (B.length == 6) { 2612 B = "#" + B 2613 } 2614 E = E || 1; 2615 p(G).show(); 2616 var L = p(G).getXY(), J = { 2617 x : L[0], 2618 y : L[1], 2619 0 : L[0], 2620 1 : L[1], 2621 width : G.offsetWidth, 2622 height : G.offsetHeight 2623 }, I = function() { 2624 C = p(document.body || document.documentElement) 2625 .createChild({ 2626 style : { 2627 position : z, 2628 "z-index" : 35000, 2629 border : "0px solid " + B 2630 } 2631 }); 2632 return C.queueFx({}, K) 2633 }; 2634 arguments.callee.anim = { 2635 isAnimated : true, 2636 stop : function() { 2637 E = 0; 2638 C.stopFx() 2639 } 2640 }; 2641 function K() { 2642 var M = Ext.isBorderBox ? 2 : 1; 2643 F = C.anim({ 2644 top : { 2645 from : J.y, 2646 to : J.y - 20 2647 }, 2648 left : { 2649 from : J.x, 2650 to : J.x - 20 2651 }, 2652 borderWidth : { 2653 from : 0, 2654 to : 10 2655 }, 2656 opacity : { 2657 from : 1, 2658 to : 0 2659 }, 2660 height : { 2661 from : J.height, 2662 to : J.height + 20 * M 2663 }, 2664 width : { 2665 from : J.width, 2666 to : J.width + 20 * M 2667 } 2668 }, { 2669 duration : H.duration || 1, 2670 callback : function() { 2671 C.remove(); 2672 --E > 0 ? I() : p(G).afterFx(H) 2673 } 2674 }); 2675 arguments.callee.anim = { 2676 isAnimated : true, 2677 stop : function() { 2678 F.stop() 2679 } 2680 } 2681 } 2682 I() 2683 });
2684 return D 2685 }, 2686 pause : function(D) { 2687 var C = this.dom, B; 2688 this.queueFx({}, function() { 2689 B = setTimeout(function() { 2690 p(C).afterFx({}) 2691 }, D * 1000); 2692 arguments.callee.anim = { 2693 isAnimated : true, 2694 stop : function() { 2695 clearTimeout(B); 2696 p(C).afterFx({}) 2697 } 2698 } 2699 }); 2700 return this 2701 }, 2702 fadeIn : function(D) { 2703 D = x(D); 2704 var B = this, C = B.dom, E = D.endOpacity || 1; 2705 B.queueFx(D, function() { 2706 p(C).setOpacity(0); 2707 p(C).fixDisplay(); 2708 C.style.visibility = u; 2709 arguments.callee.anim = p(C).fxanim({ 2710 opacity : { 2711 to : E 2712 } 2713 }, D, y, 0.5, r, function() { 2714 if (E == 1) { 2715 p(C).clearOpacity() 2716 } 2717 p(C).afterFx(D) 2718 }) 2719 }); 2720 return B 2721 }, 2722 fadeOut : function(E) { 2723 E = x(E); 2724 var C = this, D = C.dom, B = D.style, F = E.endOpacity || 0; 2725 C.queueFx(E, function() { 2726 arguments.callee.anim = p(D).fxanim({ 2727 opacity : { 2728 to : F 2729 } 2730 }, E, y, 0.5, r, function() { 2731 if (F == 0) { 2732 Ext.Element.data(D, "visibilityMode") == Ext.Element.DISPLAY 2733 || E.useDisplay 2734 ? B.display = "none" 2735 : B.visibility = w; 2736 p(D).clearOpacity() 2737 } 2738 p(D).afterFx(E) 2739 }) 2740 }); 2741 return C 2742 }, 2743 scale : function(B, C, D) { 2744 this.shift(Ext.apply({}, D, { 2745 width : B, 2746 height : C 2747 })); 2748 return this 2749 }, 2750 shift : function(D) { 2751 D = x(D); 2752 var C = this.dom, B = {}; 2753 this.queueFx(D, function() { 2754 for (var E in D) { 2755 if (D[E] != A) { 2756 B[E] = { 2757 to : D[E] 2758 } 2759 } 2760 } 2761 B.width ? B.width.to = p(C).adjustWidth(D.width) : B; 2762 B.height ? B.height.to = p(C).adjustWidth(D.height) : B; 2763 if (B.x || B.y || B.xy) { 2764 B.points = B.xy || { 2765 to : [B.x ? B.x.to : p(C).getX(), 2766 B.y ? B.y.to : p(C).getY()] 2767 } 2768 } 2769 arguments.callee.anim = p(C).fxanim(B, D, e, 0.35, r, 2770 function() { 2771 p(C).afterFx(D) 2772 }) 2773 }); 2774 return this 2775 }, 2776 ghost : function(E, C) { 2777 C = x(C); 2778 var G = this, D = G.dom, J = D.style, H = { 2779 opacity : { 2780 to : 0 2781 }, 2782 points : {} 2783 }, K = H.points, B, I, F; 2784 E = E || "b"; 2785 G.queueFx(C, function() { 2786 B = p(D).getFxRestore(); 2787 I = p(D).getWidth(); 2788 F = p(D).getHeight(); 2789 function L() { 2790 C.useDisplay ? p(D).setDisplayed(t) : p(D).hide(); 2791 p(D).clearOpacity(); 2792 p(D).setPositioning(B.pos); 2793 J.width = B.width; 2794 J.height = B.height; 2795 p(D).afterFx(C) 2796 } 2797 K.by = p(D).switchStatements(E.toLowerCase(), 2798 function(N, M) { 2799 return [N, M] 2800 }, { 2801 t : [0, -F], 2802 l : [-I, 0], 2803 r : [I, 0], 2804 b : [0, F], 2805 tl : [-I, -F], 2806 bl : [-I, F], 2807 br : [I, F], 2808 tr : [I, -F] 2809 });
2810 arguments.callee.anim = p(D).fxanim(H, C, e, 0.5, r, L) 2811 }); 2812 return G 2813 }, 2814 syncFx : function() { 2815 var B = this; 2816 B.fxDefaults = Ext.apply(B.fxDefaults || {}, { 2817 block : t, 2818 concurrent : k, 2819 stopFx : t 2820 }); 2821 return B 2822 }, 2823 sequenceFx : function() { 2824 var B = this; 2825 B.fxDefaults = Ext.apply(B.fxDefaults || {}, { 2826 block : t, 2827 concurrent : t, 2828 stopFx : t 2829 }); 2830 return B 2831 }, 2832 nextFx : function() { 2833 var B = c(this.dom.id)[0]; 2834 if (B) { 2835 B.call(this) 2836 } 2837 }, 2838 hasActiveFx : function() { 2839 return c(this.dom.id)[0] 2840 }, 2841 stopFx : function(B) { 2842 var C = this, E = C.dom.id; 2843 if (C.hasActiveFx()) { 2844 var D = c(E)[0]; 2845 if (D && D.anim) { 2846 if (D.anim.isAnimated) { 2847 b(E, [D]); 2848 D.anim.stop(B !== undefined ? B : k) 2849 } else { 2850 b(E, []) 2851 } 2852 } 2853 } 2854 return C 2855 }, 2856 beforeFx : function(B) { 2857 if (this.hasActiveFx() && !B.concurrent) { 2858 if (B.stopFx) { 2859 this.stopFx(); 2860 return k 2861 } 2862 return t 2863 } 2864 return k 2865 }, 2866 hasFxBlock : function() { 2867 var B = c(this.dom.id); 2868 return B && B[0] && B[0].block 2869 }, 2870 queueFx : function(E, B) { 2871 var C = p(this.dom); 2872 if (!C.hasFxBlock()) { 2873 Ext.applyIf(E, C.fxDefaults); 2874 if (!E.concurrent) { 2875 var D = C.beforeFx(E); 2876 B.block = E.block; 2877 c(C.dom.id).push(B); 2878 if (D) { 2879 C.nextFx() 2880 } 2881 } else { 2882 B.call(C) 2883 } 2884 } 2885 return C 2886 }, 2887 fxWrap : function(H, F, D) { 2888 var E = this.dom, C, B; 2889 if (!F.wrap || !(C = Ext.getDom(F.wrap))) { 2890 if (F.fixPosition) { 2891 B = p(E).getXY() 2892 } 2893 var G = document.createElement("div"); 2894 G.style.visibility = D; 2895 C = E.parentNode.insertBefore(G, E); 2896 p(C).setPositioning(H); 2897 if (p(C).isStyle(o, "static")) { 2898 p(C).position("relative") 2899 } 2900 p(E).clearPositioning("auto"); 2901 p(C).clip(); 2902 C.appendChild(E); 2903 if (B) { 2904 p(C).setXY(B) 2905 } 2906 } 2907 return C 2908 }, 2909 fxUnwrap : function(C, F, E) { 2910 var D = this.dom; 2911 p(D).clearPositioning(); 2912 p(D).setPositioning(F); 2913 if (!E.wrap) { 2914 var B = p(C).dom.parentNode; 2915 B.insertBefore(D, C); 2916 p(C).remove() 2917 } 2918 }, 2919 getFxRestore : function() { 2920 var B = this.dom.style; 2921 return { 2922 pos : this.getPositioning(), 2923 width : B.width, 2924 height : B.height 2925 } 2926 }, 2927 afterFx : function(C) { 2928 var B = this.dom, D = B.id; 2929 if (C.afterStyle) { 2930 p(B).setStyle(C.afterStyle) 2931 } 2932 if (C.afterCls) { 2933 p(B).addClass(C.afterCls) 2934 } 2935 if (C.remove == k) { 2936 p(B).remove() 2937 } 2938 if (C.callback) { 2939 C.callback.call(C.scope, p(B)) 2940 } 2941 if (!C.concurrent) { 2942 c(D).shift(); 2943 p(B).nextFx() 2944 } 2945 }, 2946 fxanim : function(E, F, C, G, D, B) { 2947 C = C || "run"; 2948 F = F || {}; 2949 var H = Ext.lib.Anim[C](this.dom, E, (F.duration || G) || 0.35, 2950 (F.easing || D) || r, B, this); 2951 F.anim = H; 2952 return H 2953 } 2954 }; 2955 Ext.Fx.resize = Ext.Fx.scale; 2956 Ext.Element.addMethods(Ext.Fx) 2957})(); 2958Ext.CompositeElementLite = function(b, a) { 2959 this.elements = []; 2960 this.add(b, a); 2961 this.el = new Ext.Element.Flyweight() 2962}; 2963Ext.CompositeElementLite.prototype = { 2964 isComposite : true, 2965 getElement : function(a) { 2966 var b = this.el; 2967 b.dom = a; 2968 b.id = a.id; 2969 return b 2970 }, 2971 transformElement : function(a) { 2972 return Ext.getDom(a) 2973 }, 2974 getCount : function() { 2975 return this.elements.length 2976 }, 2977 add : function(d, b) { 2978 var e = this, g = e.elements; 2979 if (!d) { 2980 return this 2981 } 2982 if (typeof d == "string") { 2983 d = Ext.Element.selectorFunction(d, b) 2984 } else { 2985 if (d.isComposite) { 2986 d = d.elements 2987 } else { 2988 if (!Ext.isIterable(d)) { 2989 d = [d] 2990 } 2991 } 2992 } 2993 for (var c = 0, a = d.length; c < a; ++c) { 2994 g.push(e.transformElement(d[c])) 2995 } 2996 return e 2997 }, 2998 invoke : function(g, b) { 2999 var h = this, d = h.elements, a = d.length, j, c; 3000 for (c = 0; c < a; c++) { 3001 j = d[c]; 3002 if (j) { 3003 Ext.Element.prototype[g].apply(h.getElement(j), b) 3004 } 3005 } 3006 return h 3007 }, 3008 item : function(b) { 3009 var d = this, c = d.elements[b], a = null; 3010 if (c) { 3011 a = d.getElement(c) 3012 } 3013 return a 3014 }, 3015 addListener : function(b, j, h, g) { 3016 var d = this.elements, a = d.length, c, k; 3017 for (c = 0; c < a; c++) { 3018 k = d[c]; 3019 if (k) { 3020 Ext.EventManager.on(k, b, j, h || k, g) 3021 } 3022 } 3023 return this 3024 }, 3025 each : function(g, d) {
3026 var h = this, c = h.elements, a = c.length, b, j; 3027 for (b = 0; b < a; b++) { 3028 j = c[b]; 3029 if (j) { 3030 j = this.getElement(j); 3031 if (g.call(d || j, j, h, b) === false) { 3032 break 3033 } 3034 } 3035 } 3036 return h 3037 }, 3038 fill : function(a) { 3039 var b = this; 3040 b.elements = []; 3041 b.add(a); 3042 return b 3043 }, 3044 filter : function(a) { 3045 var b = [], d = this, c = Ext.isFunction(a) ? a : function(e) { 3046 return e.is(a) 3047 }; 3048 d.each(function(h, e, g) { 3049 if (c(h, g) !== false) { 3050 b[b.length] = d.transformElement(h) 3051 } 3052 }); 3053 d.elements = b; 3054 return d 3055 }, 3056 indexOf : function(a) { 3057 return this.elements.indexOf(this.transformElement(a)) 3058 }, 3059 replaceElement : function(e, c, a) { 3060 var b = !isNaN(e) ? e : this.indexOf(e), g; 3061 if (b > -1) { 3062 c = Ext.getDom(c); 3063 if (a) { 3064 g = this.elements[b]; 3065 g.parentNode.insertBefore(c, g); 3066 Ext.removeNode(g) 3067 } 3068 this.elements.splice(b, 1, c) 3069 } 3070 return this 3071 }, 3072 clear : function() { 3073 this.elements = [] 3074 } 3075}; 3076Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener; 3077Ext.CompositeElementLite.importElementMethods = function() { 3078 var c, b = Ext.Element.prototype, a = Ext.CompositeElementLite.prototype; 3079 for (c in b) { 3080 if (typeof b[c] == "function") { 3081 (function(d) { 3082 a[d] = a[d] || function() { 3083 return this.invoke(d, arguments) 3084 } 3085 }).call(a, c) 3086 } 3087 } 3088}; 3089Ext.CompositeElementLite.importElementMethods(); 3090if (Ext.DomQuery) { 3091 Ext.Element.selectorFunction = Ext.DomQuery.select 3092} 3093Ext.Element.select = function(a, b) { 3094 var c; 3095 if (typeof a == "string") { 3096 c = Ext.Element.selectorFunction(a, b) 3097 } else { 3098 if (a.length !== undefined) { 3099 c = a 3100 } else { 3101 throw "Invalid selector" 3102 } 3103 } 3104 return new Ext.CompositeElementLite(c) 3105}; 3106Ext.select = Ext.Element.select; 3107(function() { 3108 var b = "beforerequest", e = "requestcomplete", d = "requestexception", h = undefined, c = "load", i = "POST", a = "GET", g = window; 3109 Ext.data.Connection = function(j) { 3110 Ext.apply(this, j); 3111 this.addEvents(b, e, d); 3112 Ext.data.Connection.superclass.constructor.call(this) 3113 }; 3114 Ext.extend(Ext.data.Connection, Ext.util.Observable, { 3115 timeout : 300000, 3116 autoAbort : false, 3117 disableCaching : true, 3118 disableCachingParam : "_dc", 3119 request : function(n) { 3120 var s = this; 3121 if (s.fireEvent(b, s, n)) { 3122 if (n.el) { 3123 if (!Ext.isEmpty(n.indicatorText)) { 3124 s.indicatorText = '<div class="loading-indicator">' 3125 + n.indicatorText + "</div>" 3126 } 3127 if (s.indicatorText) { 3128 Ext.getDom(n.el).innerHTML = s.indicatorText 3129 } 3130 n.success = (Ext.isFunction(n.success) 3131 ? n.success 3132 : function() { 3133 }).createInterceptor(function(o) { 3134 Ext.getDom(n.el).innerHTML = o.responseText 3135 }) 3136 } 3137 var l = n.params, k = n.url || s.url, j, q = { 3138 success : s.handleResponse, 3139 failure : s.handleFailure, 3140 scope : s, 3141 argument : { 3142 options : n 3143 }, 3144 timeout : Ext.num(n.timeout, s.timeout) 3145 }, m, t; 3146 if (Ext.isFunction(l)) { 3147 l = l.call(n.scope || g, n) 3148 } 3149 l = Ext.urlEncode(s.extraParams, Ext.isObject(l) ? Ext 3150 .urlEncode(l) : l); 3151 if (Ext.isFunction(k)) { 3152 k = k.call(n.scope || g, n) 3153 } 3154 if ((m = Ext.getDom(n.form))) { 3155 k = k || m.action; 3156 if (n.isUpload 3157 || (/multipart\/form-data/i.test(m 3158 .getAttribute("enctype")))) { 3159 return s.doFormUpload.call(s, n, l, k) 3160 } 3161 t = Ext.lib.Ajax.serializeForm(m); 3162 l = l ? (l + "&" + t) : t 3163 } 3164 j = n.method || s.method 3165 || ((l || n.xmlData || n.jsonData) ? i : a); 3166 if (j === a && (s.disableCaching && n.disableCaching !== false) 3167 || n.disableCaching === true) { 3168 var r = n.disableCachingParam || s.disableCachingParam; 3169 k = Ext.urlAppend(k, r + "=" + (new Date().getTime())) 3170 } 3171 n.headers = Ext 3172 .applyIf(n.headers || {}, s.defaultHeaders || {}); 3173 if (n.autoAbort === true || s.autoAbort) { 3174 s.abort() 3175 } 3176 if ((j == a || n.xmlData || n.jsonData) && l) { 3177 k = Ext.urlAppend(k, l); 3178 l = "" 3179 } 3180 return (s.transId = Ext.lib.Ajax.request(j, k, q, l, n)) 3181 } else { 3182 return n.callback ? n.callback.apply(n.scope, [n, h, h]) : null 3183 } 3184 }, 3185 isLoading : function(j) { 3186 return j ? Ext.lib.Ajax.isCallInProgress(j) : !!this.transId 3187 }, 3188 abort : function(j) { 3189 if (j || this.isLoading()) { 3190 Ext.lib.Ajax.abort(j || this.transId) 3191 } 3192 }, 3193 handleResponse : function(j) { 3194 this.transId = false; 3195 var k = j.argument.options; 3196 j.argument = k ? k.argument : null; 3197 this.fireEvent(e, this, j, k); 3198 if (k.success) { 3199 k.success.call(k.scope, j, k) 3200 } 3201 if (k.callback) { 3202 k.callback.call(k.scope, k, true, j) 3203 } 3204 }, 3205 handleFailure : function(j, l) { 3206 this.transId = false; 3207 var k = j.argument.options; 3208 j.argument = k ? k.argument : null; 3209 this.fireEvent(d, this, j, k, l); 3210 if (k.failure) { 3211 k.failure.call(k.scope, j, k) 3212 } 3213 if (k.callback) { 3214 k.callback.call(k.scope, k, false, j) 3215 } 3216 }, 3217 doFormUpload : function(q, j, k) { 3218 var l = Ext.id(), v = document, r = v.createElement("iframe"), m = Ext 3219 .getDom(q.form), u = [], t, p = "multipart/form-data", n = { 3220 target : m.target, 3221 method : m.method, 3222 encoding : m.encoding, 3223 enctype : m.enctype, 3224 action : m.action 3225 };
3226 Ext.fly(r).set({ 3227 id : l, 3228 name : l, 3229 cls : "x-hidden", 3230 src : Ext.SSL_SECURE_URL 3231 }); 3232 v.body.appendChild(r); 3233 if (Ext.isIE) { 3234 document.frames[l].name = l 3235 } 3236 Ext.fly(m).set({ 3237 target : l, 3238 method : i, 3239 enctype : p, 3240 encoding : p, 3241 action : k || n.action 3242 }); 3243 Ext.iterate(Ext.urlDecode(j, false), function(w, o) { 3244 t = v.createElement("input"); 3245 Ext.fly(t).set({ 3246 type : "hidden", 3247 value : o, 3248 name : w 3249 }); 3250 m.appendChild(t); 3251 u.push(t) 3252 }); 3253 function s() { 3254 var x = this, w = { 3255 responseText : "", 3256 responseXML : null, 3257 argument : q.argument 3258 }, A, z; 3259 try { 3260 A = r.contentWindow.document || r.contentDocument 3261 || g.frames[l].document; 3262 if (A) { 3263 if (A.body) { 3264 if (/textarea/i 3265 .test((z = A.body.firstChild || {}).tagName)) { 3266 w.responseText = z.value 3267 } else { 3268 w.responseText = A.body.innerHTML 3269 } 3270 } 3271 w.responseXML = A.XMLDocument || A 3272 } 3273 } catch (y) { 3274 } 3275 Ext.EventManager.removeListener(r, c, s, x); 3276 x.fireEvent(e, x, w, q); 3277 function o(D, C, B) { 3278 if (Ext.isFunction(D)) { 3279 D.apply(C, B) 3280 } 3281 } 3282 o(q.success, q.scope, [w, q]); 3283 o(q.callback, q.scope, [q, true, w]); 3284 if (!x.debugUploads) { 3285 setTimeout(function() { 3286 Ext.removeNode(r) 3287 }, 100) 3288 } 3289 } 3290 Ext.EventManager.on(r, c, s, this); 3291 m.submit(); 3292 Ext.fly(m).set(n); 3293 Ext.each(u, function(o) { 3294 Ext.removeNode(o) 3295 }) 3296 } 3297 }) 3298})(); 3299Ext.Ajax = new Ext.data.Connection({ 3300 autoAbort : false, 3301 serializeForm : function(a) { 3302 return Ext.lib.Ajax.serializeForm(a) 3303 } 3304 }); 3305Ext.util.JSON = new (function() { 3306 var useHasOwn = !!{}.hasOwnProperty, isNative = function() { 3307 var useNative = null; 3308 return function() { 3309 if (useNative === null) { 3310 useNative = Ext.USE_NATIVE_JSON && window.JSON 3311 && JSON.toString() == "[object JSON]" 3312 } 3313 return useNative 3314 } 3315 }(), pad = function(n) { 3316 return n < 10 ? "0" + n : n 3317 }, doDecode = function(json) { 3318 return json ? eval("(" + json + ")") : "" 3319 }, doEncode = function(o) { 3320 if (!Ext.isDefined(o) || o === null) { 3321 return "null" 3322 } else { 3323 if (Ext.isArray(o)) { 3324 return encodeArray(o) 3325 } else { 3326 if (Ext.isDate(o)) { 3327 return Ext.util.JSON.encodeDate(o) 3328 } else { 3329 if (Ext.isString(o)) { 3330 return encodeString(o) 3331 } else { 3332 if (typeof o == "number") { 3333 return isFinite(o) ? String(o) : "null" 3334 } else { 3335 if (Ext.isBoolean(o)) { 3336 return String(o) 3337 } else { 3338 var a = ["{"], b, i, v; 3339 for (i in o) { 3340 if (!o.getElementsByTagName) { 3341 if (!useHasOwn || o.hasOwnProperty(i)) { 3342 v = o[i]; 3343 switch (typeof v) { 3344 case "undefined" : 3345 case "function" : 3346 case "unknown" : 3347 break; 3348 default : 3349 if (b) { 3350 a.push(",") 3351 } 3352 a 3353 .push( 3354 doEncode(i), 3355 ":", 3356 v === null 3357 ? "null" 3358 : doEncode(v)); 3359 b = true 3360 } 3361 } 3362 } 3363 } 3364 a.push("}"); 3365 return a.join("") 3366 } 3367 } 3368 } 3369 } 3370 } 3371 } 3372 }, m = { 3373 "\b" : "\\b", 3374 "\t" : "\\t", 3375 "\n" : "\\n", 3376 "\f" : "\\f", 3377 "\r" : "\\r", 3378 '"' : '\\"', 3379 "\\" : "\\\\" 3380 }, encodeString = function(s) { 3381 if (/["\\\x00-\x1f]/.test(s)) { 3382 return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) { 3383 var c = m[b]; 3384 if (c) { 3385 return c 3386 } 3387 c = b.charCodeAt(); 3388 return "\\u00" + Math.floor(c / 16).toString(16) 3389 + (c % 16).toString(16) 3390 }) + '"' 3391 } 3392 return '"' + s + '"' 3393 }, encodeArray = function(o) { 3394 var a = ["["], b, i, l = o.length, v; 3395 for (i = 0; i < l; i += 1) { 3396 v = o[i]; 3397 switch (typeof v) { 3398 case "undefined" : 3399 case "function" : 3400 case "unknown" : 3401 break; 3402 default : 3403 if (b) { 3404 a.push(",") 3405 } 3406 a.push(v === null ? "null" : Ext.util.JSON.encode(v)); 3407 b = true 3408 } 3409 } 3410 a.push("]"); 3411 return a.join("") 3412 }; 3413 this.encodeDate = function(o) { 3414 return '"' + o.getFullYear() + "-" + pad(o.getMonth() + 1) + "-"
3415 + pad(o.getDate()) + "T" + pad(o.getHours()) + ":" 3416 + pad(o.getMinutes()) + ":" + pad(o.getSeconds()) + '"' 3417 }; 3418 this.encode = function() { 3419 var ec; 3420 return function(o) { 3421 if (!ec) { 3422 ec = isNative() ? JSON.stringify : doEncode 3423 } 3424 return ec(o) 3425 } 3426 }(); 3427 this.decode = function() { 3428 var dc; 3429 return function(json) { 3430 if (!dc) { 3431 dc = isNative() ? JSON.parse : doDecode 3432 } 3433 return dc(json) 3434 } 3435 }() 3436})(); 3437Ext.encode = Ext.util.JSON.encode; 3438Ext.decode = Ext.util.JSON.decode; 3439Ext.EventManager = function() { 3440 var z, p, j = false, l = Ext.isGecko || Ext.isWebKit || Ext.isSafari, o = Ext.lib.Event, q = Ext.lib.Dom, c = document, A = window, r = "DOMContentLoaded", t = "complete", g = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/, u = []; 3441 function n(E) { 3442 var H = false, D = 0, C = u.length, F = false, G; 3443 if (E) { 3444 if (E.getElementById || E.navigator) { 3445 for (; D < C; ++D) { 3446 try { 3447 G = u[D]; 3448 if (G.el && G.el === E) { 3449 H = G.id; 3450 break 3451 } 3452 } catch (e) { 3453 } 3454 } 3455 if (!H) { 3456 H = Ext.id(E); 3457 u.push({ 3458 id : H, 3459 el : E 3460 }); 3461 F = true 3462 } 3463 } else { 3464 H = Ext.id(E) 3465 } 3466 if (!Ext.elCache[H]) { 3467 Ext.Element.addToCache(new Ext.Element(E), H); 3468 if (F) { 3469 Ext.elCache[H].skipGC = true 3470 } 3471 } 3472 } 3473 return H 3474 } 3475 function m(E, G, J, F, D, L) { 3476 E = Ext.getDom(E); 3477 var C = n(E), K = Ext.elCache[C].events, H; 3478 H = o.on(E, G, D); 3479 K[G] = K[G] || []; 3480 K[G].push([J, D, L, H, F]); 3481 if (E.addEventListener && G == "mousewheel") { 3482 var I = ["DOMMouseScroll", D, false]; 3483 E.addEventListener.apply(E, I); 3484 Ext.EventManager.addListener(A, "unload", function() { 3485 E.removeEventListener.apply(E, I) 3486 }) 3487 } 3488 if (E == c && G == "mousedown") { 3489 Ext.EventManager.stoppedMouseDownEvent.addListener(D) 3490 } 3491 } 3492 function d() { 3493 if (window != top) { 3494 return false 3495 } 3496 try { 3497 c.documentElement.doScroll("left") 3498 } catch (C) { 3499 return false 3500 } 3501 b(); 3502 return true 3503 } 3504 function B(C) { 3505 if (Ext.isIE && d()) { 3506 return true 3507 } 3508 if (c.readyState == t) { 3509 b(); 3510 return true 3511 } 3512 j || (p = setTimeout(arguments.callee, 2)); 3513 return false 3514 } 3515 var k; 3516 function i(C) { 3517 k || (k = Ext.query("style, link[rel=stylesheet]")); 3518 if (k.length == c.styleSheets.length) { 3519 b(); 3520 return true 3521 } 3522 j || (p = setTimeout(arguments.callee, 2)); 3523 return false 3524 } 3525 function y(C) { 3526 c.removeEventListener(r, arguments.callee, false); 3527 i() 3528 } 3529 function b(C) { 3530 if (!j) { 3531 j = true; 3532 if (p) { 3533 clearTimeout(p) 3534 } 3535 if (l) { 3536 c.removeEventListener(r, b, false) 3537 } 3538 if (Ext.isIE && B.bindIE) { 3539 c.detachEvent("onreadystatechange", B) 3540 } 3541 o.un(A, "load", arguments.callee) 3542 } 3543 if (z && !Ext.isReady) { 3544 Ext.isReady = true; 3545 z.fire(); 3546 z.listeners = [] 3547 } 3548 } 3549 function a() { 3550 z || (z = new Ext.util.Event()); 3551 if (l) { 3552 c.addEventListener(r, b, false) 3553 } 3554 if (Ext.isIE) { 3555 if (!B()) { 3556 B.bindIE = true; 3557 c.attachEvent("onreadystatechange", B) 3558 } 3559 } else { 3560 if (Ext.isOpera) { 3561 (c.readyState == t && i()) || c.addEventListener(r, y, false) 3562 } else { 3563 if (Ext.isWebKit) { 3564 B() 3565 } 3566 } 3567 } 3568 o.on(A, "load", b) 3569 } 3570 function x(C, D) { 3571 return function() { 3572 var E = Ext.toArray(arguments); 3573 if (D.target == Ext.EventObject.setEvent(E[0]).target) { 3574 C.apply(this, E) 3575 } 3576 } 3577 } 3578 function w(D, E, C) { 3579 return function(F) { 3580 C.delay(E.buffer, D, null, [new Ext.EventObjectImpl(F)]) 3581 } 3582 } 3583 function s(G, F, C, E, D) { 3584 return function(H) { 3585 Ext.EventManager.removeListener(F, C, E, D); 3586 G(H) 3587 } 3588 } 3589 function e(D, E, C) { 3590 return function(G) { 3591 var F = new Ext.util.DelayedTask(D); 3592 if (!C.tasks) { 3593 C.tasks = [] 3594 } 3595 C.tasks.push(F); 3596 F.delay(E.delay || 10, D, null, [new Ext.EventObjectImpl(G)]) 3597 } 3598 } 3599 function h(H, G, C, J, K) { 3600 var D = (!C || typeof C == "boolean") ? {} : C, E = Ext.getDom(H), F; 3601 J = J || D.fn; 3602 K = K || D.scope; 3603 if (!E) { 3604 throw 'Error listening for "' + G + '". Element "' + H 3605 + "\" doesn't exist." 3606 } 3607 function I(M) { 3608 if (!Ext) { 3609 return 3610 } 3611 M = Ext.EventObject.setEvent(M); 3612 var L; 3613 if (D.delegate) { 3614 if (!(L = M.getTarget(D.delegate, E))) { 3615 return 3616 } 3617 } else { 3618 L = M.target 3619 } 3620 if (D.stopEvent) { 3621 M.stopEvent() 3622 } 3623 if (D.preventDefault) { 3624 M.preventDefault() 3625 } 3626 if (D.stopPropagation) { 3627 M.stopPropagation() 3628 } 3629 if (D.normalized === false) { 3630 M = M.browserEvent 3631 } 3632 J.call(K || E, M, L, D) 3633 } 3634 if (D.target) { 3635 I = x(I, D) 3636 } 3637 if (D.delay) { 3638 I = e(I, D, J) 3639 } 3640 if (D.single) { 3641 I = s(I, E, G, J, K) 3642 } 3643 if (D.buffer) { 3644 F = new Ext.util.DelayedTask(I); 3645 I = w(I, D, F) 3646 } 3647 m(E, G, J, F, I, K); 3648 return I 3649 } 3650 var v = { 3651 addListener : function(E, C, G, F, D) { 3652 if (typeof C == "object") { 3653 var J = C, H, I; 3654 for (H in J) { 3655 I = J[H]; 3656 if (!g.test(H)) { 3657 if (Ext.isFunction(I)) { 3658 h(E, H, J, I, J.scope) 3659 } else { 3660 h(E, H, I) 3661 } 3662 } 3663 } 3664 } else { 3665 h(E, C, D, G, F) 3666 } 3667 }, 3668 removeListener : function(E, I, M, N) { 3669 E = Ext.getDom(E); 3670 var C = n(E), K = E && (Ext.elCache[C].events)[I] || [], D, H, F, G, J, L; 3671 for (H = 0, J = K.length; H < J; H++) { 3672 if (Ext.isArray(L = K[H]) && L[0] == M && (!N || L[2] == N)) { 3673 if (L[4]) { 3674 L[4].cancel() 3675 } 3676 G = M.tasks && M.tasks.length; 3677 if (G) { 3678 while (G--) { 3679 M.tasks[G].cancel() 3680 } 3681 delete M.tasks 3682 } 3683 D = L[1]; 3684 o.un(E, I, o.extAdapter ? L[3] : D); 3685 if (D && E.addEventListener && I == "mousewheel") { 3686 E.removeEventListener("DOMMouseScroll", D, false) 3687 } 3688 if (D && E == c && I == "mousedown") { 3689 Ext.EventManager.stoppedMouseDownEvent
3690 .removeListener(D) 3691 } 3692 K.splice(H, 1); 3693 if (K.length === 0) { 3694 delete Ext.elCache[C].events[I] 3695 } 3696 for (G in Ext.elCache[C].events) { 3697 return false 3698 } 3699 Ext.elCache[C].events = {}; 3700 return false 3701 } 3702 } 3703 }, 3704 removeAll : function(E) { 3705 E = Ext.getDom(E); 3706 var D = n(E), J = Ext.elCache[D] || {}, M = J.events || {}, I, H, K, F, L, G, C; 3707 for (F in M) { 3708 if (M.hasOwnProperty(F)) { 3709 I = M[F]; 3710 for (H = 0, K = I.length; H < K; H++) { 3711 L = I[H]; 3712 if (L[4]) { 3713 L[4].cancel() 3714 } 3715 if (L[0].tasks && (G = L[0].tasks.length)) { 3716 while (G--) { 3717 L[0].tasks[G].cancel() 3718 } 3719 delete L.tasks 3720 } 3721 C = L[1]; 3722 o.un(E, F, o.extAdapter ? L[3] : C); 3723 if (E.addEventListener && C && F == "mousewheel") { 3724 E.removeEventListener("DOMMouseScroll", C, false) 3725 } 3726 if (C && E == c && F == "mousedown") { 3727 Ext.EventManager.stoppedMouseDownEvent 3728 .removeListener(C) 3729 } 3730 } 3731 } 3732 } 3733 if (Ext.elCache[D]) { 3734 Ext.elCache[D].events = {} 3735 } 3736 }, 3737 getListeners : function(F, C) { 3738 F = Ext.getDom(F); 3739 var H = n(F), D = Ext.elCache[H] || {}, G = D.events || {}, E = []; 3740 if (G && G[C]) { 3741 return G[C] 3742 } else { 3743 return null 3744 } 3745 }, 3746 purgeElement : function(E, C, G) { 3747 E = Ext.getDom(E); 3748 var D = n(E), J = Ext.elCache[D] || {}, K = J.events || {}, F, I, H; 3749 if (G) { 3750 if (K && K.hasOwnProperty(G)) { 3751 I = K[G]; 3752 for (F = 0, H = I.length; F < H; F++) { 3753 Ext.EventManager.removeListener(E, G, I[F][0]) 3754 } 3755 } 3756 } else { 3757 Ext.EventManager.removeAll(E) 3758 } 3759 if (C && E && E.childNodes) { 3760 for (F = 0, H = E.childNodes.length; F < H; F++) { 3761 Ext.EventManager.purgeElement(E.childNodes[F], C, G) 3762 } 3763 } 3764 }, 3765 _unload : function() { 3766 var C; 3767 for (C in Ext.elCache) { 3768 Ext.EventManager.removeAll(C) 3769 } 3770 delete Ext.elCache; 3771 delete Ext.Element._flyweights; 3772 var G, D, F, E = Ext.lib.Ajax; 3773 (typeof E.conn == "object") ? D = E.conn : D = {}; 3774 for (F in D) { 3775 G = D[F]; 3776 if (G) { 3777 E.abort({ 3778 conn : G, 3779 tId : F 3780 }) 3781 } 3782 } 3783 }, 3784 onDocumentReady : function(E, D, C) { 3785 if (Ext.isReady) { 3786 z || (z = new Ext.util.Event()); 3787 z.addListener(E, D, C); 3788 z.fire(); 3789 z.listeners = [] 3790 } else { 3791 if (!z) { 3792 a() 3793 } 3794 C = C || {}; 3795 C.delay = C.delay || 1; 3796 z.addListener(E, D, C) 3797 } 3798 }, 3799 fireDocReady : b 3800 }; 3801 v.on = v.addListener; 3802 v.un = v.removeListener; 3803 v.stoppedMouseDownEvent = new Ext.util.Event(); 3804 return v 3805}(); 3806Ext.onReady = Ext.EventManager.onDocumentReady; 3807(function() { 3808 var a = function() { 3809 var c = document.body || document.getElementsByTagName("body")[0]; 3810 if (!c) { 3811 return false 3812 } 3813 var b = [ 3814 " ", 3815 Ext.isIE 3816 ? "ext-ie " 3817 + (Ext.isIE6 ? "ext-ie6" : (Ext.isIE7 ? "ext-ie7" : 3818 (Ext.isIE8 ? "ext-ie8" : (Ext.isIE9 ? "ext-ie9" : "ext-ie9 ext-ie10") ) 3819 )) 3820 : Ext.isGecko 3821 ? (Ext.isIE11 ? "ext-ie ext-ie11 " : "") + "ext-gecko " 3822 + (Ext.isGecko2 3823 ? "ext-gecko2" 3824 : "ext-gecko3") 3825 : Ext.isOpera ? "ext-opera" : Ext.isWebKit 3826 ? "ext-webkit" 3827 : ""]; 3828 if (Ext.isSafari) { 3829 b.push("ext-safari " 3830 + (Ext.isSafari2 ? "ext-safari2" : (Ext.isSafari3 3831 ? "ext-safari3" 3832 : "ext-safari4"))) 3833 } else { 3834 if (Ext.isChrome) { 3835 b.push("ext-chrome") 3836 } 3837 } 3838 if (Ext.isMac) { 3839 b.push("ext-mac") 3840 } 3841 if (Ext.isIPad) { 3842 b.push("ext-ipad") 3843 } 3844 if (Ext.isIPhone) { 3845 b.push("ext-iphone") 3846 } 3847 if (Ext.isLinux) { 3848 b.push("ext-linux") 3849 } 3850 if (Ext.isStrict || Ext.isBorderBox) { 3851 var d = c.parentNode; 3852 if (d) { 3853 if (!Ext.isStrict) { 3854 Ext.fly(d, "_internal").addClass("x-quirks"); 3855 if (Ext.isIE && !Ext.isStrict) { 3856 Ext.isIEQuirks = true 3857 } 3858 } 3859 Ext 3860 .fly(d, "_internal") 3861 .addClass(((Ext.isStrict && Ext.isIE) || (!Ext.enableForcedBoxModel && !Ext.isIE)) 3862 ? " ext-strict" 3863 : " ext-border-box") 3864 } 3865 } 3866 if (Ext.enableForcedBoxModel && !Ext.isIE) { 3867 Ext.isForcedBorderBox = true; 3868 b.push("ext-forced-border-box") 3869 } 3870 Ext.fly(c, "_internal").addClass(b); 3871 return true 3872 }; 3873 if (!a()) { 3874 Ext.onReady(a) 3875 } 3876})(); 3877(function() { 3878 var b = Ext.apply(Ext.supports, { 3879 correctRightMargin : true,
3880 correctTransparentColor : true, 3881 cssFloat : true 3882 }); 3883 var a = function() { 3884 var g = document.createElement("div"), e = document, c, d; 3885 g.innerHTML = '<div style="height:30px;width:50px;"><div style="height:20px;width:20px;"></div></div><div style="float:left;background-color:transparent;">'; 3886 e.body.appendChild(g); 3887 d = g.lastChild; 3888 if ((c = e.defaultView)) { 3889 if (c.getComputedStyle(g.firstChild.firstChild, null).marginRight != "0px") { 3890 b.correctRightMargin = false 3891 } 3892 if (c.getComputedStyle(d, null).backgroundColor != "transparent") { 3893 b.correctTransparentColor = false 3894 } 3895 } 3896 b.cssFloat = !!d.style.cssFloat; 3897 e.body.removeChild(g) 3898 }; 3899 if (Ext.isReady) { 3900 a() 3901 } else { 3902 Ext.onReady(a) 3903 } 3904})(); 3905Ext.EventObject = function() { 3906 var b = Ext.lib.Event, c = /(dbl)?click/, a = { 3907 3 : 13, 3908 63234 : 37, 3909 63235 : 39, 3910 63232 : 38, 3911 63233 : 40, 3912 63276 : 33, 3913 63277 : 34, 3914 63272 : 46, 3915 63273 : 36, 3916 63275 : 35 3917 }, d = Ext.isIE ? { 3918 1 : 0, 3919 4 : 1, 3920 2 : 2 3921 } : { 3922 0 : 0, 3923 1 : 1, 3924 2 : 2 3925 }; 3926 Ext.EventObjectImpl = function(g) { 3927 if (g) { 3928 this.setEvent(g.browserEvent || g) 3929 } 3930 }; 3931 Ext.EventObjectImpl.prototype = { 3932 setEvent : function(h) { 3933 var g = this; 3934 if (h == g || (h && h.browserEvent)) { 3935 return h 3936 } 3937 g.browserEvent = h; 3938 if (h) { 3939 g.button = h.button 3940 ? d[h.button] 3941 : (h.which ? h.which - 1 : -1); 3942 if (c.test(h.type) && g.button == -1) { 3943 g.button = 0 3944 } 3945 g.type = h.type; 3946 g.shiftKey = h.shiftKey; 3947 g.ctrlKey = h.ctrlKey || h.metaKey || false; 3948 g.altKey = h.altKey; 3949 g.keyCode = h.keyCode; 3950 g.charCode = h.charCode; 3951 g.target = b.getTarget(h); 3952 g.xy = b.getXY(h) 3953 } else { 3954 g.button = -1; 3955 g.shiftKey = false; 3956 g.ctrlKey = false; 3957 g.altKey = false; 3958 g.keyCode = 0; 3959 g.charCode = 0; 3960 g.target = null; 3961 g.xy = [0, 0] 3962 } 3963 return g 3964 }, 3965 stopEvent : function() { 3966 var e = this; 3967 if (e.browserEvent) { 3968 if (e.browserEvent.type == "mousedown") { 3969 Ext.EventManager.stoppedMouseDownEvent.fire(e) 3970 } 3971 b.stopEvent(e.browserEvent) 3972 } 3973 }, 3974 preventDefault : function() { 3975 if (this.browserEvent) { 3976 b.preventDefault(this.browserEvent) 3977 } 3978 }, 3979 stopPropagation : function() { 3980 var e = this; 3981 if (e.browserEvent) { 3982 if (e.browserEvent.type == "mousedown") { 3983 Ext.EventManager.stoppedMouseDownEvent.fire(e) 3984 } 3985 b.stopPropagation(e.browserEvent) 3986 } 3987 }, 3988 getCharCode : function() { 3989 return this.charCode || this.keyCode 3990 }, 3991 getKey : function() { 3992 return this.normalizeKey(this.keyCode || this.charCode) 3993 }, 3994 normalizeKey : function(e) { 3995 return Ext.isSafari ? (a[e] || e) : e 3996 }, 3997 getPageX : function() { 3998 return this.xy[0] 3999 }, 4000 getPageY : function() { 4001 return this.xy[1] 4002 }, 4003 getXY : function() { 4004 return this.xy 4005 }, 4006 getTarget : function(g, h, e) { 4007 return g ? Ext.fly(this.target).findParent(g, h, e) : (e ? Ext 4008 .get(this.target) : this.target) 4009 }, 4010 getRelatedTarget : function() { 4011 return this.browserEvent 4012 ? b.getRelatedTarget(this.browserEvent) 4013 : null 4014 }, 4015 getWheelDelta : function() { 4016 var g = this.browserEvent; 4017 var h = 0; 4018 if (g.wheelDelta) { 4019 h = g.wheelDelta / 120 4020 } else { 4021 if (g.detail) { 4022 h = -g.detail / 3 4023 } 4024 } 4025 return h 4026 }, 4027 within : function(h, i, e) { 4028 if (h) { 4029 var g = this[i ? "getRelatedTarget" : "getTarget"](); 4030 return g 4031 && ((e ? (g == Ext.getDom(h)) : false) || Ext.fly(h) 4032 .contains(g)) 4033 } 4034 return false 4035 } 4036 }; 4037 return new Ext.EventObjectImpl() 4038}(); 4039Ext.Loader = Ext.apply({}, { 4040 load : function(j, i, k, c) { 4041 var k = k || this, g = document.getElementsByTagName("head")[0], b = document 4042 .createDocumentFragment(), a = j.length, h = 0, e = this; 4043 var l = function(m) { 4044 g.appendChild(e.buildScriptTag(j[m], d)) 4045 }; 4046 var d = function() { 4047 h++; 4048 if (a == h && typeof i == "function") { 4049 i.call(k) 4050 } else { 4051 if (c === true) { 4052 l(h) 4053 } 4054 } 4055 }; 4056 if (c === true) { 4057 l.call(this, 0) 4058 } else { 4059 Ext.each(j, function(n, m) { 4060 b.appendChild(this.buildScriptTag(n, d)) 4061 }, this); 4062 g.appendChild(b) 4063 } 4064 }, 4065 buildScriptTag : function(b, c) { 4066 var a = document.createElement("script"); 4067 a.type = "text/javascript"; 4068 a.src = b; 4069 if (a.readyState) { 4070 a.onreadystatechange = function() { 4071 if (a.readyState == "loaded" || a.readyState == "complete") { 4072 a.onreadystatechange = null; 4073 c() 4074 } 4075 } 4076 } else { 4077 a.onload = c 4078 } 4079 return a 4080 } 4081}); 4082Ext.ns("Ext.grid", "Ext.list", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu", 4083 "Ext.layout.boxOverflow", "Ext.app", "Ext.ux", 4084 "Ext.direct", "R3"); 4085Ext.apply(Ext, function() { 4086 var c = Ext, a = 0, b = null; 4087 return { 4088 emptyFn : function() { 4089 }, 4090 BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir 4091 ? "/resources/theme/s.gif" 4092 : "data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", 4093 extendX : function(d, e) { 4094 return Ext.extend(d, e(d.prototype)) 4095 }, 4096 getDoc : function() { 4097 return Ext.get(document) 4098 }, 4099 num : function(e, d) { 4100 e = Number(Ext.isEmpty(e) || Ext.isArray(e) 4101 || typeof e == "boolean" 4102 || (typeof e == "string" && e.trim().length == 0) ? NaN : e); 4103 return isNaN(e) ? d : e 4104 }, 4105 value : function(g, d, e) { 4106 return Ext.isEmpty(g, e) ? d : g 4107 }, 4108 escapeRe : function(d) { 4109 return d.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1") 4110 }, 4111 sequence : function(h, d, g, e) { 4112 h[d] = h[d].createSequence(g, e) 4113 }, 4114 addBehaviors : function(i) { 4115 if (!Ext.isReady) { 4116 Ext.onReady(function() { 4117 Ext.addBehaviors(i) 4118 }) 4119 } else { 4120 var e = {}, h, d, g; 4121 for (d in i) { 4122 if ((h = d.split("@"))[1]) { 4123 g = h[0]; 4124 if (!e[g]) { 4125 e[g] = Ext.select(g) 4126 } 4127 e[g].on(h[1], i[d]) 4128 } 4129 } 4130 e = null 4131 } 4132 }, 4133 getScrollBarWidth : function(g) { 4134 if (!Ext.isReady) { 4135 return 0 4136 } 4137 if (g === true || b === null) { 4138 var i = Ext 4139 .getBody()
4140 .createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'), h = i 4141 .child("div", true); 4142 var e = h.offsetWidth; 4143 i.setStyle("overflow", (Ext.isWebKit || Ext.isGecko) 4144 ? "auto" 4145 : "scroll"); 4146 var d = h.offsetWidth; 4147 i.remove(); 4148 b = e - d + 2 4149 } 4150 return b 4151 }, 4152 combine : function() { 4153 var g = arguments, e = g.length, j = []; 4154 for (var h = 0; h < e; h++) { 4155 var d = g[h]; 4156 if (Ext.isArray(d)) { 4157 j = j.concat(d) 4158 } else { 4159 if (d.length !== undefined && !d.substr) { 4160 j = j.concat(Array.prototype.slice.call(d, 0)) 4161 } else { 4162 j.push(d) 4163 } 4164 } 4165 } 4166 return j 4167 }, 4168 copyTo : function(d, e, g) { 4169 if (typeof g == "string") { 4170 g = g.split(/[,;\s]/) 4171 } 4172 Ext.each(g, function(h) { 4173 if (e.hasOwnProperty(h)) { 4174 d[h] = e[h] 4175 } 4176 }, this); 4177 return d 4178 }, 4179 destroy : function() { 4180 Ext.each(arguments, function(d) { 4181 if (d) { 4182 if (Ext.isArray(d)) { 4183 this.destroy.apply(this, d) 4184 } else { 4185 if (typeof d.destroy == "function") { 4186 d.destroy() 4187 } else { 4188 if (d.dom) { 4189 d.remove() 4190 } 4191 } 4192 } 4193 } 4194 }, this) 4195 }, 4196 destroyMembers : function(l, j, g, h) { 4197 for (var k = 1, e = arguments, d = e.length; k < d; k++) { 4198 Ext.destroy(l[e[k]]); 4199 delete l[e[k]] 4200 } 4201 }, 4202 clean : function(d) { 4203 var e = []; 4204 Ext.each(d, function(g) { 4205 if (!!g) { 4206 e.push(g) 4207 } 4208 }); 4209 return e 4210 }, 4211 unique : function(d) { 4212 var e = [], g = {}; 4213 Ext.each(d, function(h) { 4214 if (!g[h]) { 4215 e.push(h) 4216 } 4217 g[h] = true 4218 }); 4219 return e 4220 }, 4221 flatten : function(d) { 4222 var g = []; 4223 function e(h) { 4224 Ext.each(h, function(i) { 4225 if (Ext.isArray(i)) { 4226 e(i) 4227 } else { 4228 g.push(i) 4229 } 4230 }); 4231 return g 4232 } 4233 return e(d) 4234 }, 4235 min : function(d, e) { 4236 var g = d[0]; 4237 e = e || function(i, h) { 4238 return i < h ? -1 : 1 4239 }; 4240 Ext.each(d, function(h) { 4241 g = e(g, h) == -1 ? g : h 4242 }); 4243 return g 4244 }, 4245 max : function(d, e) { 4246 var g = d[0]; 4247 e = e || function(i, h) { 4248 return i > h ? 1 : -1 4249 }; 4250 Ext.each(d, function(h) { 4251 g = e(g, h) == 1 ? g : h 4252 }); 4253 return g 4254 }, 4255 mean : function(d) { 4256 return d.length > 0 ? Ext.sum(d) / d.length : undefined 4257 }, 4258 sum : function(d) { 4259 var e = 0; 4260 Ext.each(d, function(g) { 4261 e += g 4262 }); 4263 return e 4264 }, 4265 partition : function(d, e) { 4266 var g = [[], []]; 4267 Ext.each(d, function(j, k, h) { 4268 g[(e && e(j, k, h)) || (!e && j) ? 0 : 1].push(j) 4269 }); 4270 return g 4271 }, 4272 invoke : function(d, e) { 4273 var h = [], g = Array.prototype.slice.call(arguments, 2); 4274 Ext.each(d, function(j, k) { 4275 if (j && typeof j[e] == "function") { 4276 h.push(j[e].apply(j, g)) 4277 } else { 4278 h.push(undefined) 4279 } 4280 }); 4281 return h 4282 }, 4283 pluck : function(d, g) { 4284 var e = []; 4285 Ext.each(d, function(h) { 4286 e.push(h[g]) 4287 }); 4288 return e 4289 }, 4290 zip : function() { 4291 var n = Ext.partition(arguments, function(i) { 4292 return typeof i != "function" 4293 }), k = n[0], m = n[1][0], d = Ext.max(Ext.pluck(k, 4294 "length")), h = []; 4295 for (var l = 0; l < d; l++) { 4296 h[l] = []; 4297 if (m) { 4298 h[l] = m.apply(m, Ext.pluck(k, l)) 4299 } else { 4300 for (var g = 0, e = k.length; g < e; g++) { 4301 h[l].push(k[g][l]) 4302 } 4303 } 4304 } 4305 return h 4306 }, 4307 getCmp : function(d) { 4308 return Ext.ComponentMgr.get(d) 4309 }, 4310 useShims : c.isIE6 || (c.isMac && c.isGecko2), 4311 type : function(e) { 4312 if (e === undefined || e === null) { 4313 return false 4314 } 4315 if (e.htmlElement) { 4316 return "element" 4317 } 4318 var d = typeof e; 4319 if (d == "object" && e.nodeName) { 4320 switch (e.nodeType) { 4321 case 1 : 4322 return "element"; 4323 case 3 : 4324 return (/\S/).test(e.nodeValue) 4325 ? "textnode" 4326 : "whitespace" 4327 } 4328 } 4329 if (d == "object" || d == "function") { 4330 switch (e.constructor) { 4331 case Array : 4332 return "array"; 4333 case RegExp : 4334 return "regexp"; 4335 case Date : 4336 return "date" 4337 } 4338 if (typeof e.length == "number" && typeof e.item == "function") { 4339 return "nodelist" 4340 } 4341 } 4342 return d 4343 }, 4344 intercept : function(h, d, g, e) { 4345 h[d] = h[d].createInterceptor(g, e) 4346 }, 4347 callback : function(d, h, g, e) { 4348 if (typeof d == "function") { 4349 if (e) { 4350 d.defer(e, h, g || []) 4351 } else { 4352 d.apply(h, g || []) 4353 } 4354 } 4355 } 4356 } 4357}()); 4358Ext.apply(Function.prototype, { 4359 createSequence : function(b, a) { 4360 var c = this;
4361 return (typeof b != "function") ? this : function() { 4362 var d = c.apply(this || window, arguments); 4363 b.apply(a || this || window, arguments); 4364 return d 4365 } 4366 } 4367 }); 4368Ext.applyIf(String, { 4369 escape : function(a) { 4370 return a.replace(/('|\\)/g, "\\$1") 4371 }, 4372 leftPad : function(d, b, c) { 4373 var a = String(d); 4374 if (!c) { 4375 c = " " 4376 } 4377 while (a.length < b) { 4378 a = c + a 4379 } 4380 return a 4381 } 4382 }); 4383String.prototype.toggle = function(b, a) { 4384 return this == b ? a : b 4385}; 4386String.prototype.trim = function() { 4387 var a = /^\s+|\s+$/g; 4388 return function() { 4389 return this.replace(a, "") 4390 } 4391}(); 4392Date.prototype.getElapsed = function(a) { 4393 return Math.abs((a || new Date()).getTime() - this.getTime()) 4394}; 4395Ext.applyIf(Number.prototype, { 4396 constrain : function(b, a) { 4397 return Math.min(Math.max(this, b), a) 4398 } 4399 }); 4400Ext.lib.Dom.getRegion = function(a) { 4401 return Ext.lib.Region.getRegion(a) 4402}; 4403Ext.lib.Region = function(d, g, a, c) { 4404 var e = this; 4405 e.top = d; 4406 e[1] = d; 4407 e.right = g; 4408 e.bottom = a; 4409 e.left = c; 4410 e[0] = c 4411}; 4412Ext.lib.Region.prototype = { 4413 contains : function(b) { 4414 var a = this; 4415 return (b.left >= a.left && b.right <= a.right && b.top >= a.top && b.bottom <= a.bottom) 4416 }, 4417 getArea : function() { 4418 var a = this; 4419 return ((a.bottom - a.top) * (a.right - a.left)) 4420 }, 4421 intersect : function(h) { 4422 var g = this, d = Math.max(g.top, h.top), e = Math 4423 .min(g.right, h.right), a = Math.min(g.bottom, h.bottom), c = Math 4424 .max(g.left, h.left); 4425 if (a >= d && e >= c) { 4426 return new Ext.lib.Region(d, e, a, c) 4427 } 4428 }, 4429 union : function(h) { 4430 var g = this, d = Math.min(g.top, h.top), e = Math 4431 .max(g.right, h.right), a = Math.max(g.bottom, h.bottom), c = Math 4432 .min(g.left, h.left); 4433 return new Ext.lib.Region(d, e, a, c) 4434 }, 4435 constrainTo : function(b) { 4436 var a = this; 4437 a.top = a.top.constrain(b.top, b.bottom); 4438 a.bottom = a.bottom.constrain(b.top, b.bottom); 4439 a.left = a.left.constrain(b.left, b.right); 4440 a.right = a.right.constrain(b.left, b.right); 4441 return a 4442 }, 4443 adjust : function(d, c, a, g) { 4444 var e = this; 4445 e.top += d; 4446 e.left += c; 4447 e.right += g; 4448 e.bottom += a; 4449 return e 4450 } 4451}; 4452Ext.lib.Region.getRegion = function(e) { 4453 var h = Ext.lib.Dom.getXY(e), d = h[1], g = h[0] + e.offsetWidth, a = h[1] 4454 + e.offsetHeight, c = h[0]; 4455 return new Ext.lib.Region(d, g, a, c) 4456}; 4457Ext.lib.Point = function(a, c) { 4458 if (Ext.isArray(a)) { 4459 c = a[1]; 4460 a = a[0] 4461 } 4462 var b = this; 4463 b.x = b.right = b.left = b[0] = a; 4464 b.y = b.top = b.bottom = b[1] = c 4465}; 4466Ext.lib.Point.prototype = new Ext.lib.Region(); 4467Ext.apply(Ext.DomHelper, function() { 4468 var e, a = "afterbegin", h = "afterend", i = "beforebegin", d = "beforeend", b = /tag|children|cn|html$/i; 4469 function g(m, p, n, q, l, j) { 4470 m = Ext.getDom(m); 4471 var k; 4472 if (e.useDom) { 4473 k = c(p, null); 4474 if (j) { 4475 m.appendChild(k) 4476 } else { 4477 (l == "firstChild" ? m : m.parentNode).insertBefore(k, m[l] 4478 || m) 4479 } 4480 } else { 4481 k = Ext.DomHelper.insertHtml(q, m, Ext.DomHelper.createHtml(p)) 4482 } 4483 return n ? Ext.get(k, true) : k 4484 } 4485 function c(j, r) { 4486 var k, u = document, p, s, m, t; 4487 if (Ext.isArray(j)) { 4488 k = u.createDocumentFragment(); 4489 for (var q = 0, n = j.length; q < n; q++) { 4490 c(j[q], k) 4491 } 4492 } else { 4493 if (typeof j == "string") { 4494 k = u.createTextNode(j) 4495 } else { 4496 k = u.createElement(j.tag || "div"); 4497 p = !!k.setAttribute; 4498 for (var s in j) { 4499 if (!b.test(s)) { 4500 m = j[s]; 4501 if (s == "cls") { 4502 k.className = m 4503 } else { 4504 if (p) { 4505 k.setAttribute(s, m) 4506 } else { 4507 k[s] = m 4508 } 4509 } 4510 } 4511 } 4512 Ext.DomHelper.applyStyles(k, j.style); 4513 if ((t = j.children || j.cn)) { 4514 c(t, k) 4515 } else { 4516 if (j.html) { 4517 k.innerHTML = j.html 4518 } 4519 } 4520 } 4521 } 4522 if (r) { 4523 r.appendChild(k) 4524 } 4525 return k 4526 } 4527 e = { 4528 createTemplate : function(k) { 4529 var j = Ext.DomHelper.createHtml(k);
4530 return new Ext.Template(j) 4531 }, 4532 useDom : false, 4533 insertBefore : function(j, l, k) { 4534 return g(j, l, k, i) 4535 }, 4536 insertAfter : function(j, l, k) { 4537 return g(j, l, k, h, "nextSibling") 4538 }, 4539 insertFirst : function(j, l, k) { 4540 return g(j, l, k, a, "firstChild") 4541 }, 4542 append : function(j, l, k) { 4543 return g(j, l, k, d, "", true) 4544 }, 4545 createDom : c 4546 }; 4547 return e 4548}()); 4549Ext.apply(Ext.Template.prototype, { 4550 disableFormats : false, 4551 re : /\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g, 4552 argsRe : /^\s*['"](.*)["']\s*$/, 4553 compileARe : /\\/g, 4554 compileBRe : /(\r\n|\n)/g, 4555 compileCRe : /'/g, 4556 applyTemplate : function(b) { 4557 var g = this, a = g.disableFormats !== true, e = Ext.util.Format, c = g; 4558 if (g.compiled) { 4559 return g.compiled(b) 4560 } 4561 function d(j, l, p, k) { 4562 if (p && a) { 4563 if (p.substr(0, 5) == "this.") { 4564 return c.call(p.substr(5), b[l], b) 4565 } else { 4566 if (k) { 4567 var o = g.argsRe; 4568 k = k.split(","); 4569 for (var n = 0, h = k.length; n < h; n++) { 4570 k[n] = k[n].replace(o, "$1") 4571 } 4572 k = [b[l]].concat(k) 4573 } else { 4574 k = [b[l]] 4575 } 4576 return e[p].apply(e, k) 4577 } 4578 } else { 4579 return b[l] !== undefined ? b[l] : "" 4580 } 4581 } 4582 return g.html.replace(g.re, d) 4583 }, 4584 compile : function() { 4585 var me = this, fm = Ext.util.Format, useF = me.disableFormats !== true, sep = Ext.isGecko 4586 ? "+" 4587 : ",", body; 4588 function fn(m, name, format, args) { 4589 if (format && useF) { 4590 args = args ? "," + args : ""; 4591 if (format.substr(0, 5) != "this.") { 4592 format = "fm." + format + "(" 4593 } else { 4594 format = 'this.call("' + format.substr(5) + '", '; 4595 args = ", values" 4596 } 4597 } else { 4598 args = ""; 4599 format = "(values['" + name + "'] == undefined ? '' : " 4600 } 4601 return "'" + sep + format + "values['" + name + "']" + args + ")" 4602 + sep + "'" 4603 } 4604 if (Ext.isGecko) { 4605 body = "this.compiled = function(values){ return '" 4606 + me.html.replace(me.compileARe, "\\\\").replace( 4607 me.compileBRe, "\\n").replace(me.compileCRe, "\\'") 4608 .replace(me.re, fn) + "';};" 4609 } else { 4610 body = ["this.compiled = function(values){ return ['"]; 4611 body.push(me.html.replace(me.compileARe, "\\\\").replace( 4612 me.compileBRe, "\\n").replace(me.compileCRe, "\\'") 4613 .replace(me.re, fn)); 4614 body.push("'].join('');};"); 4615 body = body.join("") 4616 } 4617 eval(body); 4618 return me 4619 }, 4620 call : function(c, b, a) { 4621 return this[c](b, a) 4622 } 4623}); 4624Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; 4625Ext.util.Functions = { 4626 createInterceptor : function(c, b, a) { 4627 var d = c; 4628 if (!Ext.isFunction(b)) { 4629 return c 4630 } else { 4631 return function() { 4632 var g = this, e = arguments; 4633 b.target = g; 4634 b.method = c; 4635 return (b.apply(a || g || window, e) !== false) ? c.apply(g 4636 || window, e) : null 4637 } 4638 } 4639 }, 4640 createDelegate : function(c, d, b, a) { 4641 if (!Ext.isFunction(c)) { 4642 return c 4643 } 4644 return function() { 4645 var g = b || arguments; 4646 if (a === true) { 4647 g = Array.prototype.slice.call(arguments, 0); 4648 g = g.concat(b) 4649 } else { 4650 if (Ext.isNumber(a)) { 4651 g = Array.prototype.slice.call(arguments, 0); 4652 var e = [a, 0].concat(b); 4653 Array.prototype.splice.apply(g, e) 4654 } 4655 } 4656 return c.apply(d || window, g) 4657 } 4658 }, 4659 defer : function(d, c, e, b, a) { 4660 d = Ext.util.Functions.createDelegate(d, e, b, a); 4661 if (c > 0) { 4662 return setTimeout(d, c) 4663 } 4664 d(); 4665 return 0 4666 }, 4667 createSequence : function(c, b, a) { 4668 if (!Ext.isFunction(b)) { 4669 return c 4670 } else { 4671 return function() { 4672 var d = c.apply(this || window, arguments); 4673 b.apply(a || this || window, arguments); 4674 return d 4675 } 4676 } 4677 } 4678}; 4679Ext.defer = Ext.util.Functions.defer; 4680Ext.createInterceptor = Ext.util.Functions.createInterceptor; 4681Ext.createSequence = Ext.util.Functions.createSequence; 4682Ext.createDelegate = Ext.util.Functions.createDelegate; 4683Ext.apply(Ext.util.Observable.prototype, function() { 4684 function a(j) { 4685 var i = (this.methodEvents = this.methodEvents || {})[j], d, c, g, h = this; 4686 if (!i) { 4687 this.methodEvents[j] = i = {}; 4688 i.originalFn = this[j]; 4689 i.methodName = j; 4690 i.before = []; 4691 i.after = []; 4692 var b = function(l, k, e) { 4693 if ((c = l.apply(k || h, e)) !== undefined) { 4694 if (typeof c == "object") { 4695 if (c.returnValue !== undefined) { 4696 d = c.returnValue 4697 } else { 4698 d = c 4699 } 4700 g = !!c.cancel 4701 } else { 4702 if (c === false) { 4703 g = true 4704 } else { 4705 d = c 4706 } 4707 } 4708 } 4709 }; 4710 this[j] = function() { 4711 var l = Array.prototype.slice.call(arguments, 0), k; 4712 d = c = undefined; 4713 g = false; 4714 for (var m = 0, e = i.before.length; m < e; m++) { 4715 k = i.before[m]; 4716 b(k.fn, k.scope, l); 4717 if (g) { 4718 return d 4719 } 4720 } 4721 if ((c = i.originalFn.apply(h, l)) !== undefined) { 4722 d = c 4723 } 4724 for (var m = 0, e = i.after.length; m < e; m++) { 4725 k = i.after[m]; 4726 b(k.fn, k.scope, l); 4727 if (g) { 4728 return d 4729 } 4730 } 4731 return d 4732 } 4733 } 4734 return i 4735 } 4736 return { 4737 beforeMethod : function(d, c, b) { 4738 a.call(this, d).before.push({ 4739 fn : c, 4740 scope : b 4741 }) 4742 }, 4743 afterMethod : function(d, c, b) { 4744 a.call(this, d).after.push({ 4745 fn : c, 4746 scope : b 4747 }) 4748 }, 4749 removeMethodListener : function(j, g, d) { 4750 var h = this.getMethodEvent(j); 4751 for (var c = 0, b = h.before.length; c < b; c++) { 4752 if (h.before[c].fn == g && h.before[c].scope == d) { 4753 h.before.splice(c, 1); 4754 return 4755 } 4756 } 4757 for (var c = 0, b = h.after.length; c < b; c++) { 4758 if (h.after[c].fn == g && h.after[c].scope == d) { 4759 h.after.splice(c, 1); 4760 return 4761 } 4762 } 4763 }, 4764 relayEvents : function(j, e) { 4765 var h = this; 4766 function g(i) { 4767 return function() { 4768 return h.fireEvent.apply(h, [i] 4769 .concat(Array.prototype.slice.call( 4770 arguments, 0))) 4771 } 4772 } 4773 for (var d = 0, b = e.length; d < b; d++) { 4774 var c = e[d]; 4775 h.events[c] = h.events[c] || true; 4776 j.on(c, g(c), h) 4777 } 4778 }, 4779 enableBubble : function(e) { 4780 var g = this; 4781 if (!Ext.isEmpty(e)) { 4782 e = Ext.isArray(e) ? e : Array.prototype.slice.call(arguments, 4783 0); 4784 for (var d = 0, b = e.length; d < b; d++) { 4785 var c = e[d]; 4786 c = c.toLowerCase(); 4787 var h = g.events[c] || true; 4788 if (typeof h == "boolean") { 4789 h = new Ext.util.Event(g, c); 4790 g.events[c] = h 4791 } 4792 h.bubble = true 4793 } 4794 } 4795 } 4796 } 4797}()); 4798Ext.util.Observable.capture = function(c, b, a) { 4799 c.fireEvent = c.fireEvent.createInterceptor(b, a) 4800}; 4801Ext.util.Observable.observeClass = function(b, a) { 4802 if (b) { 4803 if (!b.fireEvent) { 4804 Ext.apply(b, new Ext.util.Observable()); 4805 Ext.util.Observable.capture(b.prototype, b.fireEvent, b) 4806 } 4807 if (typeof a == "object") { 4808 b.on(a) 4809 } 4810 return b 4811 } 4812}; 4813Ext.apply(Ext.EventManager, function() { 4814 var d, k, g, b, a = Ext.lib.Dom, j = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/, c = Ext.EventManager._unload, i = 0, h = 0, e = Ext.isWebKit
4815 ? Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 4816 : !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera); 4817 return { 4818 _unload : function() { 4819 Ext.EventManager.un(window, "resize", this.fireWindowResize, this); 4820 c.call(Ext.EventManager) 4821 }, 4822 doResizeEvent : function() { 4823 var m = a.getViewHeight(), l = a.getViewWidth(); 4824 if (h != m || i != l) { 4825 d.fire(i = l, h = m) 4826 } 4827 }, 4828 onWindowResize : function(n, m, l) { 4829 if (!d) { 4830 d = new Ext.util.Event(); 4831 k = new Ext.util.DelayedTask(this.doResizeEvent); 4832 Ext.EventManager.on(window, "resize", this.fireWindowResize, 4833 this) 4834 } 4835 d.addListener(n, m, l) 4836 }, 4837 fireWindowResize : function() { 4838 if (d) { 4839 k.delay(100) 4840 } 4841 }, 4842 onTextResize : function(o, n, l) { 4843 if (!g) { 4844 g = new Ext.util.Event(); 4845 var m = new Ext.Element(document.createElement("div")); 4846 m.dom.className = "x-text-resize"; 4847 m.dom.innerHTML = "X"; 4848 m.appendTo(document.body); 4849 b = m.dom.offsetHeight; 4850 setInterval(function() { 4851 if (m.dom.offsetHeight != b) { 4852 g.fire(b, b = m.dom.offsetHeight) 4853 } 4854 }, this.textResizeInterval) 4855 } 4856 g.addListener(o, n, l) 4857 }, 4858 removeResizeListener : function(m, l) { 4859 if (d) { 4860 d.removeListener(m, l) 4861 } 4862 }, 4863 fireResize : function() { 4864 if (d) { 4865 d.fire(a.getViewWidth(), a.getViewHeight()) 4866 } 4867 }, 4868 textResizeInterval : 50, 4869 ieDeferSrc : false, 4870 getKeyEvent : function() { 4871 return e ? "keydown" : "keypress" 4872 }, 4873 useKeydown : e 4874 } 4875}()); 4876Ext.EventManager.on = Ext.EventManager.addListener; 4877Ext.apply(Ext.EventObjectImpl.prototype, { 4878 BACKSPACE : 8, 4879 TAB : 9, 4880 NUM_CENTER : 12, 4881 ENTER : 13, 4882 RETURN : 13, 4883 SHIFT : 16, 4884 CTRL : 17, 4885 CONTROL : 17, 4886 ALT : 18, 4887 PAUSE : 19, 4888 CAPS_LOCK : 20, 4889 ESC : 27, 4890 SPACE : 32, 4891 PAGE_UP : 33, 4892 PAGEUP : 33, 4893 PAGE_DOWN : 34, 4894 PAGEDOWN : 34, 4895 END : 35, 4896 HOME : 36, 4897 LEFT : 37, 4898 UP : 38, 4899 RIGHT : 39, 4900 DOWN : 40, 4901 PRINT_SCREEN : 44, 4902 INSERT : 45, 4903 DELETE : 46, 4904 ZERO : 48, 4905 ONE : 49, 4906 TWO : 50, 4907 THREE : 51, 4908 FOUR : 52, 4909 FIVE : 53, 4910 SIX : 54, 4911 SEVEN : 55, 4912 EIGHT : 56, 4913 NINE : 57, 4914 A : 65, 4915 B : 66, 4916 C : 67, 4917 D : 68, 4918 E : 69, 4919 F : 70, 4920 G : 71, 4921 H : 72, 4922 I : 73, 4923 J : 74, 4924 K : 75, 4925 L : 76, 4926 M : 77, 4927 N : 78, 4928 O : 79, 4929 P : 80, 4930 Q : 81, 4931 R : 82, 4932 S : 83, 4933 T : 84, 4934 U : 85, 4935 V : 86, 4936 W : 87, 4937 X : 88, 4938 Y : 89, 4939 Z : 90, 4940 CONTEXT_MENU : 93, 4941 NUM_ZERO : 96, 4942 NUM_ONE : 97, 4943 NUM_TWO : 98, 4944 NUM_THREE : 99, 4945 NUM_FOUR : 100, 4946 NUM_FIVE : 101, 4947 NUM_SIX : 102, 4948 NUM_SEVEN : 103, 4949 NUM_EIGHT : 104, 4950 NUM_NINE : 105, 4951 NUM_MULTIPLY : 106, 4952 NUM_PLUS : 107, 4953 NUM_MINUS : 109, 4954 NUM_PERIOD : 110, 4955 NUM_DIVISION : 111, 4956 F1 : 112, 4957 F2 : 113, 4958 F3 : 114, 4959 F4 : 115, 4960 F5 : 116, 4961 F6 : 117, 4962 F7 : 118, 4963 F8 : 119, 4964 F9 : 120, 4965 F10 : 121, 4966 F11 : 122, 4967 F12 : 123, 4968 isNavKeyPress : function() { 4969 var b = this, a = this.normalizeKey(b.keyCode); 4970 return (a >= 33 && a <= 40) || a == b.RETURN || a == b.TAB 4971 || a == b.ESC 4972 }, 4973 isSpecialKey : function() { 4974 var a = this.normalizeKey(this.keyCode); 4975 return (this.type == "keypress" && this.ctrlKey) 4976 || this.isNavKeyPress() || (a == this.BACKSPACE) 4977 || (a >= 16 && a <= 20) || (a >= 44 && a <= 46) 4978 }, 4979 getPoint : function() { 4980 return new Ext.lib.Point(this.xy[0], this.xy[1]) 4981 }, 4982 hasModifier : function() { 4983 return ((this.ctrlKey || this.altKey) || this.shiftKey) 4984 } 4985 }); 4986Ext.Element.addMethods({ 4987 swallowEvent : function(a, b) { 4988 var d = this; 4989 function c(g) { 4990 g.stopPropagation(); 4991 if (b) { 4992 g.preventDefault() 4993 } 4994 } 4995 if (Ext.isArray(a)) { 4996 Ext.each(a, function(g) { 4997 d.on(g, c) 4998 }); 4999 return d 5000 } 5001 d.on(a, c); 5002 return d 5003 }, 5004 relayEvent : function(a, b) { 5005 this.on(a, function(c) { 5006 b.fireEvent(a, c) 5007 }) 5008 }, 5009 clean : function(b) { 5010 var d = this, e = d.dom, g = e.firstChild, c = -1; 5011 if (Ext.Element.data(e, "isCleaned") && b !== true) { 5012 return d 5013 } 5014 while (g) { 5015 var a = g.nextSibling; 5016 if (g.nodeType == 3 && !(/\S/.test(g.nodeValue))) { 5017 e.removeChild(g) 5018 } else { 5019 g.nodeIndex = ++c 5020 } 5021 g = a 5022 } 5023 Ext.Element.data(e, "isCleaned", true); 5024 return d 5025 }, 5026 load : function() { 5027 var a = this.getUpdater(); 5028 a.update.apply(a, arguments); 5029 return this 5030 }, 5031 getUpdater : function() { 5032 return this.updateManager 5033 || (this.updateManager = new Ext.Updater(this)) 5034 }, 5035 update : function(html, loadScripts, callback) { 5036 if (!this.dom) { 5037 return this 5038 } 5039 html = html || ""; 5040 if (loadScripts !== true) { 5041 this.dom.innerHTML = html; 5042 if (typeof callback == "function") { 5043 callback() 5044 } 5045 return this 5046 } 5047 var id = Ext.id(), dom = this.dom; 5048 html += '<span id="' + id + '"></span>'; 5049 Ext.lib.Event.onAvailable(id, function() { 5050 var DOC = document, hd = DOC.getElementsByTagName("head")[0], re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig, srcRe = /\ssrc=([\'\"])(.*?)\1/i, typeRe = /\stype=([\'\"])(.*?)\1/i, match, attrs, srcMatch, typeMatch, el, s; 5051 while ((match = re.exec(html))) { 5052 attrs = match[1]; 5053 srcMatch = attrs ? attrs.match(srcRe) : false;
5054 if (srcMatch && srcMatch[2]) { 5055 s = DOC.createElement("script"); 5056 s.src = srcMatch[2]; 5057 typeMatch = attrs.match(typeRe); 5058 if (typeMatch && typeMatch[2]) { 5059 s.type = typeMatch[2] 5060 } 5061 hd.appendChild(s) 5062 } else { 5063 if (match[2] && match[2].length > 0) { 5064 if (window.execScript) { 5065 window.execScript(match[2]) 5066 } else { 5067 window.eval(match[2]) 5068 } 5069 } 5070 } 5071 } 5072 el = DOC.getElementById(id); 5073 if (el) { 5074 Ext.removeNode(el) 5075 } 5076 if (typeof callback == "function") { 5077 callback() 5078 } 5079 }); 5080 dom.innerHTML = html.replace( 5081 /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, ""); 5082 return this 5083 }, 5084 removeAllListeners : function() { 5085 this.removeAnchor(); 5086 Ext.EventManager.removeAll(this.dom); 5087 return this 5088 }, 5089 createProxy : function(a, e, d) { 5090 a = (typeof a == "object") ? a : { 5091 tag : "div", 5092 cls : a 5093 }; 5094 var c = this, b = e ? Ext.DomHelper.append(e, a, true) : Ext.DomHelper 5095 .insertBefore(c.dom, a, true); 5096 if (d && c.setBox && c.getBox) { 5097 b.setBox(c.getBox()) 5098 } 5099 return b 5100 } 5101}); 5102Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater; 5103Ext.Element.addMethods({ 5104 getAnchorXY : function(e, l, q) { 5105 e = (e || "tl").toLowerCase(); 5106 q = q || {}; 5107 var k = this, b = k.dom == document.body || k.dom == document, n = q.width 5108 || b ? Ext.lib.Dom.getViewWidth() : k.getWidth(), i = q.height 5109 || b ? Ext.lib.Dom.getViewHeight() : k.getHeight(), p, a = Math.round, c = k 5110 .getXY(), m = k.getScroll(), j = b ? m.left : !l ? c[0] : 0, g = b 5111 ? m.top 5112 : !l ? c[1] : 0, d = { 5113 c : [a(n * 0.5), a(i * 0.5)], 5114 t : [a(n * 0.5), 0], 5115 l : [0, a(i * 0.5)], 5116 r : [n, a(i * 0.5)], 5117 b : [a(n * 0.5), i], 5118 tl : [0, 0], 5119 bl : [0, i], 5120 br : [n, i], 5121 tr : [n, 0] 5122 }; 5123 p = d[e]; 5124 return [p[0] + j, p[1] + g] 5125 }, 5126 anchorTo : function(b, h, c, a, k, l) { 5127 var i = this, e = i.dom, j = !Ext.isEmpty(k), d = function() { 5128 Ext.fly(e).alignTo(b, h, c, a); 5129 Ext.callback(l, Ext.fly(e)) 5130 }, g = this.getAnchor(); 5131 this.removeAnchor(); 5132 Ext.apply(g, { 5133 fn : d, 5134 scroll : j 5135 }); 5136 Ext.EventManager.onWindowResize(d, null); 5137 if (j) { 5138 Ext.EventManager.on(window, "scroll", d, null, { 5139 buffer : !isNaN(k) ? k : 50 5140 }) 5141 } 5142 d.call(i); 5143 return i 5144 }, 5145 removeAnchor : function() { 5146 var b = this, a = this.getAnchor(); 5147 if (a && a.fn) { 5148 Ext.EventManager.removeResizeListener(a.fn); 5149 if (a.scroll) { 5150 Ext.EventManager.un(window, "scroll", a.fn) 5151 } 5152 delete a.fn 5153 } 5154 return b 5155 }, 5156 getAnchor : function() { 5157 var b = Ext.Element.data, c = this.dom; 5158 if (!c) { 5159 return 5160 } 5161 var a = b(c, "_anchor"); 5162 if (!a) { 5163 a = b(c, "_anchor", {}) 5164 } 5165 return a 5166 }, 5167 getAlignToXY : function(g, A, B) { 5168 g = Ext.get(g); 5169 if (!g || !g.dom) { 5170 throw "Element.alignToXY with an element that doesn't exist" 5171 } 5172 B = B || [0, 0]; 5173 A = (!A || A == "?" ? "tl-bl?" : (!(/-/).test(A) && A !== "" ? "tl-" 5174 + A : A || "tl-bl")).toLowerCase(); 5175 var K = this, H = K.dom, M, L, n, l, s, F, v, t = Ext.lib.Dom 5176 .getViewWidth() 5177 - 10, G = Ext.lib.Dom.getViewHeight() - 10, b, i, j, k, u, z, N = document, J = N.documentElement, q = N.body, E = (J.scrollLeft 5178 || q.scrollLeft || 0) 5179 + 5, D = (J.scrollTop || q.scrollTop || 0) + 5, I = false, e = "", a = "", C = A 5180 .match(/^([a-z]+)-([a-z]+)(\?)?$/); 5181 if (!C) { 5182 throw "Element.alignTo with an invalid alignment " + A 5183 } 5184 e = C[1]; 5185 a = C[2]; 5186 I = !!C[3]; 5187 M = K.getAnchorXY(e, true); 5188 L = g.getAnchorXY(a, false); 5189 n = L[0] - M[0] + B[0]; 5190 l = L[1] - M[1] + B[1]; 5191 if (I) { 5192 s = K.getWidth(); 5193 F = K.getHeight(); 5194 v = g.getRegion(); 5195 b = e.charAt(0);
5196 i = e.charAt(e.length - 1); 5197 j = a.charAt(0); 5198 k = a.charAt(a.length - 1); 5199 u = ((b == "t" && j == "b") || (b == "b" && j == "t")); 5200 z = ((i == "r" && k == "l") || (i == "l" && k == "r")); 5201 if (n + s > t + E) { 5202 n = z ? v.left - s : t + E - s 5203 } 5204 if (n < E) { 5205 n = z ? v.right : E 5206 } 5207 if (l + F > G + D) { 5208 l = u ? v.top - F : G + D - F 5209 } 5210 if (l < D) { 5211 l = u ? v.bottom : D 5212 } 5213 } 5214 return [n, l] 5215 }, 5216 alignTo : function(c, a, e, b) { 5217 var d = this; 5218 return d.setXY(d.getAlignToXY(c, a, e), d.preanim && !!b ? d.preanim( 5219 arguments, 3) : false) 5220 }, 5221 adjustForConstraints : function(c, a, b) { 5222 return this.getConstrainToXY(a || document, false, b, c) || c 5223 }, 5224 getConstrainToXY : function(b, a, c, e) { 5225 var d = { 5226 top : 0, 5227 left : 0, 5228 bottom : 0, 5229 right : 0 5230 }; 5231 return function(i, A, l, n) { 5232 i = Ext.get(i); 5233 l = l ? Ext.applyIf(l, d) : d; 5234 var z, D, v = 0, u = 0; 5235 if (i.dom == document.body || i.dom == document) { 5236 z = Ext.lib.Dom.getViewWidth(); 5237 D = Ext.lib.Dom.getViewHeight() 5238 } else { 5239 z = i.dom.clientWidth; 5240 D = i.dom.clientHeight; 5241 if (!A) { 5242 var t = i.getXY(); 5243 v = t[0]; 5244 u = t[1] 5245 } 5246 } 5247 var r = i.getScroll(); 5248 v += l.left + r.left; 5249 u += l.top + r.top; 5250 z -= l.right; 5251 D -= l.bottom; 5252 var B = v + z, g = u + D, j = n 5253 || (!A ? this.getXY() : [this.getLeft(true), 5254 this.getTop(true)]), p = j[0], o = j[1], k = this 5255 .getConstrainOffset(), q = this.dom.offsetWidth + k, C = this.dom.offsetHeight 5256 + k; 5257 var m = false; 5258 if ((p + q) > B) { 5259 p = B - q; 5260 m = true 5261 } 5262 if ((o + C) > g) { 5263 o = g - C; 5264 m = true 5265 } 5266 if (p < v) { 5267 p = v; 5268 m = true 5269 } 5270 if (o < u) { 5271 o = u; 5272 m = true 5273 } 5274 return m ? [p, o] : false 5275 } 5276 }(), 5277 getConstrainOffset : function() { 5278 return 0 5279 }, 5280 getCenterXY : function() { 5281 return this.getAlignToXY(document, "c-c") 5282 }, 5283 center : function(a) { 5284 return this.alignTo(a || document, "c-c") 5285 } 5286}); 5287Ext.Element.addMethods({ 5288 select : function(a, b) { 5289 return Ext.Element.select(a, b, this.dom) 5290 } 5291 }); 5292Ext.apply(Ext.Element.prototype, function() { 5293 var c = Ext.getDom, a = Ext.get, b = Ext.DomHelper; 5294 return { 5295 insertSibling : function(i, g, h) { 5296 var j = this, e, d = (g || "before").toLowerCase() == "after", k; 5297 if (Ext.isArray(i)) { 5298 k = j; 5299 Ext.each(i, function(l) { 5300 e = Ext.fly(k, "_internal").insertSibling( 5301 l, g, h); 5302 if (d) { 5303 k = e 5304 } 5305 });
5306 return e 5307 } 5308 i = i || {}; 5309 if (i.nodeType || i.dom) { 5310 e = j.dom.parentNode.insertBefore(c(i), d 5311 ? j.dom.nextSibling 5312 : j.dom); 5313 if (!h) { 5314 e = a(e) 5315 } 5316 } else { 5317 if (d && !j.dom.nextSibling) { 5318 e = b.append(j.dom.parentNode, i, !h) 5319 } else { 5320 e = b[d ? "insertAfter" : "insertBefore"](j.dom, i, 5321 !h) 5322 } 5323 } 5324 return e 5325 } 5326 } 5327 }()); 5328Ext.Element.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>'; 5329Ext.Element.addMethods(function() { 5330 var a = "_internal", b = /(\d+\.?\d+)px/; 5331 return { 5332 applyStyles : function(c) { 5333 Ext.DomHelper.applyStyles(this.dom, c); 5334 return this 5335 }, 5336 getStyles : function() { 5337 var c = {}; 5338 Ext.each(arguments, function(d) { 5339 c[d] = this.getStyle(d) 5340 }, this); 5341 return c 5342 }, 5343 setOverflow : function(c) { 5344 var d = this.dom; 5345 if (c == "auto" && Ext.isMac && Ext.isGecko2) { 5346 d.style.overflow = "hidden"; 5347(function () { 5348 d.style.overflow = "auto" 5349 }).defer(1) 5350 } else { 5351 d.style.overflow = c 5352 } 5353 }, 5354 boxWrap : function(c) { 5355 c = c || "x-box"; 5356 var d = Ext.get(this.insertHtml("beforeBegin", "<div class='" + c 5357 + "'>" + String.format(Ext.Element.boxMarkup, c) 5358 + "</div>")); 5359 Ext.DomQuery.selectNode("." + c + "-mc", d.dom) 5360 .appendChild(this.dom); 5361 return d 5362 }, 5363 setSize : function(e, c, d) { 5364 var g = this; 5365 if (typeof e == "object") { 5366 c = e.height; 5367 e = e.width 5368 } 5369 e = g.adjustWidth(e); 5370 c = g.adjustHeight(c); 5371 if (!d || !g.anim) { 5372 g.dom.style.width = g.addUnits(e); 5373 g.dom.style.height = g.addUnits(c) 5374 } else { 5375 g.anim({ 5376 width : { 5377 to : e 5378 }, 5379 height : { 5380 to : c 5381 } 5382 }, g.preanim(arguments, 2)) 5383 } 5384 return g 5385 }, 5386 getComputedHeight : function() { 5387 var d = this, c = Math.max(d.dom.offsetHeight, d.dom.clientHeight); 5388 if (!c) { 5389 c = parseFloat(d.getStyle("height")) || 0; 5390 if (!d.isBorderBox()) { 5391 c += d.getFrameWidth("tb") 5392 } 5393 } 5394 return c 5395 }, 5396 getComputedWidth : function() { 5397 var c = Math.max(this.dom.offsetWidth, this.dom.clientWidth); 5398 if (!c) { 5399 c = parseFloat(this.getStyle("width")) || 0; 5400 if (!this.isBorderBox()) { 5401 c += this.getFrameWidth("lr") 5402 } 5403 } 5404 return c 5405 }, 5406 getFrameWidth : function(d, c) { 5407 return c && this.isBorderBox() ? 0 : (this.getPadding(d) + this 5408 .getBorderWidth(d)) 5409 }, 5410 addClassOnOver : function(c) { 5411 this.hover(function() { 5412 Ext.fly(this, a).addClass(c) 5413 }, function() { 5414 Ext.fly(this, a).removeClass(c) 5415 }); 5416 return this 5417 }, 5418 addClassOnFocus : function(c) { 5419 this.on("focus", function() { 5420 Ext.fly(this, a).addClass(c) 5421 }, this.dom); 5422 this.on("blur", function() { 5423 Ext.fly(this, a).removeClass(c) 5424 }, this.dom); 5425 return this 5426 }, 5427 addClassOnClick : function(c) { 5428 var d = this.dom; 5429 this.on("mousedown", function() { 5430 Ext.fly(d, a).addClass(c); 5431 var g = Ext.getDoc(), e = function() { 5432 Ext.fly(d, a).removeClass(c); 5433 g.removeListener("mouseup", e) 5434 }; 5435 g.on("mouseup", e) 5436 }); 5437 return this 5438 }, 5439 getViewSize : function() { 5440 var g = document, h = this.dom, c = (h == g || h == g.body); 5441 if (c) { 5442 var e = Ext.lib.Dom; 5443 return { 5444 width : e.getViewWidth(), 5445 height : e.getViewHeight() 5446 } 5447 } else { 5448 return { 5449 width : h.clientWidth, 5450 height : h.clientHeight 5451 } 5452 } 5453 }, 5454 getStyleSize : function() { 5455 var j = this, c, i, l = document, m = this.dom, e = (m == l || m == l.body), g = m.style; 5456 if (e) { 5457 var k = Ext.lib.Dom; 5458 return { 5459 width : k.getViewWidth(), 5460 height : k.getViewHeight() 5461 } 5462 } 5463 if (g.width && g.width != "auto") { 5464 c = parseFloat(g.width); 5465 if (j.isBorderBox()) { 5466 c -= j.getFrameWidth("lr") 5467 } 5468 } 5469 if (g.height && g.height != "auto") { 5470 i = parseFloat(g.height); 5471 if (j.isBorderBox()) { 5472 i -= j.getFrameWidth("tb") 5473 } 5474 } 5475 return { 5476 width : c || j.getWidth(true), 5477 height : i || j.getHeight(true) 5478 } 5479 }, 5480 getSize : function(c) { 5481 return { 5482 width : this.getWidth(c), 5483 height : this.getHeight(c) 5484 } 5485 }, 5486 repaint : function() { 5487 var c = this.dom; 5488 this.addClass("x-repaint"); 5489 setTimeout(function() { 5490 Ext.fly(c).removeClass("x-repaint") 5491 }, 1); 5492 return this 5493 }, 5494 unselectable : function() { 5495 this.dom.unselectable = "on"; 5496 return this 5497 .swallowEvent("selectstart", true) 5498 .applyStyles("-moz-user-select:none;-khtml-user-select:none;") 5499 .addClass("x-unselectable") 5500 }, 5501 getMargins : function(d) { 5502 var e = this, c, g = { 5503 t : "top", 5504 l : "left", 5505 r : "right", 5506 b : "bottom" 5507 }, h = {}; 5508 if (!d) { 5509 for (c in e.margins) { 5510 h[g[c]] = parseFloat(e.getStyle(e.margins[c])) || 0 5511 } 5512 return h 5513 } else { 5514 return e.addStyles.call(e, d, e.margins) 5515 } 5516 } 5517 } 5518}()); 5519Ext.Element.addMethods({ 5520 setBox : function(e, g, b) { 5521 var d = this, a = e.width, c = e.height; 5522 if ((g && !d.autoBoxAdjust) && !d.isBorderBox()) { 5523 a -= (d.getBorderWidth("lr") + d.getPadding("lr")); 5524 c -= (d.getBorderWidth("tb") + d.getPadding("tb")) 5525 } 5526 d.setBounds(e.x, e.y, a, c, d.animTest.call(d, arguments, b, 2)); 5527 return d 5528 }, 5529 getBox : function(j, p) { 5530 var m = this, v, e, o, d = m.getBorderWidth, q = m.getPadding, g, a, u, n; 5531 if (!p) { 5532 v = m.getXY() 5533 } else { 5534 e = parseInt(m.getStyle("left"), 10) || 0; 5535 o = parseInt(m.getStyle("top"), 10) || 0; 5536 v = [e, o] 5537 } 5538 var c = m.dom, s = c.offsetWidth, i = c.offsetHeight, k; 5539 if (!j) { 5540 k = { 5541 x : v[0], 5542 y : v[1], 5543 0 : v[0], 5544 1 : v[1], 5545 width : s, 5546 height : i 5547 } 5548 } else { 5549 g = d.call(m, "l") + q.call(m, "l"); 5550 a = d.call(m, "r") + q.call(m, "r"); 5551 u = d.call(m, "t") + q.call(m, "t"); 5552 n = d.call(m, "b") + q.call(m, "b"); 5553 k = { 5554 x : v[0] + g, 5555 y : v[1] + u, 5556 0 : v[0] + g, 5557 1 : v[1] + u, 5558 width : s - (g + a), 5559 height : i - (u + n) 5560 } 5561 } 5562 k.right = k.x + k.width; 5563 k.bottom = k.y + k.height; 5564 return k 5565 }, 5566 move : function(j, b, c) { 5567 var g = this, m = g.getXY(), k = m[0], i = m[1], d = [k - b, i], l = [ 5568 k + b, i], h = [k, i - b], a = [k, i + b], e = { 5569 l : d, 5570 left : d, 5571 r : l, 5572 right : l, 5573 t : h, 5574 top : h, 5575 up : h, 5576 b : a, 5577 bottom : a, 5578 down : a 5579 }; 5580 j = j.toLowerCase(); 5581 g.moveTo(e[j][0], e[j][1], g.animTest.call(g, arguments, c, 2)) 5582 }, 5583 setLeftTop : function(d, c) { 5584 var b = this, a = b.dom.style; 5585 a.left = b.addUnits(d); 5586 a.top = b.addUnits(c); 5587 return b 5588 }, 5589 getRegion : function() { 5590 return Ext.lib.Dom.getRegion(this.dom) 5591 }, 5592 setBounds : function(b, g, d, a, c) { 5593 var e = this; 5594 if (!c || !e.anim) { 5595 e.setSize(d, a); 5596 e.setLocation(b, g) 5597 } else { 5598 e.anim({ 5599 points : { 5600 to : [b, g] 5601 }, 5602 width : { 5603 to : e.adjustWidth(d) 5604 }, 5605 height : { 5606 to : e.adjustHeight(a) 5607 } 5608 }, e.preanim(arguments, 4), "motion") 5609 } 5610 return e 5611 }, 5612 setRegion : function(b, a) { 5613 return this.setBounds(b.left, b.top, b.right - b.left, 5614 b.bottom - b.top, this.animTest.call(this, arguments, a, 1)) 5615 } 5616}); 5617Ext.Element.addMethods({ 5618 scrollTo : function(b, d, a) { 5619 var e = /top/i.test(b), c = this, g = c.dom, h; 5620 if (!a || !c.anim) { 5621 h = "scroll" + (e ? "Top" : "Left"); 5622 g[h] = d 5623 } else { 5624 h = "scroll" + (e ? "Left" : "Top"); 5625 c.anim({ 5626 scroll : { 5627 to : e ? [g[h], d] : [d, g[h]] 5628 } 5629 }, c.preanim(arguments, 2), "scroll") 5630 } 5631 return c 5632 }, 5633 scrollIntoView : function(e, i) { 5634 var p = Ext.getDom(e) || Ext.getBody().dom, h = this.dom, g = this 5635 .getOffsetsTo(p), k = g[0] + p.scrollLeft, u = g[1] 5636 + p.scrollTop, q = u + h.offsetHeight, d = k + h.offsetWidth, a = p.clientHeight, m = parseInt( 5637 p.scrollTop, 10), s = parseInt(p.scrollLeft, 10), j = m + a, n = s 5638 + p.clientWidth; 5639 if (h.offsetHeight > a || u < m) { 5640 p.scrollTop = u 5641 } else { 5642 if (q > j) { 5643 p.scrollTop = q - a 5644 } 5645 } 5646 p.scrollTop = p.scrollTop; 5647 if (i !== false) { 5648 if (h.offsetWidth > p.clientWidth || k < s) { 5649 p.scrollLeft = k 5650 } else { 5651 if (d > n) { 5652 p.scrollLeft = d - p.clientWidth 5653 } 5654 } 5655 p.scrollLeft = p.scrollLeft 5656 } 5657 return this 5658 }, 5659 scrollChildIntoView : function(b, a) { 5660 Ext.fly(b, "_scrollChildIntoView").scrollIntoView(this, a) 5661 }, 5662 scroll : function(m, b, d) { 5663 if (!this.isScrollable()) { 5664 return false 5665 } 5666 var e = this.dom, g = e.scrollLeft, p = e.scrollTop, n = e.scrollWidth, k = e.scrollHeight, i = e.clientWidth, a = e.clientHeight, c = false, o, j = { 5667 l : Math.min(g + b, n - i), 5668 r : o = Math.max(g - b, 0), 5669 t : Math.max(p - b, 0), 5670 b : Math.min(p + b, k - a) 5671 }; 5672 j.d = j.b; 5673 j.u = j.t; 5674 m = m.substr(0, 1); 5675 if ((o = j[m]) > -1) { 5676 c = true; 5677 this.scrollTo(m == "l" || m == "r" ? "left" : "top", o, this 5678 .preanim(arguments, 2)) 5679 } 5680 return c 5681 } 5682}); 5683Ext.Element.addMethods(function() { 5684 var d = "visibility", b = "display", a = "hidden", h = "none", c = "x-masked", g = "x-masked-relative", e = Ext.Element.data; 5685 return { 5686 isVisible : function(i) { 5687 var j = !this.isStyle(d, a) && !this.isStyle(b, h), k = this.dom.parentNode; 5688 if (i !== true || !j) { 5689 return j 5690 } 5691 while (k && !(/^body/i.test(k.tagName))) { 5692 if (!Ext.fly(k, "_isVisible").isVisible()) { 5693 return false 5694 } 5695 k = k.parentNode 5696 } 5697 return true 5698 }, 5699 isDisplayed : function() { 5700 return !this.isStyle(b, h) 5701 }, 5702 enableDisplayMode : function(i) { 5703 this.setVisibilityMode(Ext.Element.DISPLAY); 5704 if (!Ext.isEmpty(i)) { 5705 e(this.dom, "originalDisplay", i) 5706 } 5707 return this 5708 }, 5709 mask : function(j, n) { 5710 var p = this, l = p.dom, o = Ext.DomHelper, m = "ext-el-mask-msg", i, q; 5711 if (!/^body/i.test(l.tagName) && p.getStyle("position") == "static") { 5712 p.addClass(g) 5713 } 5714 if (i = e(l, "maskMsg")) { 5715 i.remove() 5716 } 5717 if (i = e(l, "mask")) { 5718 i.remove() 5719 } 5720 q = o.append(l, { 5721 cls : "ext-el-mask" 5722 }, true); 5723 e(l, "mask", q); 5724 p.addClass(c); 5725 q.setDisplayed(true); 5726 if (typeof j == "string") { 5727 var k = o.append(l, { 5728 cls : m, 5729 cn : { 5730 tag : "div" 5731 } 5732 }, true); 5733 e(l, "maskMsg", k); 5734 k.dom.className = n ? m + " " + n : m; 5735 k.dom.firstChild.innerHTML = j; 5736 k.setDisplayed(true); 5737 k.center(p) 5738 } 5739 if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) 5740 && p.getStyle("height") == "auto") { 5741 q.setSize(undefined, p.getHeight()) 5742 } 5743 return q 5744 }, 5745 unmask : function() { 5746 var k = this, l = k.dom, i = e(l, "mask"), j = e(l, "maskMsg"); 5747 if (i) { 5748 if (j) { 5749 j.remove(); 5750 e(l, "maskMsg", undefined) 5751 } 5752 i.remove(); 5753 e(l, "mask", undefined); 5754 k.removeClass([c, g]) 5755 } 5756 }, 5757 isMasked : function() { 5758 var i = e(this.dom, "mask"); 5759 return i && i.isVisible() 5760 }, 5761 createShim : function() { 5762 var i = document.createElement("iframe"), j; 5763 i.frameBorder = "0"; 5764 i.className = "ext-shim"; 5765 i.src = Ext.SSL_SECURE_URL; 5766 j = Ext.get(this.dom.parentNode.insertBefore(i, this.dom)); 5767 j.autoBoxAdjust = false; 5768 return j 5769 } 5770 } 5771}()); 5772Ext.Element.addMethods({ 5773 addKeyListener : function(b, d, c) { 5774 var a; 5775 if (typeof b != "object" || Ext.isArray(b)) { 5776 a = { 5777 key : b, 5778 fn : d, 5779 scope : c 5780 } 5781 } else { 5782 a = { 5783 key : b.key, 5784 shift : b.shift,
5785 ctrl : b.ctrl, 5786 alt : b.alt, 5787 fn : d, 5788 scope : c 5789 } 5790 } 5791 return new Ext.KeyMap(this, a) 5792 }, 5793 addKeyMap : function(a) { 5794 return new Ext.KeyMap(this, a) 5795 } 5796 }); 5797Ext.CompositeElementLite.importElementMethods(); 5798Ext.apply(Ext.CompositeElementLite.prototype, { 5799 addElements : function(c, a) { 5800 if (!c) { 5801 return this 5802 } 5803 if (typeof c == "string") { 5804 c = Ext.Element.selectorFunction(c, a) 5805 } 5806 var b = this.elements; 5807 Ext.each(c, function(d) { 5808 b.push(Ext.get(d)) 5809 }); 5810 return this 5811 }, 5812 first : function() { 5813 return this.item(0) 5814 }, 5815 last : function() { 5816 return this.item(this.getCount() - 1) 5817 }, 5818 contains : function(a) { 5819 return this.indexOf(a) != -1 5820 }, 5821 removeElement : function(d, e) { 5822 var c = this, a = this.elements, b; 5823 Ext.each(d, function(g) { 5824 if ((b = (a[g] || a[g = c.indexOf(g)]))) { 5825 if (e) { 5826 if (b.dom) { 5827 b.remove() 5828 } else { 5829 Ext.removeNode(b) 5830 } 5831 } 5832 a.splice(g, 1) 5833 } 5834 }); 5835 return this 5836 } 5837 }); 5838Ext.CompositeElement = Ext.extend(Ext.CompositeElementLite, { 5839 constructor : function(b, a) { 5840 this.elements = []; 5841 this.add(b, a) 5842 }, 5843 getElement : function(a) { 5844 return a 5845 }, 5846 transformElement : function(a) { 5847 return Ext.get(a) 5848 } 5849 }); 5850Ext.Element.select = function(a, d, b) { 5851 var c; 5852 if (typeof a == "string") { 5853 c = Ext.Element.selectorFunction(a, b) 5854 } else { 5855 if (a.length !== undefined) { 5856 c = a 5857 } else { 5858 throw "Invalid selector" 5859 } 5860 } 5861 return (d === true) 5862 ? new Ext.CompositeElement(c) 5863 : new Ext.CompositeElementLite(c) 5864}; 5865Ext.select = Ext.Element.select; 5866Ext.UpdateManager = Ext.Updater = Ext.extend(Ext.util.Observable, function() { 5867 var b = "beforeupdate", d = "update", c = "failure"; 5868 function a(h) { 5869 var i = this; 5870 i.transaction = null; 5871 if (h.argument.form && h.argument.reset) { 5872 try { 5873 h.argument.form.reset() 5874 } catch (j) { 5875 } 5876 } 5877 if (i.loadScripts) { 5878 i.renderer.render(i.el, h, i, g.createDelegate(i, [h])) 5879 } else { 5880 i.renderer.render(i.el, h, i); 5881 g.call(i, h) 5882 } 5883 } 5884 function g(h, i, j) { 5885 this.fireEvent(i || d, this.el, h); 5886 if (Ext.isFunction(h.argument.callback)) { 5887 h.argument.callback.call(h.argument.scope, this.el, Ext.isEmpty(j) 5888 ? true 5889 : false, h, h.argument.options) 5890 } 5891 } 5892 function e(h) { 5893 g.call(this, h, c, !!(this.transaction = null)) 5894 } 5895 return { 5896 constructor : function(i, h) { 5897 var j = this; 5898 i = Ext.get(i); 5899 if (!h && i.updateManager) { 5900 return i.updateManager 5901 } 5902 j.el = i; 5903 j.defaultUrl = null; 5904 j.addEvents(b, d, c); 5905 Ext.apply(j, Ext.Updater.defaults); 5906 j.transaction = null; 5907 j.refreshDelegate = j.refresh.createDelegate(j); 5908 j.updateDelegate = j.update.createDelegate(j); 5909 j.formUpdateDelegate = (j.formUpdate || function() { 5910 }).createDelegate(j); 5911 j.renderer = j.renderer || j.getDefaultRenderer(); 5912 Ext.Updater.superclass.constructor.call(j) 5913 }, 5914 setRenderer : function(h) { 5915 this.renderer = h 5916 }, 5917 getRenderer : function() { 5918 return this.renderer 5919 }, 5920 getDefaultRenderer : function() { 5921 return new Ext.Updater.BasicRenderer() 5922 }, 5923 setDefaultUrl : function(h) { 5924 this.defaultUrl = h 5925 }, 5926 getEl : function() { 5927 return this.el 5928 }, 5929 update : function(i, n, p, l) { 5930 var k = this, h, j; 5931 if (k.fireEvent(b, k.el, i, n) !== false) { 5932 if (Ext.isObject(i)) { 5933 h = i; 5934 i = h.url; 5935 n = n || h.params; 5936 p = p || h.callback; 5937 l = l || h.discardUrl; 5938 j = h.scope; 5939 if (!Ext.isEmpty(h.nocache)) { 5940 k.disableCaching = h.nocache 5941 } 5942 if (!Ext.isEmpty(h.text)) { 5943 k.indicatorText = '<div class="loading-indicator">' 5944 + h.text + "</div>" 5945 } 5946 if (!Ext.isEmpty(h.scripts)) { 5947 k.loadScripts = h.scripts 5948 } 5949 if (!Ext.isEmpty(h.timeout)) { 5950 k.timeout = h.timeout 5951 } 5952 } 5953 k.showLoading(); 5954 if (!l) { 5955 k.defaultUrl = i 5956 } 5957 if (Ext.isFunction(i)) { 5958 i = i.call(k) 5959 } 5960 var m = Ext.apply({}, { 5961 url : i,
5962 params : (Ext.isFunction(n) && j) ? n.createDelegate(j) : n, 5963 success : a, 5964 failure : e, 5965 scope : k, 5966 callback : undefined, 5967 timeout : (k.timeout * 1000), 5968 disableCaching : k.disableCaching, 5969 argument : { 5970 options : h, 5971 url : i, 5972 form : null, 5973 callback : p, 5974 scope : j || window, 5975 params : n 5976 } 5977 }, h); 5978 k.transaction = Ext.Ajax.request(m) 5979 } 5980 }, 5981 formUpdate : function(k, h, j, l) { 5982 var i = this; 5983 if (i.fireEvent(b, i.el, k, h) !== false) { 5984 if (Ext.isFunction(h)) { 5985 h = h.call(i) 5986 } 5987 k = Ext.getDom(k); 5988 i.transaction = Ext.Ajax.request({ 5989 form : k, 5990 url : h, 5991 success : a, 5992 failure : e, 5993 scope : i, 5994 timeout : (i.timeout * 1000), 5995 argument : { 5996 url : h, 5997 form : k, 5998 callback : l, 5999 reset : j 6000 } 6001 }); 6002 i.showLoading.defer(1, i) 6003 } 6004 }, 6005 startAutoRefresh : function(i, j, l, m, h) { 6006 var k = this; 6007 if (h) { 6008 k.update(j || k.defaultUrl, l, m, true) 6009 } 6010 if (k.autoRefreshProcId) { 6011 clearInterval(k.autoRefreshProcId) 6012 } 6013 k.autoRefreshProcId = setInterval(k.update.createDelegate(k, [ 6014 j || k.defaultUrl, l, m, true]), i * 1000) 6015 }, 6016 stopAutoRefresh : function() { 6017 if (this.autoRefreshProcId) { 6018 clearInterval(this.autoRefreshProcId); 6019 delete this.autoRefreshProcId 6020 } 6021 }, 6022 isAutoRefreshing : function() { 6023 return !!this.autoRefreshProcId 6024 }, 6025 showLoading : function() { 6026 if (this.showLoadIndicator) { 6027 this.el.dom.innerHTML = this.indicatorText 6028 } 6029 }, 6030 abort : function() { 6031 if (this.transaction) { 6032 Ext.Ajax.abort(this.transaction) 6033 } 6034 }, 6035 isUpdating : function() { 6036 return this.transaction 6037 ? Ext.Ajax.isLoading(this.transaction) 6038 : false 6039 }, 6040 refresh : function(h) { 6041 if (this.defaultUrl) { 6042 this.update(this.defaultUrl, null, h, true) 6043 } 6044 } 6045 } 6046}()); 6047Ext.Updater.defaults = { 6048 timeout : 30, 6049 disableCaching : false, 6050 showLoadIndicator : true, 6051 indicatorText : '<div class="loading-indicator">Loading...</div>', 6052 loadScripts : false, 6053 sslBlankUrl : Ext.SSL_SECURE_URL 6054}; 6055Ext.Updater.updateElement = function(d, c, e, b) {
6056 var a = Ext.get(d).getUpdater(); 6057 Ext.apply(a, b); 6058 a.update(c, e, b ? b.callback : null) 6059}; 6060Ext.Updater.BasicRenderer = function() { 6061}; 6062Ext.Updater.BasicRenderer.prototype = { 6063 render : function(c, a, b, d) { 6064 c.update(a.responseText, b.loadScripts, d) 6065 } 6066}; 6067(function() { 6068 Date.useStrict = false; 6069 function b(d) { 6070 var c = Array.prototype.slice.call(arguments, 1); 6071 return d.replace(/\{(\d+)\}/g, function(e, g) { 6072 return c[g] 6073 }) 6074 } 6075 Date.formatCodeToRegex = function(d, c) { 6076 var e = Date.parseCodes[d]; 6077 if (e) { 6078 e = typeof e == "function" ? e() : e; 6079 Date.parseCodes[d] = e 6080 } 6081 return e ? Ext.applyIf({ 6082 c : e.c ? b(e.c, c || "{0}") : e.c 6083 }, e) : { 6084 g : 0, 6085 c : null, 6086 s : Ext.escapeRe(d) 6087 } 6088 }; 6089 var a = Date.formatCodeToRegex; 6090 Ext.apply(Date, { 6091 parseFunctions : { 6092 "M$" : function(d, c) { 6093 var e = new RegExp("\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/"); 6094 var g = (d || "").match(e); 6095 return g ? new Date(((g[1] || "") + g[2]) * 1) : null 6096 } 6097 }, 6098 parseRegexes : [], 6099 formatFunctions : { 6100 "M$" : function() { 6101 return "\\/Date(" + this.getTime() + ")\\/" 6102 } 6103 }, 6104 y2kYear : 50, 6105 MILLI : "ms", 6106 SECOND : "s", 6107 MINUTE : "mi", 6108 HOUR : "h", 6109 DAY : "d", 6110 MONTH : "mo", 6111 YEAR : "y", 6112 defaults : {}, 6113 dayNames : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", 6114 "Friday", "Saturday"], 6115 monthNames : ["January", "February", "March", "April", "May", "June",
6116 "July", "August", "September", "October", "November", 6117 "December"], 6118 monthNumbers : { 6119 Jan : 0, 6120 Feb : 1, 6121 Mar : 2, 6122 Apr : 3, 6123 May : 4, 6124 Jun : 5, 6125 Jul : 6, 6126 Aug : 7, 6127 Sep : 8, 6128 Oct : 9, 6129 Nov : 10, 6130 Dec : 11 6131 }, 6132 getShortMonthName : function(c) { 6133 return Date.monthNames[c].substring(0, 3) 6134 }, 6135 getShortDayName : function(c) { 6136 return Date.dayNames[c].substring(0, 3) 6137 }, 6138 getMonthNumber : function(c) { 6139 return Date.monthNumbers[c.substring(0, 1).toUpperCase() 6140 + c.substring(1, 3).toLowerCase()] 6141 }, 6142 formatContainsHourInfo : (function() { 6143 var d = /(\\.)/g, c = /([gGhHisucUOPZ]|M\$)/; 6144 return function(e) { 6145 return c.test(e.replace(d, "")) 6146 } 6147 })(), 6148 formatCodes : { 6149 d : "String.leftPad(this.getDate(), 2, '0')", 6150 D : "Date.getShortDayName(this.getDay())", 6151 j : "this.getDate()", 6152 l : "Date.dayNames[this.getDay()]", 6153 N : "(this.getDay() ? this.getDay() : 7)", 6154 S : "this.getSuffix()", 6155 w : "this.getDay()", 6156 z : "this.getDayOfYear()", 6157 W : "String.leftPad(this.getWeekOfYear(), 2, '0')", 6158 F : "Date.monthNames[this.getMonth()]", 6159 m : "String.leftPad(this.getMonth() + 1, 2, '0')", 6160 M : "Date.getShortMonthName(this.getMonth())", 6161 n : "(this.getMonth() + 1)", 6162 t : "this.getDaysInMonth()", 6163 L : "(this.isLeapYear() ? 1 : 0)", 6164 o : "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0)))", 6165 Y : "String.leftPad(this.getFullYear(), 4, '0')", 6166 y : "('' + this.getFullYear()).substring(2, 4)", 6167 a : "(this.getHours() < 12 ? 'am' : 'pm')", 6168 A : "(this.getHours() < 12 ? 'AM' : 'PM')", 6169 g : "((this.getHours() % 12) ? this.getHours() % 12 : 12)", 6170 G : "this.getHours()", 6171 h : "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')", 6172 H : "String.leftPad(this.getHours(), 2, '0')", 6173 i : "String.leftPad(this.getMinutes(), 2, '0')", 6174 s : "String.leftPad(this.getSeconds(), 2, '0')", 6175 u : "String.leftPad(this.getMilliseconds(), 3, '0')", 6176 O : "this.getGMTOffset()", 6177 P : "this.getGMTOffset(true)", 6178 T : "this.getTimezone()", 6179 Z : "(this.getTimezoneOffset() * -60)", 6180 c : function() { 6181 for (var k = "Y-m-dTH:i:sP", h = [], g = 0, d = k.length; g < d; ++g) { 6182 var j = k.charAt(g); 6183 h.push(j == "T" ? "'T'" : Date.getFormatCode(j)) 6184 } 6185 return h.join(" + ") 6186 }, 6187 U : "Math.round(this.getTime() / 1000)" 6188 }, 6189 isValid : function(o, c, n, k, g, j, e) { 6190 k = k || 0; 6191 g = g || 0; 6192 j = j || 0; 6193 e = e || 0; 6194 var l = new Date(o < 100 ? 100 : o, c - 1, n, k, g, j, e).add( 6195 Date.YEAR, o < 100 ? o - 100 : 0); 6196 return o == l.getFullYear() && c == l.getMonth() + 1 6197 && n == l.getDate() && k == l.getHours() 6198 && g == l.getMinutes() && j == l.getSeconds() 6199 && e == l.getMilliseconds() 6200 }, 6201 parseDate : function(d, g, c) { 6202 var e = Date.parseFunctions; 6203 if (e[g] == null) { 6204 Date.createParser(g) 6205 } 6206 return e[g](d, Ext.isDefined(c) ? c : Date.useStrict) 6207 }, 6208 getFormatCode : function(d) { 6209 var c = Date.formatCodes[d]; 6210 if (c) { 6211 c = typeof c == "function" ? c() : c; 6212 Date.formatCodes[d] = c 6213 } 6214 return c || ("'" + String.escape(d) + "'") 6215 }, 6216 createFormat : function(h) { 6217 var g = [], c = false, e = ""; 6218 for (var d = 0; d < h.length; ++d) { 6219 e = h.charAt(d); 6220 if (!c && e == "\\") { 6221 c = true 6222 } else { 6223 if (c) { 6224 c = false; 6225 g.push("'" + String.escape(e) + "'") 6226 } else { 6227 g.push(Date.getFormatCode(e)) 6228 } 6229 } 6230 } 6231 Date.formatFunctions[h] = new Function("return " + g.join("+")) 6232 }, 6233 createParser : function() { 6234 var c = [ 6235 "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,", 6236 "def = Date.defaults,", 6237 "results = String(input).match(Date.parseRegexes[{0}]);", 6238 "if(results){", 6239 "{1}", 6240 "if(u != null){", 6241 "v = new Date(u * 1000);", 6242 "}else{", 6243 "dt = (new Date()).clearTime();", 6244 "y = Ext.num(y, Ext.num(def.y, dt.getFullYear()));", 6245 "m = Ext.num(m, Ext.num(def.m - 1, dt.getMonth()));", 6246 "d = Ext.num(d, Ext.num(def.d, dt.getDate()));", 6247 "h = Ext.num(h, Ext.num(def.h, dt.getHours()));", 6248 "i = Ext.num(i, Ext.num(def.i, dt.getMinutes()));", 6249 "s = Ext.num(s, Ext.num(def.s, dt.getSeconds()));", 6250 "ms = Ext.num(ms, Ext.num(def.ms, dt.getMilliseconds()));", 6251 "if(z >= 0 && y >= 0){", 6252 "v = new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms).add(Date.YEAR, y < 100 ? y - 100 : 0);", 6253 "v = !strict? v : (strict === true && (z <= 364 || (v.isLeapYear() && z <= 365))? v.add(Date.DAY, z) : null);", 6254 "}else if(strict === true && !Date.isValid(y, m + 1, d, h, i, s, ms)){", 6255 "v = null;", 6256 "}else{", 6257 "v = new Date(y < 100 ? 100 : y, m, d, h, i, s, ms).add(Date.YEAR, y < 100 ? y - 100 : 0);", 6258 "}", 6259 "}", 6260 "}", 6261 "if(v){", 6262 "if(zz != null){", 6263 "v = v.add(Date.SECOND, -v.getTimezoneOffset() * 60 - zz);", 6264 "}else if(o){", 6265 "v = v.add(Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));", 6266 "}", "}", "return v;"].join("\n"); 6267 return function(m) { 6268 var e = Date.parseRegexes.length, o = 1, g = [], l = [], k = false, d = "", j = 0, h, n; 6269 for (; j < m.length; ++j) { 6270 d = m.charAt(j); 6271 if (!k && d == "\\") { 6272 k = true 6273 } else { 6274 if (k) { 6275 k = false; 6276 l.push(String.escape(d)) 6277 } else { 6278 h = a(d, o); 6279 o += h.g; 6280 l.push(h.s); 6281 if (h.g && h.c) { 6282 if (h.calcLast) { 6283 n = h.c 6284 } else { 6285 g.push(h.c) 6286 } 6287 } 6288 } 6289 } 6290 } 6291 if (n) { 6292 g.push(n) 6293 } 6294 Date.parseRegexes[e] = new RegExp("^" + l.join("") + "$", "i"); 6295 Date.parseFunctions[m] = new Function("input", "strict", b(c, 6296 e, g.join(""))) 6297 } 6298 }(), 6299 parseCodes : { 6300 d : { 6301 g : 1,
6302 c : "d = parseInt(results[{0}], 10);\n", 6303 s : "(\\d{2})" 6304 }, 6305 j : { 6306 g : 1, 6307 c : "d = parseInt(results[{0}], 10);\n", 6308 s : "(\\d{1,2})" 6309 }, 6310 D : function() { 6311 for (var c = [], d = 0; d < 7; c.push(Date.getShortDayName(d)), ++d) { 6312 } 6313 return { 6314 g : 0, 6315 c : null, 6316 s : "(?:" + c.join("|") + ")" 6317 } 6318 }, 6319 l : function() { 6320 return { 6321 g : 0, 6322 c : null, 6323 s : "(?:" + Date.dayNames.join("|") + ")" 6324 } 6325 }, 6326 N : { 6327 g : 0, 6328 c : null, 6329 s : "[1-7]" 6330 }, 6331 S : { 6332 g : 0, 6333 c : null, 6334 s : "(?:st|nd|rd|th)" 6335 }, 6336 w : { 6337 g : 0, 6338 c : null, 6339 s : "[0-6]" 6340 }, 6341 z : { 6342 g : 1, 6343 c : "z = parseInt(results[{0}], 10);\n", 6344 s : "(\\d{1,3})" 6345 }, 6346 W : { 6347 g : 0, 6348 c : null, 6349 s : "(?:\\d{2})" 6350 }, 6351 F : function() { 6352 return { 6353 g : 1, 6354 c : "m = parseInt(Date.getMonthNumber(results[{0}]), 10);\n", 6355 s : "(" + Date.monthNames.join("|") + ")" 6356 } 6357 }, 6358 M : function() { 6359 for (var c = [], d = 0; d < 12; c.push(Date 6360 .getShortMonthName(d)), ++d) { 6361 } 6362 return Ext.applyIf({ 6363 s : "(" + c.join("|") + ")" 6364 }, a("F")) 6365 }, 6366 m : { 6367 g : 1, 6368 c : "m = parseInt(results[{0}], 10) - 1;\n", 6369 s : "(\\d{2})" 6370 }, 6371 n : { 6372 g : 1, 6373 c : "m = parseInt(results[{0}], 10) - 1;\n", 6374 s : "(\\d{1,2})" 6375 }, 6376 t : { 6377 g : 0, 6378 c : null, 6379 s : "(?:\\d{2})" 6380 }, 6381 L : { 6382 g : 0, 6383 c : null, 6384 s : "(?:1|0)" 6385 }, 6386 o : function() { 6387 return a("Y") 6388 }, 6389 Y : { 6390 g : 1, 6391 c : "y = parseInt(results[{0}], 10);\n", 6392 s : "(\\d{4})" 6393 }, 6394 y : { 6395 g : 1, 6396 c : "var ty = parseInt(results[{0}], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", 6397 s : "(\\d{1,2})" 6398 }, 6399 a : function() { 6400 return a("A") 6401 }, 6402 A : { 6403 calcLast : true, 6404 g : 1, 6405 c : "if (/(am)/i.test(results[{0}])) {\nif (!h || h == 12) { h = 0; }\n} else { if (!h || h < 12) { h = (h || 0) + 12; }}", 6406 s : "(AM|PM|am|pm)" 6407 }, 6408 g : function() { 6409 return a("G") 6410 }, 6411 G : { 6412 g : 1, 6413 c : "h = parseInt(results[{0}], 10);\n", 6414 s : "(\\d{1,2})" 6415 }, 6416 h : function() { 6417 return a("H") 6418 }, 6419 H : { 6420 g : 1, 6421 c : "h = parseInt(results[{0}], 10);\n", 6422 s : "(\\d{2})" 6423 }, 6424 i : { 6425 g : 1, 6426 c : "i = parseInt(results[{0}], 10);\n", 6427 s : "(\\d{2})" 6428 }, 6429 s : { 6430 g : 1, 6431 c : "s = parseInt(results[{0}], 10);\n", 6432 s : "(\\d{2})" 6433 }, 6434 u : { 6435 g : 1, 6436 c : "ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n", 6437 s : "(\\d+)" 6438 }, 6439 O : { 6440 g : 1, 6441 c : [ 6442 "o = results[{0}];", 6443 "var sn = o.substring(0,1),", 6444 "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),", 6445 "mn = o.substring(3,5) % 60;", 6446 "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"] 6447 .join("\n"), 6448 s : "([+-]\\d{4})" 6449 }, 6450 P : { 6451 g : 1, 6452 c : [ 6453 "o = results[{0}];", 6454 "var sn = o.substring(0,1),", 6455 "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),", 6456 "mn = o.substring(4,6) % 60;", 6457 "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"] 6458 .join("\n"), 6459 s : "([+-]\\d{2}:\\d{2})" 6460 }, 6461 T : { 6462 g : 0, 6463 c : null, 6464 s : "[A-Z]{1,4}" 6465 }, 6466 Z : { 6467 g : 1, 6468 c : "zz = results[{0}] * 1;\nzz = (-43200 <= zz && zz <= 50400)? zz : null;\n", 6469 s : "([+-]?\\d{1,5})" 6470 }, 6471 c : function() { 6472 var e = [], c = [a("Y", 1), a("m", 2), a("d", 3), a("h", 4), 6473 a("i", 5), a("s", 6), { 6474 c : "ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n" 6475 }, { 6476 c : ["if(results[8]) {", "if(results[8] == 'Z'){", 6477 "zz = 0;", 6478 "}else if (results[8].indexOf(':') > -1){", 6479 a("P", 8).c, "}else{", a("O", 8).c, "}", 6480 "}"].join("\n") 6481 }]; 6482 for (var g = 0, d = c.length; g < d; ++g) { 6483 e.push(c[g].c) 6484 } 6485 return { 6486 g : 1, 6487 c : e.join(""), 6488 s : [c[0].s, "(?:", "-", c[1].s, "(?:", "-", c[2].s, "(?:", 6489 "(?:T| )?", c[3].s, ":", c[4].s, "(?::", c[5].s, 6490 ")?", "(?:(?:\\.|,)(\\d+))?", 6491 "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?", ")?", ")?", ")?"] 6492 .join("") 6493 } 6494 }, 6495 U : { 6496 g : 1, 6497 c : "u = parseInt(results[{0}], 10);\n", 6498 s : "(-?\\d+)" 6499 } 6500 } 6501 }) 6502}()); 6503Ext.apply(Date.prototype, { 6504 dateFormat : function(a) { 6505 if (Date.formatFunctions[a] == null) { 6506 Date.createFormat(a) 6507 } 6508 return Date.formatFunctions[a].call(this) 6509 }, 6510 getTimezone : function() { 6511 return this.toString().replace( 6512 /^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, 6513 "$1$2").replace(/[^A-Z]/g, "") 6514 }, 6515 getGMTOffset : function(a) { 6516 return (this.getTimezoneOffset() > 0 ? "-" : "+") 6517 + String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset()) 6518 / 60), 2, "0") 6519 + (a ? ":" : "") 6520 + String.leftPad(Math.abs(this.getTimezoneOffset() % 60), 2, 6521 "0") 6522 }, 6523 getDayOfYear : function() { 6524 var b = 0, e = this.clone(), a = this.getMonth(), c; 6525 for (c = 0, e.setDate(1), e.setMonth(0); c < a; e.setMonth(++c)) { 6526 b += e.getDaysInMonth() 6527 } 6528 return b + this.getDate() - 1 6529 }, 6530 getWeekOfYear : function() { 6531 var a = 86400000, b = 7 * a; 6532 return function() { 6533 var d = Date.UTC(this.getFullYear(), this.getMonth(), this 6534 .getDate() 6535 + 3) 6536 / a, c = Math.floor(d / 7), e = new Date(c * b) 6537 .getUTCFullYear(); 6538 return c - Math.floor(Date.UTC(e, 0, 7) / b) + 1 6539 } 6540 }(), 6541 isLeapYear : function() { 6542 var a = this.getFullYear(); 6543 return !!((a & 3) == 0 && (a % 100 || (a % 400 == 0 && a))) 6544 }, 6545 getFirstDayOfMonth : function() { 6546 var a = (this.getDay() - (this.getDate() - 1)) % 7; 6547 return (a < 0) ? (a + 7) : a 6548 }, 6549 getLastDayOfMonth : function() { 6550 return this.getLastDateOfMonth().getDay() 6551 }, 6552 getFirstDateOfMonth : function() { 6553 return new Date(this.getFullYear(), this.getMonth(), 1) 6554 }, 6555 getLastDateOfMonth : function() { 6556 return new Date(this.getFullYear(), this.getMonth(), this 6557 .getDaysInMonth()) 6558 }, 6559 getDaysInMonth : function() { 6560 var a = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 6561 return function() { 6562 var b = this.getMonth(); 6563 return b == 1 && this.isLeapYear() ? 29 : a[b] 6564 } 6565 }(), 6566 getSuffix : function() { 6567 switch (this.getDate()) { 6568 case 1 : 6569 case 21 : 6570 case 31 : 6571 return "st"; 6572 case 2 : 6573 case 22 : 6574 return "nd"; 6575 case 3 : 6576 case 23 : 6577 return "rd"; 6578 default : 6579 return "th" 6580 } 6581 }, 6582 clone : function() { 6583 return new Date(this.getTime()) 6584 }, 6585 isDST : function() { 6586 return new Date(this.getFullYear(), 0, 1).getTimezoneOffset() != this 6587 .getTimezoneOffset() 6588 }, 6589 clearTime : function(g) { 6590 if (g) { 6591 return this.clone().clearTime() 6592 } 6593 var b = this.getDate(); 6594 this.setHours(0); 6595 this.setMinutes(0); 6596 this.setSeconds(0); 6597 this.setMilliseconds(0); 6598 if (this.getDate() != b) { 6599 for (var a = 1, e = this.add(Date.HOUR, a); e.getDate() != b; a++, e = this 6600 .add(Date.HOUR, a)) { 6601 } 6602 this.setDate(b); 6603 this.setHours(e.getHours()) 6604 } 6605 return this 6606 }, 6607 add : function(b, c) { 6608 var e = this.clone(); 6609 if (!b || c === 0) { 6610 return e 6611 } 6612 switch (b.toLowerCase()) { 6613 case Date.MILLI : 6614 e.setMilliseconds(this.getMilliseconds() + c); 6615 break; 6616 case Date.SECOND : 6617 e.setSeconds(this.getSeconds() + c); 6618 break; 6619 case Date.MINUTE : 6620 e.setMinutes(this.getMinutes() + c); 6621 break; 6622 case Date.HOUR : 6623 e.setHours(this.getHours() + c); 6624 break; 6625 case Date.DAY : 6626 e.setDate(this.getDate() + c); 6627 break; 6628 case Date.MONTH : 6629 var a = this.getDate(); 6630 if (a > 28) { 6631 a = Math.min(a, this.getFirstDateOfMonth().add("mo", c) 6632 .getLastDateOfMonth().getDate()) 6633 } 6634 e.setDate(a); 6635 e.setMonth(this.getMonth() + c); 6636 break; 6637 case Date.YEAR : 6638 e.setFullYear(this.getFullYear() + c); 6639 break 6640 } 6641 return e 6642 }, 6643 between : function(c, a) { 6644 var b = this.getTime(); 6645 return c.getTime() <= b && b <= a.getTime() 6646 } 6647}); 6648Date.prototype.format = Date.prototype.dateFormat; 6649if (Ext.isSafari 6650 && (navigator.userAgent.match(/WebKit\/(\d+)/)[1] || NaN) < 420) { 6651 Ext.apply(Date.prototype, { 6652 _xMonth : Date.prototype.setMonth, 6653 _xDate : Date.prototype.setDate, 6654 setMonth : function(a) { 6655 if (a <= -1) { 6656 var d = Math.ceil(-a), c = Math.ceil(d / 12), b = (d % 12) 6657 ? 12 - d % 12 6658 : 0; 6659 this.setFullYear(this.getFullYear() - c); 6660 return this._xMonth(b) 6661 } else { 6662 return this._xMonth(a) 6663 } 6664 }, 6665 setDate : function(a) { 6666 return this.setTime(this.getTime() - (this.getDate() - a) 6667 * 86400000) 6668 } 6669 }) 6670} 6671Ext.util.MixedCollection = function(b, a) { 6672 this.items = []; 6673 this.map = {}; 6674 this.keys = []; 6675 this.length = 0; 6676 this.addEvents("clear", "add", "replace", "remove", "sort"); 6677 this.allowFunctions = b === true; 6678 if (a) { 6679 this.getKey = a 6680 } 6681 Ext.util.MixedCollection.superclass.constructor.call(this) 6682}; 6683Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, { 6684 allowFunctions : false, 6685 add : function(b, c) { 6686 if (arguments.length == 1) { 6687 c = arguments[0]; 6688 b = this.getKey(c) 6689 } 6690 if (typeof b != "undefined" && b !== null) { 6691 var a = this.map[b]; 6692 if (typeof a != "undefined") { 6693 return this.replace(b, c) 6694 } 6695 this.map[b] = c 6696 } 6697 this.length++; 6698 this.items.push(c); 6699 this.keys.push(b); 6700 this.fireEvent("add", this.length - 1, c, b); 6701 return c 6702 }, 6703 getKey : function(a) { 6704 return a.id 6705 }, 6706 replace : function(c, d) { 6707 if (arguments.length == 1) { 6708 d = arguments[0]; 6709 c = this.getKey(d) 6710 } 6711 var a = this.map[c]; 6712 if (typeof c == "undefined" || c === null || typeof a == "undefined") { 6713 return this.add(c, d) 6714 } 6715 var b = this.indexOfKey(c); 6716 this.items[b] = d; 6717 this.map[c] = d; 6718 this.fireEvent("replace", c, a, d); 6719 return d 6720 }, 6721 addAll : function(e) { 6722 if (arguments.length > 1 || Ext.isArray(e)) { 6723 var b = arguments.length > 1 ? arguments : e; 6724 for (var d = 0, a = b.length; d < a; d++) { 6725 this.add(b[d]) 6726 } 6727 } else { 6728 for (var c in e) { 6729 if (this.allowFunctions || typeof e[c] != "function") { 6730 this.add(c, e[c]) 6731 } 6732 } 6733 } 6734 }, 6735 each : function(e, d) { 6736 var b = [].concat(this.items); 6737 for (var c = 0, a = b.length; c < a; c++) { 6738 if (e.call(d || b[c], b[c], c, a) === false) { 6739 break 6740 } 6741 } 6742 }, 6743 eachKey : function(d, c) { 6744 for (var b = 0, a = this.keys.length; b < a; b++) { 6745 d.call(c || window, this.keys[b], this.items[b], b, a) 6746 } 6747 }, 6748 find : function(d, c) { 6749 for (var b = 0, a = this.items.length; b < a; b++) { 6750 if (d.call(c || window, this.items[b], this.keys[b])) { 6751 return this.items[b] 6752 } 6753 } 6754 return null 6755 }, 6756 insert : function(a, b, c) { 6757 if (arguments.length == 2) { 6758 c = arguments[1]; 6759 b = this.getKey(c) 6760 } 6761 if (this.containsKey(b)) { 6762 this.suspendEvents(); 6763 this.removeKey(b); 6764 this.resumeEvents() 6765 } 6766 if (a >= this.length) { 6767 return this.add(b, c) 6768 } 6769 this.length++; 6770 this.items.splice(a, 0, c); 6771 if (typeof b != "undefined" && b !== null) { 6772 this.map[b] = c 6773 } 6774 this.keys.splice(a, 0, b); 6775 this.fireEvent("add", a, c, b); 6776 return c 6777 }, 6778 remove : function(a) { 6779 return this.removeAt(this.indexOf(a)) 6780 }, 6781 removeAt : function(a) { 6782 if (a < this.length && a >= 0) { 6783 this.length--; 6784 var c = this.items[a]; 6785 this.items.splice(a, 1); 6786 var b = this.keys[a]; 6787 if (typeof b != "undefined") { 6788 delete this.map[b] 6789 } 6790 this.keys.splice(a, 1); 6791 this.fireEvent("remove", c, b); 6792 return c 6793 } 6794 return false 6795 }, 6796 removeKey : function(a) { 6797 return this.removeAt(this.indexOfKey(a)) 6798 }, 6799 getCount : function() { 6800 return this.length 6801 }, 6802 indexOf : function(a) { 6803 return this.items.indexOf(a) 6804 }, 6805 indexOfKey : function(a) { 6806 return this.keys.indexOf(a) 6807 }, 6808 item : function(b) { 6809 var a = this.map[b], c = a !== undefined ? a : (typeof b == "number") 6810 ? this.items[b] 6811 : undefined; 6812 return typeof c != "function" || this.allowFunctions ? c : null 6813 }, 6814 itemAt : function(a) { 6815 return this.items[a] 6816 }, 6817 key : function(a) { 6818 return this.map[a] 6819 }, 6820 contains : function(a) { 6821 return this.indexOf(a) != -1 6822 }, 6823 containsKey : function(a) { 6824 return typeof this.map[a] != "undefined" 6825 }, 6826 clear : function() { 6827 this.length = 0; 6828 this.items = []; 6829 this.keys = []; 6830 this.map = {}; 6831 this.fireEvent("clear") 6832 }, 6833 first : function() { 6834 return this.items[0] 6835 }, 6836 last : function() { 6837 return this.items[this.length - 1] 6838 }, 6839 _sort : function(k, a, j) { 6840 var d, e, b = String(a).toUpperCase() == "DESC" ? -1 : 1, h = [], l = this.keys, g = this.items; 6841 j = j || function(i, c) { 6842 return i - c 6843 }; 6844 for (d = 0, e = g.length; d < e; d++) { 6845 h[h.length] = { 6846 key : l[d], 6847 value : g[d], 6848 index : d 6849 } 6850 } 6851 h.sort(function(i, c) { 6852 var m = j(i[k], c[k]) * b; 6853 if (m === 0) { 6854 m = (i.index < c.index ? -1 : 1) 6855 } 6856 return m 6857 }); 6858 for (d = 0, e = h.length; d < e; d++) { 6859 g[d] = h[d].value; 6860 l[d] = h[d].key 6861 } 6862 this.fireEvent("sort", this) 6863 }, 6864 sort : function(a, b) { 6865 this._sort("value", a, b) 6866 }, 6867 reorder : function(d) { 6868 this.suspendEvents(); 6869 var b = this.items, c = 0, g = b.length, a = [], e = [], h; 6870 for (h in d) { 6871 a[d[h]] = b[h] 6872 } 6873 for (c = 0; c < g; c++) { 6874 if (d[c] == undefined) { 6875 e.push(b[c]) 6876 } 6877 } 6878 for (c = 0; c < g; c++) { 6879 if (a[c] == undefined) { 6880 a[c] = e.shift() 6881 } 6882 } 6883 this.clear();
6884 this.addAll(a); 6885 this.resumeEvents(); 6886 this.fireEvent("sort", this) 6887 }, 6888 keySort : function(a, b) { 6889 this._sort("key", a, b || function(d, c) { 6890 var g = String(d).toUpperCase(), e = String(c) 6891 .toUpperCase(); 6892 return g > e ? 1 : (g < e ? -1 : 0) 6893 }) 6894 }, 6895 getRange : function(e, a) { 6896 var b = this.items; 6897 if (b.length < 1) { 6898 return [] 6899 } 6900 e = e || 0; 6901 a = Math.min(typeof a == "undefined" ? this.length - 1 : a, this.length 6902 - 1); 6903 var c, d = []; 6904 if (e <= a) { 6905 for (c = e; c <= a; c++) { 6906 d[d.length] = b[c] 6907 } 6908 } else { 6909 for (c = e; c >= a; c--) { 6910 d[d.length] = b[c] 6911 } 6912 } 6913 return d 6914 }, 6915 filter : function(c, b, d, a) { 6916 if (Ext.isEmpty(b, false)) { 6917 return this.clone() 6918 } 6919 b = this.createValueMatcher(b, d, a); 6920 return this.filterBy(function(e) { 6921 return e && b.test(e[c]) 6922 }) 6923 }, 6924 filterBy : function(g, e) { 6925 var h = new Ext.util.MixedCollection(); 6926 h.getKey = this.getKey; 6927 var b = this.keys, d = this.items; 6928 for (var c = 0, a = d.length; c < a; c++) { 6929 if (g.call(e || this, d[c], b[c])) { 6930 h.add(b[c], d[c]) 6931 } 6932 } 6933 return h 6934 }, 6935 findIndex : function(c, b, e, d, a) { 6936 if (Ext.isEmpty(b, false)) { 6937 return -1 6938 } 6939 b = this.createValueMatcher(b, d, a); 6940 return this.findIndexBy(function(g) { 6941 return g && b.test(g[c]) 6942 }, null, e) 6943 }, 6944 findIndexBy : function(g, e, h) { 6945 var b = this.keys, d = this.items; 6946 for (var c = (h || 0), a = d.length; c < a; c++) { 6947 if (g.call(e || this, d[c], b[c])) { 6948 return c 6949 } 6950 } 6951 return -1 6952 }, 6953 createValueMatcher : function(c, e, a, b) { 6954 if (!c.exec) { 6955 var d = Ext.escapeRe; 6956 c = String(c); 6957 if (e === true) { 6958 c = d(c) 6959 } else { 6960 c = "^" + d(c); 6961 if (b === true) { 6962 c += "$" 6963 } 6964 } 6965 c = new RegExp(c, a ? "" : "i") 6966 } 6967 return c 6968 }, 6969 clone : function() { 6970 var e = new Ext.util.MixedCollection(); 6971 var b = this.keys, d = this.items; 6972 for (var c = 0, a = d.length; c < a; c++) { 6973 e.add(b[c], d[c]) 6974 } 6975 e.getKey = this.getKey; 6976 return e 6977 } 6978}); 6979Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item; 6980Ext.AbstractManager = Ext.extend(Object, { 6981 typeName : "type", 6982 constructor : function(a) { 6983 Ext.apply(this, a || {}); 6984 this.all = new Ext.util.MixedCollection(); 6985 this.types = {} 6986 }, 6987 get : function(a) { 6988 return this.all.get(a) 6989 }, 6990 register : function(a) { 6991 this.all.add(a) 6992 }, 6993 unregister : function(a) { 6994 this.all.remove(a) 6995 }, 6996 registerType : function(b, a) { 6997 this.types[b] = a; 6998 a[this.typeName] = b 6999 }, 7000 isRegistered : function(a) { 7001 return this.types[a] !== undefined 7002 }, 7003 create : function(a, d) { 7004 var b = a[this.typeName] || a.type || d, c = this.types[b]; 7005 if (c == undefined) { 7006 throw new Error(String 7007 .format( 7008 "The '{0}' type has not been registered with this manager", 7009 b)) 7010 } 7011 return new c(a) 7012 }, 7013 onAvailable : function(d, c, b) { 7014 var a = this.all; 7015 a.on("add", function(e, g) { 7016 if (g.id == d) { 7017 c.call(b || g, g); 7018 a.un("add", c, b) 7019 } 7020 }) 7021 } 7022 }); 7023Ext.util.Format = function() { 7024 var trimRe = /^\s+|\s+$/g, stripTagsRE = /<\/?[^>]+>/gi, stripScriptsRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, nl2brRe = /\r?\n/g; 7025 return { 7026 ellipsis : function(value, len, word) { 7027 if (value && value.length > len) { 7028 if (word) { 7029 var vs = value.substr(0, len - 2), index = Math.max(vs 7030 .lastIndexOf(" "), vs.lastIndexOf("."), vs 7031 .lastIndexOf("!"), vs.lastIndexOf("?")); 7032 if (index == -1 || index < (len - 15)) { 7033 return value.substr(0, len - 3) + "..." 7034 } else { 7035 return vs.substr(0, index) + "..." 7036 } 7037 } else { 7038 return value.substr(0, len - 3) + "..." 7039 } 7040 } 7041 return value 7042 }, 7043 undef : function(value) { 7044 return value !== undefined ? value : "" 7045 }, 7046 defaultValue : function(value, defaultValue) { 7047 return value !== undefined && value !== "" ? value : defaultValue 7048 }, 7049 htmlEncode : function(value) { 7050 return !value ? value : String(value).replace(/&/g, "&") 7051 .replace(/>/g, ">").replace(/</g, "<").replace(/"/g, 7052 """) 7053 }, 7054 htmlDecode : function(value) { 7055 return !value ? value : String(value).replace(/>/g, ">") 7056 .replace(/</g, "<").replace(/"/g, '"').replace( 7057 /&/g, "&") 7058 }, 7059 trim : function(value) { 7060 return String(value).replace(trimRe, "") 7061 }, 7062 substr : function(value, start, length) { 7063 return String(value).substr(start, length) 7064 }, 7065 lowercase : function(value) { 7066 return String(value).toLowerCase() 7067 }, 7068 uppercase : function(value) { 7069 return String(value).toUpperCase() 7070 }, 7071 capitalize : function(value) { 7072 return !value ? value : value.charAt(0).toUpperCase() 7073 + value.substr(1).toLowerCase() 7074 }, 7075 call : function(value, fn) { 7076 if (arguments.length > 2) { 7077 var args = Array.prototype.slice.call(arguments, 2); 7078 args.unshift(value); 7079 return eval(fn).apply(window, args) 7080 } else { 7081 return eval(fn).call(window, value) 7082 } 7083 }, 7084 usMoney : function(v) { 7085 v = (Math.round((v - 0) * 100)) / 100; 7086 v = (v == Math.floor(v)) ? v + ".00" : ((v * 10 == Math.floor(v 7087 * 10)) ? v + "0" : v); 7088 v = String(v); 7089 var ps = v.split("."), whole = ps[0], sub = ps[1] 7090 ? "." + ps[1] 7091 : ".00", r = /(\d+)(\d{3})/; 7092 while (r.test(whole)) { 7093 whole = whole.replace(r, "$1,$2") 7094 } 7095 v = whole + sub; 7096 if (v.charAt(0) == "-") { 7097 return "-$" + v.substr(1) 7098 } 7099 return "$" + v 7100 }, 7101 date : function(v, format) { 7102 if (!v) { 7103 return "" 7104 } 7105 if (!Ext.isDate(v)) { 7106 v = new Date(Date.parse(v)) 7107 } 7108 return v.dateFormat(format || "m/d/Y") 7109 }, 7110 dateRenderer : function(format) { 7111 return function(v) { 7112 return Ext.util.Format.date(v, format) 7113 } 7114 }, 7115 stripTags : function(v) { 7116 return !v ? v : String(v).replace(stripTagsRE, "") 7117 }, 7118 stripScripts : function(v) { 7119 return !v ? v : String(v).replace(stripScriptsRe, "") 7120 }, 7121 fileSize : function(size) { 7122 if (size < 1024) { 7123 return size + "bytes" 7124 } else { 7125 if (size < 1048576) { 7126 return (Math.round(((size * 10) / 1024)) / 10) + "KB" 7127 } else if (size < 1073741824) { 7128 return (Math.round(((size * 10) / 1048576)) / 10) + "MB" 7129 } else { 7130 return (Math.round(((size * 10) / 1073741824)) / 10) + "GB" 7131 } 7132 } 7133 }, 7134 math : function() { 7135 var fns = {}; 7136 return function(v, a) { 7137 if (!fns[a]) { 7138 fns[a] = new Function("v", "return v " + a + ";") 7139 } 7140 return fns[a](v) 7141 } 7142 }(), 7143 round : function(value, precision) { 7144 var result = Number(value); 7145 if (typeof precision == "number") { 7146 precision = Math.pow(10, precision); 7147 result = Math.round(value * precision) / precision 7148 } 7149 return result 7150 }, 7151 number : function(v, format) { 7152 if (!format) { 7153 return v 7154 } 7155 v = Ext.num(v, NaN); 7156 if (isNaN(v)) { 7157 return "" 7158 } 7159 var comma = ",", dec = ".", i18n = false, neg = v < 0; 7160 v = Math.abs(v); 7161 if (format.substr(format.length - 2) == "/i") { 7162 format = format.substr(0, format.length - 2); 7163 i18n = true; 7164 comma = "."; 7165 dec = "," 7166 } 7167 var hasComma = format.indexOf(comma) != -1, psplit = (i18n ? format 7168 .replace(/[^\d\,]/g, "") : format.replace(/[^\d\.]/g, "")) 7169 .split(dec); 7170 if (1 < psplit.length) { 7171 v = v.toFixed(psplit[1].length) 7172 } else { 7173 if (2 < psplit.length) {
7174 throw ("NumberFormatException: invalid format, formats should have no more than 1 period: " + format) 7175 } else { 7176 v = v.toFixed(0) 7177 } 7178 } 7179 var fnum = v.toString(); 7180 psplit = fnum.split("."); 7181 if (hasComma) { 7182 var cnum = psplit[0], parr = [], j = cnum.length, m = Math 7183 .floor(j / 3), n = cnum.length % 3 || 3, i; 7184 for (i = 0; i < j; i += n) { 7185 if (i != 0) { 7186 n = 3 7187 } 7188 parr[parr.length] = cnum.substr(i, n); 7189 m -= 1 7190 } 7191 fnum = parr.join(comma); 7192 if (psplit[1]) { 7193 fnum += dec + psplit[1] 7194 } 7195 } else { 7196 if (psplit[1]) { 7197 fnum = psplit[0] + dec + psplit[1] 7198 } 7199 } 7200 return (neg ? "-" : "") + format.replace(/[\d,?\.?]+/, fnum) 7201 }, 7202 numberRenderer : function(format) { 7203 return function(v) { 7204 return Ext.util.Format.number(v, format) 7205 } 7206 }, 7207 plural : function(v, s, p) { 7208 return v + " " + (v == 1 ? s : (p ? p : s + "s")) 7209 }, 7210 nl2br : function(v) { 7211 return Ext.isEmpty(v) ? "" : v.replace(nl2brRe, "<br/>") 7212 } 7213 } 7214}(); 7215Ext.XTemplate = function() { 7216 Ext.XTemplate.superclass.constructor.apply(this, arguments); 7217 var y = this, j = y.html, q = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/, d = /^<tpl\b[^>]*?for="(.*?)"/, v = /^<tpl\b[^>]*?if="(.*?)"/, x = /^<tpl\b[^>]*?exec="(.*?)"/, r, p = 0, k = [], o = "values", w = "parent", l = "xindex", n = "xcount", e = "return ", c = "with(values){ "; 7218 j = ["<tpl>", j, "</tpl>"].join(""); 7219 while ((r = j.match(q))) { 7220 var b = r[0].match(d), a = r[0].match(v), A = r[0].match(x), g = null, h = null, t = null, z = b 7221 && b[1] ? b[1] : ""; 7222 if (a) { 7223 g = a && a[1] ? a[1] : null; 7224 if (g) { 7225 h = new Function(o, w, l, n, c + e 7226 + (Ext.util.Format.htmlDecode(g)) + "; }") 7227 } 7228 } 7229 if (A) { 7230 g = A && A[1] ? A[1] : null; 7231 if (g) { 7232 t = new Function(o, w, l, n, c 7233 + (Ext.util.Format.htmlDecode(g)) + "; }") 7234 } 7235 } 7236 if (z) { 7237 switch (z) { 7238 case "." : 7239 z = new Function(o, w, c + e + o + "; }"); 7240 break; 7241 case ".." : 7242 z = new Function(o, w, c + e + w + "; }"); 7243 break; 7244 default : 7245 z = new Function(o, w, c + e + z + "; }") 7246 } 7247 } 7248 k.push({ 7249 id : p, 7250 target : z, 7251 exec : t, 7252 test : h, 7253 body : r[1] || "" 7254 }); 7255 j = j.replace(r[0], "{xtpl" + p + "}"); 7256 ++p 7257 } 7258 for (var u = k.length - 1; u >= 0; --u) { 7259 y.compileTpl(k[u]) 7260 } 7261 y.master = k[k.length - 1]; 7262 y.tpls = k 7263}; 7264Ext.extend(Ext.XTemplate, Ext.Template, { 7265 re : /\{([\w\-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g, 7266 codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g, 7267 applySubTemplate : function(a, k, j, d, c) { 7268 var h = this, g, m = h.tpls[a], l, b = []; 7269 if ((m.test && !m.test.call(h, k, j, d, c)) 7270 || (m.exec && m.exec.call(h, k, j, d, c))) { 7271 return "" 7272 } 7273 l = m.target ? m.target.call(h, k, j) : k; 7274 g = l.length; 7275 j = m.target ? k : j; 7276 if (m.target && Ext.isArray(l)) { 7277 for (var e = 0, g = l.length; e < g; e++) { 7278 b[b.length] = m.compiled.call(h, l[e], j, e + 1, g) 7279 } 7280 return b.join("") 7281 } 7282 return m.compiled.call(h, l, j, d, c) 7283 }, 7284 compileTpl : function(tpl) { 7285 var fm = Ext.util.Format, useF = this.disableFormats !== true, sep = Ext.isGecko 7286 ? "+" 7287 : ",", body; 7288 function fn(m, name, format, args, math) { 7289 if (name.substr(0, 4) == "xtpl") { 7290 return "'" + sep + "this.applySubTemplate(" + name.substr(4) 7291 + ", values, parent, xindex, xcount)" + sep + "'" 7292 } 7293 var v; 7294 if (name === ".") { 7295 v = "values" 7296 } else { 7297 if (name === "#") { 7298 v = "xindex" 7299 } else { 7300 if (name.indexOf(".") != -1) { 7301 v = name 7302 } else { 7303 v = "values['" + name + "']" 7304 } 7305 } 7306 } 7307 if (math) { 7308 v = "(" + v + math + ")" 7309 } 7310 if (format && useF) { 7311 args = args ? "," + args : ""; 7312 if (format.substr(0, 5) != "this.") { 7313 format = "fm." + format + "(" 7314 } else { 7315 format = 'this.call("' + format.substr(5) + '", '; 7316 args = ", values" 7317 } 7318 } else { 7319 args = ""; 7320 format = "(" + v + " === undefined ? '' : " 7321 } 7322 return "'" + sep + format + v + args + ")" + sep + "'" 7323 } 7324 function codeFn(m, code) { 7325 return "'" + sep + "(" + code.replace(/\\'/g, "'") + ")" + sep 7326 + "'" 7327 } 7328 if (Ext.isGecko) { 7329 body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" 7330 + tpl.body.replace(/(\r\n|\n)/g, "\\n") 7331 .replace(/'/g, "\\'").replace(this.re, fn).replace( 7332 this.codeRe, codeFn) + "';};" 7333 } else { 7334 body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"]; 7335 body.push(tpl.body.replace(/(\r\n|\n)/g, "\\n") 7336 .replace(/'/g, "\\'").replace(this.re, fn).replace( 7337 this.codeRe, codeFn)); 7338 body.push("'].join('');};"); 7339 body = body.join("") 7340 } 7341 eval(body); 7342 return this 7343 }, 7344 applyTemplate : function(a) { 7345 return this.master.compiled.call(this, a, {}, 1, 1) 7346 }, 7347 compile : function() { 7348 return this 7349 } 7350}); 7351Ext.XTemplate.prototype.apply = Ext.XTemplate.prototype.applyTemplate; 7352Ext.XTemplate.from = function(a) { 7353 a = Ext.getDom(a); 7354 return new Ext.XTemplate(a.value || a.innerHTML) 7355}; 7356Ext.util.CSS = function() { 7357 var d = null; 7358 var c = document; 7359 var b = /(-[a-z])/gi; 7360 var a = function(e, g) { 7361 return g.charAt(1).toUpperCase() 7362 }; 7363 return { 7364 createStyleSheet : function(i, l) { 7365 var h; 7366 var g = c.getElementsByTagName("head")[0]; 7367 var k = c.createElement("style"); 7368 k.setAttribute("type", "text/css"); 7369 if (l) { 7370 k.setAttribute("id", l) 7371 } 7372 if (Ext.isIE) { 7373 g.appendChild(k); 7374 h = k.styleSheet; 7375 h.cssText = i 7376 } else { 7377 try { 7378 k.appendChild(c.createTextNode(i)) 7379 } catch (j) { 7380 k.cssText = i 7381 } 7382 g.appendChild(k); 7383 h = k.styleSheet 7384 ? k.styleSheet 7385 : (k.sheet || c.styleSheets[c.styleSheets.length - 1]) 7386 } 7387 this.cacheStyleSheet(h); 7388 return h 7389 }, 7390 removeStyleSheet : function(g) { 7391 var e = c.getElementById(g); 7392 if (e) { 7393 e.parentNode.removeChild(e) 7394 } 7395 }, 7396 swapStyleSheet : function(h, e) { 7397 this.removeStyleSheet(h); 7398 var g = c.createElement("link"); 7399 g.setAttribute("rel", "stylesheet"); 7400 g.setAttribute("type", "text/css"); 7401 g.setAttribute("id", h); 7402 g.setAttribute("href", e); 7403 c.getElementsByTagName("head")[0].appendChild(g) 7404 }, 7405 refreshCache : function() { 7406 return this.getRules(true) 7407 }, 7408 cacheStyleSheet : function(h) { 7409 if (!d) { 7410 d = {} 7411 } 7412 try { 7413 var k = h.cssRules || h.rules;
7414 for (var g = k.length - 1; g >= 0; --g) { 7415 d[k[g].selectorText.toLowerCase()] = k[g] 7416 } 7417 } catch (i) { 7418 } 7419 }, 7420 getRules : function(h) { 7421 if (d === null || h) { 7422 d = {}; 7423 var k = c.styleSheets; 7424 for (var j = 0, g = k.length; j < g; j++) { 7425 try { 7426 this.cacheStyleSheet(k[j]) 7427 } catch (l) { 7428 } 7429 } 7430 } 7431 return d 7432 }, 7433 getRule : function(e, h) { 7434 var g = this.getRules(h); 7435 if (!Ext.isArray(e)) { 7436 return g[e.toLowerCase()] 7437 } 7438 for (var j = 0; j < e.length; j++) { 7439 if (g[e[j]]) { 7440 return g[e[j].toLowerCase()] 7441 } 7442 } 7443 return null 7444 }, 7445 updateRule : function(e, j, h) { 7446 if (!Ext.isArray(e)) { 7447 var k = this.getRule(e); 7448 if (k) { 7449 k.style[j.replace(b, a)] = h; 7450 return true 7451 } 7452 } else { 7453 for (var g = 0; g < e.length; g++) { 7454 if (this.updateRule(e[g], j, h)) { 7455 return true 7456 } 7457 } 7458 } 7459 return false 7460 } 7461 } 7462}(); 7463Ext.util.ClickRepeater = Ext.extend(Ext.util.Observable, { 7464 constructor : function(b, a) { 7465 this.el = Ext.get(b); 7466 this.el.unselectable(); 7467 Ext.apply(this, a); 7468 this.addEvents("mousedown", "click", "mouseup"); 7469 if (!this.disabled) { 7470 this.disabled = true; 7471 this.enable() 7472 } 7473 if (this.handler) { 7474 this.on("click", this.handler, this.scope || this) 7475 } 7476 Ext.util.ClickRepeater.superclass.constructor.call(this) 7477 }, 7478 interval : 20, 7479 delay : 250, 7480 preventDefault : true, 7481 stopDefault : false, 7482 timer : 0, 7483 enable : function() { 7484 if (this.disabled) { 7485 this.el.on("mousedown", this.handleMouseDown, this); 7486 if (Ext.isIE) { 7487 this.el.on("dblclick", this.handleDblClick, this) 7488 } 7489 if (this.preventDefault || this.stopDefault) { 7490 this.el.on("click", this.eventOptions, this) 7491 } 7492 } 7493 this.disabled = false 7494 }, 7495 disable : function(a) { 7496 if (a || !this.disabled) { 7497 clearTimeout(this.timer); 7498 if (this.pressClass) { 7499 this.el.removeClass(this.pressClass) 7500 } 7501 Ext.getDoc().un("mouseup", this.handleMouseUp, this); 7502 this.el.removeAllListeners() 7503 } 7504 this.disabled = true 7505 }, 7506 setDisabled : function(a) { 7507 this[a ? "disable" : "enable"]() 7508 }, 7509 eventOptions : function(a) { 7510 if (this.preventDefault) { 7511 a.preventDefault() 7512 } 7513 if (this.stopDefault) { 7514 a.stopEvent() 7515 } 7516 }, 7517 destroy : function() { 7518 this.disable(true); 7519 Ext.destroy(this.el); 7520 this.purgeListeners() 7521 }, 7522 handleDblClick : function(a) { 7523 clearTimeout(this.timer); 7524 this.el.blur(); 7525 this.fireEvent("mousedown", this, a); 7526 this.fireEvent("click", this, a) 7527 }, 7528 handleMouseDown : function(a) { 7529 clearTimeout(this.timer); 7530 this.el.blur(); 7531 if (this.pressClass) { 7532 this.el.addClass(this.pressClass) 7533 } 7534 this.mousedownTime = new Date(); 7535 Ext.getDoc().on("mouseup", this.handleMouseUp, this); 7536 this.el.on("mouseout", this.handleMouseOut, this); 7537 this.fireEvent("mousedown", this, a); 7538 this.fireEvent("click", this, a); 7539 if (this.accelerate) { 7540 this.delay = 400 7541 } 7542 this.timer = this.click.defer(this.delay || this.interval, 7543 this, [a]) 7544 }, 7545 click : function(a) { 7546 this.fireEvent("click", this, a); 7547 this.timer = this.click.defer(this.accelerate ? this 7548 .easeOutExpo(this.mousedownTime.getElapsed(), 7549 400, -390, 12000) : this.interval, 7550 this, [a]) 7551 }, 7552 easeOutExpo : function(e, a, h, g) { 7553 return (e == g) ? a + h : h * (-Math.pow(2, -10 * e / g) + 1) 7554 + a 7555 }, 7556 handleMouseOut : function() { 7557 clearTimeout(this.timer); 7558 if (this.pressClass) { 7559 this.el.removeClass(this.pressClass) 7560 } 7561 this.el.on("mouseover", this.handleMouseReturn, this) 7562 }, 7563 handleMouseReturn : function() { 7564 this.el.un("mouseover", this.handleMouseReturn, this); 7565 if (this.pressClass) { 7566 this.el.addClass(this.pressClass) 7567 } 7568 this.click() 7569 }, 7570 handleMouseUp : function(a) { 7571 clearTimeout(this.timer); 7572 this.el.un("mouseover", this.handleMouseReturn, this); 7573 this.el.un("mouseout", this.handleMouseOut, this); 7574 Ext.getDoc().un("mouseup", this.handleMouseUp, this); 7575 this.el.removeClass(this.pressClass); 7576 this.fireEvent("mouseup", this, a) 7577 } 7578 }); 7579Ext.KeyNav = function(b, a) { 7580 this.el = Ext.get(b); 7581 Ext.apply(this, a); 7582 if (!this.disabled) { 7583 this.disabled = true; 7584 this.enable() 7585 } 7586}; 7587Ext.KeyNav.prototype = { 7588 disabled : false, 7589 defaultEventAction : "stopEvent", 7590 forceKeyDown : false, 7591 relay : function(c) { 7592 var a = c.getKey(), b = this.keyToHandler[a]; 7593 if (b && this[b]) { 7594 if (this.doRelay(c, this[b], b) !== true) { 7595 c[this.defaultEventAction]() 7596 } 7597 } 7598 }, 7599 doRelay : function(c, b, a) { 7600 return b.call(this.scope || this, c, a) 7601 }, 7602 enter : false, 7603 left : false, 7604 right : false, 7605 up : false, 7606 down : false, 7607 tab : false, 7608 esc : false, 7609 pageUp : false, 7610 pageDown : false, 7611 del : false, 7612 home : false, 7613 end : false, 7614 space : false, 7615 keyToHandler : { 7616 37 : "left", 7617 39 : "right", 7618 38 : "up", 7619 40 : "down", 7620 33 : "pageUp", 7621 34 : "pageDown", 7622 46 : "del", 7623 36 : "home", 7624 35 : "end", 7625 13 : "enter", 7626 27 : "esc", 7627 9 : "tab", 7628 32 : "space" 7629 }, 7630 stopKeyUp : function(b) { 7631 var a = b.getKey(); 7632 if (a >= 37 && a <= 40) { 7633 b.stopEvent() 7634 } 7635 }, 7636 destroy : function() { 7637 this.disable() 7638 }, 7639 enable : function() { 7640 if (this.disabled) { 7641 if (Ext.isSafari2) { 7642 this.el.on("keyup", this.stopKeyUp, this) 7643 } 7644 this.el.on(this.isKeydown() ? "keydown" : "keypress", this.relay, 7645 this); 7646 this.disabled = false 7647 } 7648 }, 7649 disable : function() { 7650 if (!this.disabled) { 7651 if (Ext.isSafari2) {
7652 this.el.un("keyup", this.stopKeyUp, this) 7653 } 7654 this.el.un(this.isKeydown() ? "keydown" : "keypress", this.relay, 7655 this); 7656 this.disabled = true 7657 } 7658 }, 7659 setDisabled : function(a) { 7660 this[a ? "disable" : "enable"]() 7661 }, 7662 isKeydown : function() { 7663 return this.forceKeyDown || Ext.EventManager.useKeydown 7664 } 7665}; 7666Ext.KeyMap = function(c, b, a) { 7667 this.el = Ext.get(c); 7668 this.eventName = a || "keydown"; 7669 this.bindings = []; 7670 if (b) { 7671 this.addBinding(b) 7672 } 7673 this.enable() 7674}; 7675Ext.KeyMap.prototype = { 7676 stopEvent : false, 7677 addBinding : function(b) { 7678 if (Ext.isArray(b)) { 7679 Ext.each(b, function(j) { 7680 this.addBinding(j) 7681 }, this); 7682 return 7683 } 7684 var k = b.key, g = b.fn || b.handler, l = b.scope; 7685 if (b.stopEvent) { 7686 this.stopEvent = b.stopEvent 7687 } 7688 if (typeof k == "string") { 7689 var h = []; 7690 var e = k.toUpperCase(); 7691 for (var c = 0, d = e.length; c < d; c++) { 7692 h.push(e.charCodeAt(c)) 7693 } 7694 k = h 7695 } 7696 var a = Ext.isArray(k); 7697 var i = function(o) { 7698 if (this.checkModifiers(b, o)) { 7699 var m = o.getKey(); 7700 if (a) { 7701 for (var n = 0, j = k.length; n < j; n++) { 7702 if (k[n] == m) { 7703 if (this.stopEvent) { 7704 o.stopEvent() 7705 } 7706 g.call(l || window, m, o); 7707 return 7708 } 7709 } 7710 } else { 7711 if (m == k) { 7712 if (this.stopEvent) { 7713 o.stopEvent() 7714 } 7715 g.call(l || window, m, o) 7716 } 7717 } 7718 } 7719 }; 7720 this.bindings.push(i) 7721 }, 7722 checkModifiers : function(b, h) { 7723 var j, d, g = ["shift", "ctrl", "alt"]; 7724 for (var c = 0, a = g.length; c < a; ++c) { 7725 d = g[c]; 7726 j = b[d]; 7727 if (!(j === undefined || (j === h[d + "Key"]))) { 7728 return false 7729 } 7730 } 7731 return true 7732 }, 7733 on : function(b, d, c) { 7734 var h, a, e, g; 7735 if (typeof b == "object" && !Ext.isArray(b)) { 7736 h = b.key; 7737 a = b.shift; 7738 e = b.ctrl; 7739 g = b.alt 7740 } else { 7741 h = b 7742 } 7743 this.addBinding({ 7744 key : h, 7745 shift : a, 7746 ctrl : e, 7747 alt : g, 7748 fn : d, 7749 scope : c 7750 }) 7751 }, 7752 handleKeyDown : function(g) { 7753 if (this.enabled) { 7754 var c = this.bindings; 7755 for (var d = 0, a = c.length; d < a; d++) { 7756 c[d].call(this, g) 7757 } 7758 } 7759 }, 7760 isEnabled : function() { 7761 return this.enabled 7762 }, 7763 enable : function() { 7764 if (!this.enabled) { 7765 this.el.on(this.eventName, this.handleKeyDown, this); 7766 this.enabled = true 7767 } 7768 }, 7769 disable : function() { 7770 if (this.enabled) { 7771 this.el.removeListener(this.eventName, this.handleKeyDown, this); 7772 this.enabled = false 7773 } 7774 }, 7775 setDisabled : function(a) { 7776 this[a ? "disable" : "enable"]() 7777 } 7778}; 7779Ext.util.TextMetrics = function() { 7780 var a; 7781 return { 7782 measure : function(b, c, d) { 7783 if (!a) { 7784 a = Ext.util.TextMetrics.Instance(b, d) 7785 } 7786 a.bind(b); 7787 a.setFixedWidth(d || "auto"); 7788 return a.getSize(c) 7789 }, 7790 createInstance : function(b, c) { 7791 return Ext.util.TextMetrics.Instance(b, c) 7792 } 7793 } 7794}(); 7795Ext.util.TextMetrics.Instance = function(b, d) { 7796 var c = new Ext.Element(document.createElement("div")); 7797 document.body.appendChild(c.dom); 7798 c.position("absolute"); 7799 c.setLeftTop(-1000, -1000); 7800 c.hide(); 7801 if (d) { 7802 c.setWidth(d) 7803 } 7804 var a = { 7805 getSize : function(g) { 7806 c.update(g); 7807 var e = c.getSize(); 7808 c.update(""); 7809 return e 7810 }, 7811 bind : function(e) { 7812 c.setStyle(Ext.fly(e).getStyles("font-size", "font-style", 7813 "font-weight", "font-family", "line-height", 7814 "text-transform", "letter-spacing")) 7815 }, 7816 setFixedWidth : function(e) { 7817 c.setWidth(e) 7818 }, 7819 getWidth : function(e) { 7820 c.dom.style.width = "auto"; 7821 return this.getSize(e).width 7822 }, 7823 getHeight : function(e) { 7824 return this.getSize(e).height 7825 } 7826 }; 7827 a.bind(b); 7828 return a 7829}; 7830Ext.Element.addMethods({ 7831 getTextWidth : function(c, b, a) { 7832 return (Ext.util.TextMetrics.measure(this.dom, Ext.value(c, 7833 this.dom.innerHTML, true)).width).constrain(b 7834 || 0, a || 1000000) 7835 } 7836 }); 7837Ext.util.Cookies = { 7838 set : function(c, e) { 7839 var a = arguments; 7840 var i = arguments.length; 7841 var b = (i > 2) ? a[2] : null;
7842 var h = (i > 3) ? a[3] : "/"; 7843 var d = (i > 4) ? a[4] : null; 7844 var g = (i > 5) ? a[5] : false; 7845 document.cookie = c + "=" + escape(e) 7846 + ((b === null) ? "" : ("; expires=" + b.toGMTString())) 7847 + ((h === null) ? "" : ("; path=" + h)) 7848 + ((d === null) ? "" : ("; domain=" + d)) 7849 + ((g === true) ? "; secure" : "") 7850 }, 7851 get : function(d) { 7852 var b = d + "="; 7853 var g = b.length; 7854 var a = document.cookie.length; 7855 var e = 0; 7856 var c = 0; 7857 while (e < a) { 7858 c = e + g; 7859 if (document.cookie.substring(e, c) == b) { 7860 return Ext.util.Cookies.getCookieVal(c) 7861 } 7862 e = document.cookie.indexOf(" ", e) + 1; 7863 if (e === 0) { 7864 break 7865 } 7866 } 7867 return null 7868 }, 7869 clear : function(a) { 7870 if (Ext.util.Cookies.get(a)) { 7871 document.cookie = a + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" 7872 } 7873 }, 7874 getCookieVal : function(b) { 7875 var a = document.cookie.indexOf(";", b); 7876 if (a == -1) { 7877 a = document.cookie.length 7878 } 7879 return unescape(document.cookie.substring(b, a)) 7880 } 7881}; 7882Ext.handleError = function(a) { 7883 throw a 7884}; 7885Ext.Error = function(a) { 7886 this.message = (this.lang[a]) ? this.lang[a] : a 7887}; 7888Ext.Error.prototype = new Error(); 7889Ext.apply(Ext.Error.prototype, { 7890 lang : {}, 7891 name : "Ext.Error", 7892 getName : function() { 7893 return this.name 7894 }, 7895 getMessage : function() { 7896 return this.message 7897 }, 7898 toJson : function() { 7899 return Ext.encode(this) 7900 } 7901 }); 7902Ext.ComponentMgr = function() { 7903 var c = new Ext.util.MixedCollection(); 7904 var b = {}; 7905 var a = {}; 7906 return { 7907 register : function(d) { 7908 c.add(d) 7909 }, 7910 unregister : function(d) { 7911 c.remove(d) 7912 }, 7913 get : function(d) { 7914 return c.get(d) 7915 }, 7916 onAvailable : function(g, e, d) { 7917 c.on("add", function(h, i) { 7918 if (i.id == g) { 7919 e.call(d || i, i); 7920 c.un("add", e, d) 7921 } 7922 }) 7923 }, 7924 all : c, 7925 types : b, 7926 ptypes : a, 7927 isRegistered : function(d) { 7928 return b[d] !== undefined 7929 }, 7930 isPluginRegistered : function(d) { 7931 return a[d] !== undefined 7932 }, 7933 registerType : function(e, d) { 7934 b[e] = d; 7935 d.xtype = e 7936 }, 7937 create : function(d, e) { 7938 return d.render ? d : new b[d.xtype || e](d) 7939 }, 7940 registerPlugin : function(e, d) { 7941 a[e] = d; 7942 d.ptype = e 7943 }, 7944 createPlugin : function(e, g) { 7945 var d = a[e.ptype || g]; 7946 if (d.init) { 7947 return d 7948 } else { 7949 return new d(e) 7950 } 7951 } 7952 } 7953}(); 7954Ext.reg = Ext.ComponentMgr.registerType; 7955Ext.preg = Ext.ComponentMgr.registerPlugin; 7956Ext.create = Ext.ComponentMgr.create; 7957Ext.Component = function(b) { 7958 b = b || {}; 7959 if (b.initialConfig) { 7960 if (b.isAction) { 7961 this.baseAction = b 7962 } 7963 b = b.initialConfig 7964 } else { 7965 if (b.tagName || b.dom || Ext.isString(b)) { 7966 b = { 7967 applyTo : b, 7968 id : b.id || b 7969 } 7970 } 7971 } 7972 this.initialConfig = b; 7973 Ext.apply(this, b); 7974 this.addEvents("added", "disable", "enable", "beforeshow", "show", 7975 "beforehide", "hide", "removed", "beforerender", "render", 7976 "afterrender", "beforedestroy", "destroy", "beforestaterestore", 7977 "staterestore", "beforestatesave", "statesave"); 7978 this.getId(); 7979 Ext.ComponentMgr.register(this); 7980 Ext.Component.superclass.constructor.call(this); 7981 if (this.baseAction) { 7982 this.baseAction.addComponent(this) 7983 } 7984 this.initComponent(); 7985 if (this.plugins) { 7986 if (Ext.isArray(this.plugins)) { 7987 for (var c = 0, a = this.plugins.length; c < a; c++) { 7988 this.plugins[c] = this.initPlugin(this.plugins[c]) 7989 } 7990 } else { 7991 this.plugins = this.initPlugin(this.plugins) 7992 } 7993 } 7994 if (this.stateful !== false) { 7995 this.initState() 7996 } 7997 if (this.applyTo) { 7998 this.applyToMarkup(this.applyTo); 7999 delete this.applyTo 8000 } else { 8001 if (this.renderTo) { 8002 this.render(this.renderTo); 8003 delete this.renderTo 8004 } 8005 } 8006}; 8007Ext.Component.AUTO_ID = 1000; 8008Ext.extend(Ext.Component, Ext.util.Observable, { 8009 disabled : false, 8010 hidden : false, 8011 autoEl : "div", 8012 disabledClass : "x-item-disabled", 8013 allowDomMove : true, 8014 autoShow : false, 8015 hideMode : "display", 8016 hideParent : false, 8017 rendered : false, 8018 tplWriteMode : "overwrite", 8019 bubbleEvents : [], 8020 ctype : "Ext.Component", 8021 actionMode : "el", 8022 getActionEl : function() { 8023 return this[this.actionMode] 8024 }, 8025 initPlugin : function(a) { 8026 if (a.ptype && !Ext.isFunction(a.init)) { 8027 a = Ext.ComponentMgr.createPlugin(a) 8028 } else { 8029 if (Ext.isString(a)) { 8030 a = Ext.ComponentMgr.createPlugin({ 8031 ptype : a 8032 }) 8033 } 8034 } 8035 a.init(this); 8036 return a 8037 }, 8038 initComponent : function() { 8039 if (this.listeners) { 8040 this.on(this.listeners); 8041 delete this.listeners 8042 } 8043 this.enableBubble(this.bubbleEvents) 8044 }, 8045 render : function(b, a) { 8046 if (!this.rendered && this.fireEvent("beforerender", this) !== false) { 8047 if (!b && this.el) { 8048 this.el = Ext.get(this.el); 8049 b = this.el.dom.parentNode; 8050 this.allowDomMove = false 8051 } 8052 this.container = Ext.get(b);
8053 if (this.ctCls) { 8054 this.container.addClass(this.ctCls) 8055 } 8056 this.rendered = true; 8057 if (a !== undefined) { 8058 if (Ext.isNumber(a)) { 8059 a = this.container.dom.childNodes[a] 8060 } else { 8061 a = Ext.getDom(a) 8062 } 8063 } 8064 this.onRender(this.container, a || null); 8065 if (this.autoShow) { 8066 this.el.removeClass(["x-hidden", "x-hide-" + this.hideMode]) 8067 } 8068 if (this.cls) { 8069 this.el.addClass(this.cls); 8070 delete this.cls 8071 } 8072 if (this.style) { 8073 this.el.applyStyles(this.style); 8074 delete this.style 8075 } 8076 if (this.overCls) { 8077 this.el.addClassOnOver(this.overCls) 8078 } 8079 this.fireEvent("render", this); 8080 var c = this.getContentTarget(); 8081 if (this.html) { 8082 c.update(Ext.DomHelper.markup(this.html)); 8083 delete this.html 8084 } 8085 if (this.contentEl) { 8086 var d = Ext.getDom(this.contentEl); 8087 Ext.fly(d).removeClass(["x-hidden", "x-hide-display"]); 8088 c.appendChild(d) 8089 } 8090 if (this.tpl) { 8091 if (!this.tpl.compile) { 8092 this.tpl = new Ext.XTemplate(this.tpl) 8093 } 8094 if (this.data) { 8095 this.tpl[this.tplWriteMode](c, this.data); 8096 delete this.data 8097 } 8098 } 8099 this.afterRender(this.container); 8100 if (this.hidden) { 8101 this.doHide() 8102 } 8103 if (this.disabled) { 8104 this.disable(true) 8105 } 8106 if (this.stateful !== false) { 8107 this.initStateEvents() 8108 } 8109 this.fireEvent("afterrender", this) 8110 } 8111 return this 8112 }, 8113 update : function(b, d, a) { 8114 var c = this.getContentTarget(); 8115 if (this.tpl && typeof b !== "string") { 8116 this.tpl[this.tplWriteMode](c, b || {}) 8117 } else { 8118 var e = Ext.isObject(b) ? Ext.DomHelper.markup(b) : b; 8119 c.update(e, d, a) 8120 } 8121 }, 8122 onAdded : function(a, b) { 8123 this.ownerCt = a; 8124 this.initRef(); 8125 this.fireEvent("added", this, a, b) 8126 }, 8127 onRemoved : function() { 8128 this.removeRef(); 8129 this.fireEvent("removed", this, this.ownerCt); 8130 delete this.ownerCt 8131 }, 8132 initRef : function() { 8133 if (this.ref && !this.refOwner) { 8134 var d = this.ref.split("/"), c = d.length, b = 0, a = this; 8135 while (a && b < c) { 8136 a = a.ownerCt; 8137 ++b 8138 } 8139 if (a) { 8140 a[this.refName = d[--b]] = this; 8141 this.refOwner = a 8142 } 8143 } 8144 }, 8145 removeRef : function() { 8146 if (this.refOwner && this.refName) { 8147 delete this.refOwner[this.refName]; 8148 delete this.refOwner 8149 } 8150 }, 8151 initState : function() { 8152 if (Ext.state && Ext.state.Manager) { 8153 var b = this.getStateId(); 8154 if (b) { 8155 var a = Ext.state.Manager.get(b); 8156 if (a) { 8157 if (this.fireEvent("beforestaterestore", this, a) !== false) { 8158 this.applyState(Ext.apply({}, a)); 8159 this.fireEvent("staterestore", this, a) 8160 } 8161 } 8162 } 8163 } 8164 }, 8165 getStateId : function() { 8166 return this.stateId 8167 || ((/^(ext-comp-|ext-gen)/).test(String(this.id)) 8168 ? null 8169 : this.id) 8170 }, 8171 initStateEvents : function() { 8172 if (this.stateEvents) { 8173 for (var a = 0, b; b = this.stateEvents[a]; a++) { 8174 this.on(b, this.saveState, this, { 8175 delay : 100 8176 }) 8177 } 8178 } 8179 }, 8180 applyState : function(a) { 8181 if (a) { 8182 Ext.apply(this, a) 8183 } 8184 }, 8185 getState : function() { 8186 return null 8187 }, 8188 saveState : function() { 8189 if (Ext.state && Ext.state.Manager && this.stateful !== false) { 8190 var b = this.getStateId(); 8191 if (b) { 8192 var a = this.getState(); 8193 if (this.fireEvent("beforestatesave", this, a) !== false) { 8194 Ext.state.Manager.set(b, a); 8195 this.fireEvent("statesave", this, a) 8196 } 8197 } 8198 } 8199 }, 8200 applyToMarkup : function(a) { 8201 this.allowDomMove = false; 8202 this.el = Ext.get(a); 8203 this.render(this.el.dom.parentNode) 8204 }, 8205 addClass : function(a) { 8206 if (this.el) { 8207 this.el.addClass(a) 8208 } else { 8209 this.cls = this.cls ? this.cls + " " + a : a 8210 } 8211 return this 8212 }, 8213 removeClass : function(a) { 8214 if (this.el) { 8215 this.el.removeClass(a) 8216 } else { 8217 if (this.cls) { 8218 this.cls = this.cls.split(" ").remove(a).join(" ") 8219 } 8220 } 8221 return this 8222 }, 8223 onRender : function(b, a) { 8224 if (!this.el && this.autoEl) { 8225 if (Ext.isString(this.autoEl)) { 8226 this.el = document.createElement(this.autoEl) 8227 } else { 8228 var c = document.createElement("div"); 8229 Ext.DomHelper.overwrite(c, this.autoEl); 8230 this.el = c.firstChild 8231 }
8232 if (!this.el.id) { 8233 this.el.id = this.getId() 8234 } 8235 } 8236 if (this.el) { 8237 this.el = Ext.get(this.el); 8238 if (this.allowDomMove !== false) { 8239 b.dom.insertBefore(this.el.dom, a); 8240 if (c) { 8241 Ext.removeNode(c); 8242 c = null 8243 } 8244 } 8245 } 8246 }, 8247 getAutoCreate : function() { 8248 var a = Ext.isObject(this.autoCreate) ? this.autoCreate : Ext.apply({}, 8249 this.defaultAutoCreate); 8250 if (this.id && !a.id) { 8251 a.id = this.id 8252 } 8253 8254 if (this.tabIndex > -1) { 8255 a.tabindex = this.tabIndex; 8256 } 8257 8258 return a 8259 }, 8260 afterRender : Ext.emptyFn, 8261 destroy : function() { 8262 if (!this.isDestroyed) { 8263 if (this.fireEvent("beforedestroy", this) !== false) { 8264 this.destroying = true; 8265 this.beforeDestroy(); 8266 if (this.ownerCt && this.ownerCt.remove) { 8267 this.ownerCt.remove(this, false) 8268 } 8269 if (this.rendered) { 8270 this.el.remove(); 8271 if (this.actionMode == "container" 8272 || this.removeMode == "container") { 8273 this.container.remove() 8274 } 8275 } 8276 if (this.focusTask && this.focusTask.cancel) { 8277 this.focusTask.cancel() 8278 } 8279 this.onDestroy(); 8280 Ext.ComponentMgr.unregister(this); 8281 this.fireEvent("destroy", this); 8282 this.purgeListeners(); 8283 this.destroying = false; 8284 this.isDestroyed = true 8285 } 8286 } 8287 }, 8288 deleteMembers : function() { 8289 var b = arguments; 8290 for (var c = 0, a = b.length; c < a; ++c) { 8291 delete this[b[c]] 8292 } 8293 }, 8294 beforeDestroy : Ext.emptyFn, 8295 onDestroy : Ext.emptyFn, 8296 getEl : function() { 8297 return this.el 8298 }, 8299 getContentTarget : function() { 8300 return this.el 8301 }, 8302 getId : function() { 8303 return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID)) 8304 }, 8305 getItemId : function() { 8306 return this.itemId || this.getId() 8307 }, 8308 focus : function(b, a) { 8309 if (a) { 8310 this.focusTask = new Ext.util.DelayedTask(this.focus, this, [b, 8311 false]); 8312 this.focusTask.delay(Ext.isNumber(a) ? a : 10); 8313 return this 8314 } 8315 if (this.rendered && !this.isDestroyed) { 8316 this.el.focus(); 8317 if (b === true) { 8318 this.el.dom.select() 8319 } 8320 } 8321 return this 8322 }, 8323 blur : function() { 8324 if (this.rendered) { 8325 this.el.blur() 8326 } 8327 return this 8328 }, 8329 disable : function(a) { 8330 if (this.rendered) { 8331 this.onDisable() 8332 } 8333 this.disabled = true; 8334 if (a !== true) { 8335 this.fireEvent("disable", this) 8336 } 8337 return this 8338 }, 8339 onDisable : function() { 8340 this.getActionEl().addClass(this.disabledClass); 8341 this.el.dom.disabled = true 8342 }, 8343 enable : function() { 8344 if (this.rendered) { 8345 this.onEnable() 8346 } 8347 this.disabled = false; 8348 this.fireEvent("enable", this); 8349 return this 8350 }, 8351 onEnable : function() { 8352 this.getActionEl().removeClass(this.disabledClass); 8353 this.el.dom.disabled = false 8354 }, 8355 setDisabled : function(a) { 8356 return this[a ? "disable" : "enable"]() 8357 }, 8358 show : function() { 8359 if (this.fireEvent("beforeshow", this) !== false) { 8360 this.hidden = false; 8361 if (this.autoRender) { 8362 this.render(Ext.isBoolean(this.autoRender) 8363 ? Ext.getBody() 8364 : this.autoRender) 8365 } 8366 if (this.rendered) { 8367 this.onShow() 8368 } 8369 this.fireEvent("show", this) 8370 } 8371 return this 8372 }, 8373 onShow : function() { 8374 this.getVisibilityEl().removeClass("x-hide-" + this.hideMode) 8375 }, 8376 hide : function() { 8377 if (this.fireEvent("beforehide", this) !== false) { 8378 this.doHide(); 8379 this.fireEvent("hide", this) 8380 } 8381 return this 8382 }, 8383 doHide : function() { 8384 this.hidden = true; 8385 if (this.rendered) { 8386 this.onHide() 8387 } 8388 }, 8389 onHide : function() { 8390 this.getVisibilityEl().addClass("x-hide-" + this.hideMode) 8391 }, 8392 getVisibilityEl : function() { 8393 return this.hideParent ? this.container : this.getActionEl() 8394 }, 8395 setVisible : function(a) { 8396 return this[a ? "show" : "hide"]() 8397 }, 8398 isVisible : function() { 8399 return this.rendered && this.getVisibilityEl().isVisible() 8400 }, 8401 cloneConfig : function(b) { 8402 b = b || {}; 8403 var c = b.id || Ext.id(); 8404 var a = Ext.applyIf(b, this.initialConfig); 8405 a.id = c; 8406 return new this.constructor(a) 8407 }, 8408 getXType : function() { 8409 return this.constructor.xtype
8410 }, 8411 isXType : function(b, a) { 8412 if (Ext.isFunction(b)) { 8413 b = b.xtype 8414 } else { 8415 if (Ext.isObject(b)) { 8416 b = b.constructor.xtype 8417 } 8418 } 8419 return !a 8420 ? ("/" + this.getXTypes() + "/").indexOf("/" + b + "/") != -1 8421 : this.constructor.xtype == b 8422 }, 8423 getXTypes : function() { 8424 var a = this.constructor; 8425 if (!a.xtypes) { 8426 var d = [], b = this; 8427 while (b && b.constructor.xtype) { 8428 d.unshift(b.constructor.xtype); 8429 b = b.constructor.superclass 8430 } 8431 a.xtypeChain = d; 8432 a.xtypes = d.join("/") 8433 } 8434 return a.xtypes 8435 }, 8436 findParentBy : function(a) { 8437 for (var b = this.ownerCt; (b != null) && !a(b, this); b = b.ownerCt) { 8438 } 8439 return b || null 8440 }, 8441 findParentByType : function(b, a) { 8442 return this.findParentBy(function(d) { 8443 return d.isXType(b, a) 8444 }) 8445 }, 8446 bubble : function(c, b, a) { 8447 var d = this; 8448 while (d) { 8449 if (c.apply(b || d, a || [d]) === false) { 8450 break 8451 } 8452 d = d.ownerCt 8453 } 8454 return this 8455 }, 8456 getPositionEl : function() { 8457 return this.positionEl || this.el 8458 }, 8459 purgeListeners : function() { 8460 Ext.Component.superclass.purgeListeners.call(this); 8461 if (this.mons) { 8462 this.on("beforedestroy", this.clearMons, this, { 8463 single : true 8464 }) 8465 } 8466 }, 8467 clearMons : function() { 8468 Ext.each(this.mons, function(a) { 8469 a.item.un(a.ename, a.fn, a.scope) 8470 }, this); 8471 this.mons = [] 8472 }, 8473 createMons : function() { 8474 if (!this.mons) { 8475 this.mons = []; 8476 this.on("beforedestroy", this.clearMons, this, { 8477 single : true 8478 }) 8479 } 8480 }, 8481 mon : function(g, b, d, c, a) { 8482 this.createMons(); 8483 if (Ext.isObject(b)) { 8484 var j = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/; 8485 var i = b; 8486 for (var h in i) { 8487 if (j.test(h)) { 8488 continue 8489 } 8490 if (Ext.isFunction(i[h])) { 8491 this.mons.push({ 8492 item : g, 8493 ename : h, 8494 fn : i[h], 8495 scope : i.scope 8496 }); 8497 g.on(h, i[h], i.scope, i) 8498 } else { 8499 this.mons.push({ 8500 item : g, 8501 ename : h, 8502 fn : i[h], 8503 scope : i.scope 8504 }); 8505 g.on(h, i[h]) 8506 } 8507 } 8508 return 8509 } 8510 this.mons.push({ 8511 item : g, 8512 ename : b, 8513 fn : d, 8514 scope : c 8515 }); 8516 g.on(b, d, c, a) 8517 }, 8518 mun : function(h, c, g, e) { 8519 var j, d; 8520 this.createMons(); 8521 for (var b = 0, a = this.mons.length; b < a; ++b) { 8522 d = this.mons[b]; 8523 if (h === d.item && c == d.ename && g === d.fn && e === d.scope) { 8524 this.mons.splice(b, 1); 8525 h.un(c, g, e); 8526 j = true; 8527 break 8528 } 8529 } 8530 return j 8531 }, 8532 nextSibling : function() { 8533 if (this.ownerCt) { 8534 var a = this.ownerCt.items.indexOf(this); 8535 if (a != -1 && a + 1 < this.ownerCt.items.getCount()) { 8536 return this.ownerCt.items.itemAt(a + 1) 8537 } 8538 } 8539 return null 8540 }, 8541 previousSibling : function() { 8542 if (this.ownerCt) { 8543 var a = this.ownerCt.items.indexOf(this); 8544 if (a > 0) { 8545 return this.ownerCt.items.itemAt(a - 1) 8546 } 8547 } 8548 return null 8549 }, 8550 getBubbleTarget : function() { 8551 return this.ownerCt 8552 } 8553}); 8554Ext.reg("component", Ext.Component); 8555Ext.Action = Ext.extend(Object, { 8556 constructor : function(a) { 8557 this.initialConfig = a; 8558 this.itemId = a.itemId = (a.itemId || a.id || Ext.id()); 8559 this.items = [] 8560 }, 8561 isAction : true, 8562 setText : function(a) { 8563 this.initialConfig.text = a; 8564 this.callEach("setText", [a]) 8565 }, 8566 getText : function() { 8567 return this.initialConfig.text 8568 }, 8569 setIconClass : function(a) { 8570 this.initialConfig.iconCls = a; 8571 this.callEach("setIconClass", [a]) 8572 }, 8573 getIconClass : function() { 8574 return this.initialConfig.iconCls 8575 }, 8576 setDisabled : function(a) { 8577 this.initialConfig.disabled = a; 8578 this.callEach("setDisabled", [a]) 8579 }, 8580 enable : function() { 8581 this.setDisabled(false) 8582 }, 8583 disable : function() { 8584 this.setDisabled(true) 8585 }, 8586 isDisabled : function() { 8587 return this.initialConfig.disabled 8588 }, 8589 setHidden : function(a) { 8590 this.initialConfig.hidden = a; 8591 this.callEach("setVisible", [!a]) 8592 }, 8593 show : function() { 8594 this.setHidden(false) 8595 }, 8596 hide : function() { 8597 this.setHidden(true) 8598 }, 8599 isHidden : function() { 8600 return this.initialConfig.hidden 8601 }, 8602 setHandler : function(b, a) { 8603 this.initialConfig.handler = b; 8604 this.initialConfig.scope = a; 8605 this.callEach("setHandler", [b, a]) 8606 }, 8607 each : function(b, a) { 8608 Ext.each(this.items, b, a) 8609 }, 8610 callEach : function(e, b) { 8611 var d = this.items; 8612 for (var c = 0, a = d.length; c < a; c++) { 8613 d[c][e].apply(d[c], b) 8614 } 8615 }, 8616 addComponent : function(a) { 8617 this.items.push(a); 8618 a.on("destroy", this.removeComponent, this) 8619 }, 8620 removeComponent : function(a) { 8621 this.items.remove(a) 8622 }, 8623 execute : function() { 8624 this.initialConfig.handler.apply(this.initialConfig.scope 8625 || window, arguments) 8626 } 8627 }); 8628(function() { 8629 Ext.Layer = function(d, c) { 8630 d = d || {}; 8631 var e = Ext.DomHelper, h = d.parentEl, g = h 8632 ? Ext.getDom(h) 8633 : document.body; 8634 if (c) { 8635 this.dom = Ext.getDom(c) 8636 } 8637 if (!this.dom) { 8638 var i = d.dh || { 8639 tag : "div", 8640 cls : "x-layer" 8641 }; 8642 this.dom = e.append(g, i) 8643 } 8644 if (d.cls) { 8645 this.addClass(d.cls) 8646 } 8647 this.constrain = d.constrain !== false; 8648 this.setVisibilityMode(Ext.Element.VISIBILITY); 8649 if (d.id) { 8650 this.id = this.dom.id = d.id 8651 } else { 8652 this.id = Ext.id(this.dom) 8653 } 8654 this.zindex = d.zindex || this.getZIndex(); 8655 this.position("absolute", this.zindex); 8656 if (d.shadow) { 8657 this.shadowOffset = d.shadowOffset || 4; 8658 this.shadow = new Ext.Shadow({ 8659 offset : this.shadowOffset, 8660 mode : d.shadow 8661 }) 8662 } else { 8663 this.shadowOffset = 0 8664 } 8665 this.useShim = d.shim !== false && Ext.useShims; 8666 this.useDisplay = d.useDisplay; 8667 this.hide() 8668 }; 8669 var a = Ext.Element.prototype; 8670 var b = []; 8671 Ext.extend(Ext.Layer, Ext.Element, { 8672 getZIndex : function() { 8673 return this.zindex 8674 || parseInt((this.getShim() || this).getStyle("z-index"), 8675 10) || 11000 8676 }, 8677 getShim : function() { 8678 if (!this.useShim) { 8679 return null 8680 } 8681 if (this.shim) { 8682 return this.shim 8683 } 8684 var d = b.shift(); 8685 if (!d) { 8686 d = this.createShim(); 8687 d.enableDisplayMode("block"); 8688 d.dom.style.display = "none"; 8689 d.dom.style.visibility = "visible" 8690 } 8691 var c = this.dom.parentNode; 8692 if (d.dom.parentNode != c) { 8693 c.insertBefore(d.dom, this.dom) 8694 } 8695 d.setStyle("z-index", this.getZIndex() - 2); 8696 this.shim = d; 8697 return d 8698 }, 8699 hideShim : function() { 8700 if (this.shim) { 8701 this.shim.setDisplayed(false); 8702 b.push(this.shim); 8703 delete this.shim 8704 } 8705 }, 8706 disableShadow : function() { 8707 if (this.shadow) { 8708 this.shadowDisabled = true; 8709 this.shadow.hide(); 8710 this.lastShadowOffset = this.shadowOffset; 8711 this.shadowOffset = 0 8712 } 8713 }, 8714 enableShadow : function(c) { 8715 if (this.shadow) { 8716 this.shadowDisabled = false; 8717 if (Ext.isDefined(this.lastShadowOffset)) { 8718 this.shadowOffset = this.lastShadowOffset; 8719 delete this.lastShadowOffset 8720 } 8721 if (c) { 8722 this.sync(true) 8723 } 8724 } 8725 }, 8726 sync : function(d) { 8727 var n = this.shadow; 8728 if (!this.updating && this.isVisible() && (n || this.useShim)) {
8729 var i = this.getShim(), m = this.getWidth(), j = this 8730 .getHeight(), e = this.getLeft(true), o = this 8731 .getTop(true); 8732 if (n && !this.shadowDisabled) { 8733 if (d && !n.isVisible()) { 8734 n.show(this) 8735 } else { 8736 n.realign(e, o, m, j) 8737 } 8738 if (i) { 8739 if (d) { 8740 i.show() 8741 } 8742 var k = n.el.getXY(), g = i.dom.style, c = n.el 8743 .getSize(); 8744 g.left = (k[0]) + "px"; 8745 g.top = (k[1]) + "px"; 8746 g.width = (c.width) + "px"; 8747 g.height = (c.height) + "px" 8748 } 8749 } else { 8750 if (i) { 8751 if (d) { 8752 i.show() 8753 } 8754 i.setSize(m, j); 8755 i.setLeftTop(e, o) 8756 } 8757 } 8758 } 8759 }, 8760 destroy : function() { 8761 this.hideShim(); 8762 if (this.shadow) { 8763 this.shadow.hide() 8764 } 8765 this.removeAllListeners(); 8766 Ext.removeNode(this.dom); 8767 delete this.dom 8768 }, 8769 remove : function() { 8770 this.destroy() 8771 }, 8772 beginUpdate : function() { 8773 this.updating = true 8774 }, 8775 endUpdate : function() { 8776 this.updating = false; 8777 this.sync(true) 8778 }, 8779 hideUnders : function(c) { 8780 if (this.shadow) { 8781 this.shadow.hide() 8782 } 8783 this.hideShim() 8784 }, 8785 constrainXY : function() { 8786 if (this.constrain) { 8787 var j = Ext.lib.Dom.getViewWidth(), d = Ext.lib.Dom 8788 .getViewHeight(); 8789 var o = Ext.getDoc().getScroll(); 8790 var n = this.getXY(); 8791 var k = n[0], i = n[1]; 8792 var c = this.shadowOffset; 8793 var l = this.dom.offsetWidth + c, e = this.dom.offsetHeight + c; 8794 var g = false; 8795 if ((k + l) > j + o.left) { 8796 k = j - l - c; 8797 g = true 8798 } 8799 if ((i + e) > d + o.top) { 8800 i = d - e - c; 8801 g = true 8802 } 8803 if (k < o.left) { 8804 k = o.left; 8805 g = true 8806 } 8807 if (i < o.top) { 8808 i = o.top; 8809 g = true 8810 } 8811 if (g) { 8812 if (this.avoidY) { 8813 var m = this.avoidY; 8814 if (i <= m && (i + e) >= m) { 8815 i = m - e - 5 8816 } 8817 } 8818 n = [k, i]; 8819 this.storeXY(n); 8820 a.setXY.call(this, n); 8821 this.sync() 8822 } 8823 } 8824 return this 8825 }, 8826 getConstrainOffset : function() { 8827 return this.shadowOffset 8828 }, 8829 isVisible : function() { 8830 return this.visible 8831 }, 8832 showAction : function() { 8833 this.visible = true; 8834 if (this.useDisplay === true) { 8835 this.setDisplayed("") 8836 } else { 8837 if (this.lastXY) { 8838 a.setXY.call(this, this.lastXY) 8839 } else { 8840 if (this.lastLT) { 8841 a.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]) 8842 } 8843 } 8844 } 8845 }, 8846 hideAction : function() { 8847 this.visible = false; 8848 if (this.useDisplay === true) { 8849 this.setDisplayed(false) 8850 } else { 8851 this.setLeftTop(-10000, -10000) 8852 } 8853 }, 8854 setVisible : function(i, h, k, l, j) { 8855 if (i) { 8856 this.showAction() 8857 } 8858 if (h && i) { 8859 var g = function() { 8860 this.sync(true); 8861 if (l) { 8862 l() 8863 } 8864 }.createDelegate(this); 8865 a.setVisible.call(this, true, true, k, g, j) 8866 } else { 8867 if (!i) { 8868 this.hideUnders(true) 8869 } 8870 var g = l; 8871 if (h) { 8872 g = function() { 8873 this.hideAction(); 8874 if (l) { 8875 l() 8876 } 8877 }.createDelegate(this) 8878 } 8879 a.setVisible.call(this, i, h, k, g, j); 8880 if (i) { 8881 this.sync(true) 8882 } else { 8883 if (!h) { 8884 this.hideAction() 8885 } 8886 } 8887 } 8888 return this 8889 }, 8890 storeXY : function(c) { 8891 delete this.lastLT; 8892 this.lastXY = c 8893 }, 8894 storeLeftTop : function(d, c) { 8895 delete this.lastXY; 8896 this.lastLT = [d, c] 8897 }, 8898 beforeFx : function() { 8899 this.beforeAction(); 8900 return Ext.Layer.superclass.beforeFx.apply(this, arguments) 8901 }, 8902 afterFx : function() { 8903 Ext.Layer.superclass.afterFx.apply(this, arguments); 8904 this.sync(this.isVisible()) 8905 }, 8906 beforeAction : function() { 8907 if (!this.updating && this.shadow) { 8908 this.shadow.hide() 8909 } 8910 }, 8911 setLeft : function(c) { 8912 this.storeLeftTop(c, this.getTop(true)); 8913 a.setLeft.apply(this, arguments); 8914 this.sync(); 8915 return this 8916 }, 8917 setTop : function(c) { 8918 this.storeLeftTop(this.getLeft(true), c); 8919 a.setTop.apply(this, arguments); 8920 this.sync(); 8921 return this 8922 }, 8923 setLeftTop : function(d, c) { 8924 this.storeLeftTop(d, c); 8925 a.setLeftTop.apply(this, arguments); 8926 this.sync(); 8927 return this 8928 }, 8929 setXY : function(j, h, k, l, i) { 8930 this.fixDisplay(); 8931 this.beforeAction(); 8932 this.storeXY(j); 8933 var g = this.createCB(l); 8934 a.setXY.call(this, j, h, k, g, i); 8935 if (!h) { 8936 g() 8937 } 8938 return this 8939 }, 8940 createCB : function(e) { 8941 var d = this; 8942 return function() { 8943 d.constrainXY(); 8944 d.sync(true); 8945 if (e) { 8946 e() 8947 } 8948 } 8949 }, 8950 setX : function(g, h, j, k, i) { 8951 this.setXY([g, this.getY()], h, j, k, i); 8952 return this 8953 }, 8954 setY : function(k, g, i, j, h) { 8955 this.setXY([this.getX(), k], g, i, j, h); 8956 return this 8957 }, 8958 setSize : function(j, k, i, m, n, l) { 8959 this.beforeAction(); 8960 var g = this.createCB(n); 8961 a.setSize.call(this, j, k, i, m, g, l); 8962 if (!i) { 8963 g() 8964 } 8965 return this 8966 }, 8967 setWidth : function(i, h, k, l, j) { 8968 this.beforeAction(); 8969 var g = this.createCB(l); 8970 a.setWidth.call(this, i, h, k, g, j); 8971 if (!h) { 8972 g() 8973 } 8974 return this 8975 }, 8976 setHeight : function(j, i, l, m, k) { 8977 this.beforeAction(); 8978 var g = this.createCB(m); 8979 a.setHeight.call(this, j, i, l, g, k); 8980 if (!i) { 8981 g() 8982 } 8983 return this 8984 }, 8985 setBounds : function(o, m, p, i, n, k, l, j) { 8986 this.beforeAction(); 8987 var g = this.createCB(l); 8988 if (!n) { 8989 this.storeXY([o, m]); 8990 a.setXY.call(this, [o, m]); 8991 a.setSize.call(this, p, i, n, k, g, j); 8992 g() 8993 } else { 8994 a.setBounds.call(this, o, m, p, i, n, k, g, j) 8995 } 8996 return this 8997 }, 8998 setZIndex : function(c) { 8999 this.zindex = c; 9000 this.setStyle("z-index", c + 2); 9001 if (this.shadow) { 9002 this.shadow.setZIndex(c + 1) 9003 } 9004 if (this.shim) { 9005 this.shim.setStyle("z-index", c) 9006 } 9007 return this 9008 } 9009 }) 9010})(); 9011Ext.Shadow = function(d) { 9012 Ext.apply(this, d); 9013 if (typeof this.mode != "string") { 9014 this.mode = this.defaultMode 9015 } 9016 var e = this.offset, c = { 9017 h : 0 9018 }, b = Math.floor(this.offset / 2); 9019 switch (this.mode.toLowerCase()) { 9020 case "drop" : 9021 c.w = 0; 9022 c.l = c.t = e; 9023 c.t -= 1; 9024 if (Ext.isIE) { 9025 c.l -= this.offset + b; 9026 c.t -= this.offset + b; 9027 c.w -= b; 9028 c.h -= b; 9029 c.t += 1 9030 } 9031 break; 9032 case "sides" : 9033 c.w = (e * 2); 9034 c.l = -e; 9035 c.t = e - 1; 9036 if (Ext.isIE) { 9037 c.l -= (this.offset - b); 9038 c.t -= this.offset + b; 9039 c.l += 1; 9040 c.w -= (this.offset - b) * 2; 9041 c.w -= b + 1; 9042 c.h -= 1 9043 } 9044 break; 9045 case "frame" : 9046 c.w = c.h = (e * 2); 9047 c.l = c.t = -e; 9048 c.t += 1; 9049 c.h -= 2; 9050 if (Ext.isIE) { 9051 c.l -= (this.offset - b); 9052 c.t -= (this.offset - b); 9053 c.l += 1; 9054 c.w -= (this.offset + b + 1); 9055 c.h -= (this.offset + b); 9056 c.h += 1 9057 } 9058 break 9059 } 9060 this.adjusts = c 9061}; 9062Ext.Shadow.prototype = { 9063 offset : 4, 9064 defaultMode : "drop", 9065 show : function(a) { 9066 a = Ext.get(a); 9067 if (!this.el) { 9068 this.el = Ext.Shadow.Pool.pull(); 9069 if (this.el.dom.nextSibling != a.dom) { 9070 this.el.insertBefore(a) 9071 } 9072 } 9073 this.el.setStyle("z-index", this.zIndex 9074 || parseInt(a.getStyle("z-index"), 10) - 1); 9075 if (Ext.isIE) { 9076 this.el.dom.style.filter = "progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius=" 9077 + (this.offset) + ")" 9078 } 9079 this.realign(a.getLeft(true), a.getTop(true), a.getWidth(), a 9080 .getHeight()); 9081 this.el.dom.style.display = "block" 9082 }, 9083 isVisible : function() { 9084 return this.el ? true : false 9085 }, 9086 realign : function(b, r, q, g) { 9087 if (!this.el) { 9088 return 9089 } 9090 var n = this.adjusts, k = this.el.dom, u = k.style, i = 0, p = (q + n.w), e = (g + n.h), j = p 9091 + "px", o = e + "px", m, c; 9092 u.left = (b + n.l) + "px"; 9093 u.top = (r + n.t) + "px"; 9094 if (u.width != j || u.height != o) { 9095 u.width = j; 9096 u.height = o; 9097 if (!Ext.isIE) { 9098 m = k.childNodes; 9099 c = Math.max(0, (p - 12)) + "px"; 9100 m[0].childNodes[1].style.width = c; 9101 m[1].childNodes[1].style.width = c; 9102 m[2].childNodes[1].style.width = c; 9103 m[1].style.height = Math.max(0, (e - 12)) + "px" 9104 } 9105 } 9106 }, 9107 hide : function() { 9108 if (this.el) { 9109 this.el.dom.style.display = "none"; 9110 Ext.Shadow.Pool.push(this.el); 9111 delete this.el 9112 } 9113 }, 9114 setZIndex : function(a) { 9115 this.zIndex = a; 9116 if (this.el) { 9117 this.el.setStyle("z-index", a) 9118 } 9119 } 9120}; 9121Ext.Shadow.Pool = function() { 9122 var b = [], a = Ext.isIE 9123 ? '<div class="x-ie-shadow"></div>' 9124 : '<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>'; 9125 return { 9126 pull : function() { 9127 var c = b.shift(); 9128 if (!c) { 9129 c = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", 9130 document.body.firstChild, a)); 9131 c.autoBoxAdjust = false 9132 } 9133 return c 9134 }, 9135 push : function(c) { 9136 b.push(c) 9137 } 9138 } 9139}(); 9140Ext.BoxComponent = Ext.extend(Ext.Component, { 9141 initComponent : function() { 9142 Ext.BoxComponent.superclass.initComponent.call(this); 9143 this.addEvents("resize", "move") 9144 }, 9145 boxReady : false, 9146 deferHeight : false, 9147 setSize : function(b, d) { 9148 if (typeof b == "object") { 9149 d = b.height; 9150 b = b.width 9151 } 9152 if (Ext.isDefined(b) && Ext.isDefined(this.boxMinWidth) 9153 && (b < this.boxMinWidth)) { 9154 b = this.boxMinWidth 9155 } 9156 if (Ext.isDefined(d) && Ext.isDefined(this.boxMinHeight) 9157 && (d < this.boxMinHeight)) { 9158 d = this.boxMinHeight 9159 } 9160 if (Ext.isDefined(b) && Ext.isDefined(this.boxMaxWidth) 9161 && (b > this.boxMaxWidth)) { 9162 b = this.boxMaxWidth 9163 } 9164 if (Ext.isDefined(d) && Ext.isDefined(this.boxMaxHeight) 9165 && (d > this.boxMaxHeight)) { 9166 d = this.boxMaxHeight 9167 } 9168 if (!this.boxReady) { 9169 this.width = b; 9170 this.height = d; 9171 return this 9172 } 9173 if (this.cacheSizes !== false && this.lastSize 9174 && this.lastSize.width == b 9175 && this.lastSize.height == d) { 9176 return this 9177 } 9178 this.lastSize = { 9179 width : b, 9180 height : d 9181 }; 9182 var c = this.adjustSize(b, d), g = c.width, a = c.height, e; 9183 if (g !== undefined || a !== undefined) { 9184 e = this.getResizeEl(); 9185 if (!this.deferHeight && g !== undefined && a !== undefined) { 9186 e.setSize(g, a) 9187 } else { 9188 if (!this.deferHeight && a !== undefined) { 9189 e.setHeight(a) 9190 } else { 9191 if (g !== undefined) { 9192 e.setWidth(g) 9193 } 9194 } 9195 } 9196 this.onResize(g, a, b, d); 9197 this.fireEvent("resize", this, g, a, b, d) 9198 } 9199 return this 9200 },
9201 setWidth : function(a) { 9202 return this.setSize(a) 9203 }, 9204 setHeight : function(a) { 9205 return this.setSize(undefined, a) 9206 }, 9207 getSize : function() { 9208 return this.getResizeEl().getSize() 9209 }, 9210 getWidth : function() { 9211 return this.getResizeEl().getWidth() 9212 }, 9213 getHeight : function() { 9214 return this.getResizeEl().getHeight() 9215 }, 9216 getOuterSize : function() { 9217 var a = this.getResizeEl(); 9218 return { 9219 width : a.getWidth() + a.getMargins("lr"), 9220 height : a.getHeight() + a.getMargins("tb") 9221 } 9222 }, 9223 getPosition : function(a) { 9224 var b = this.getPositionEl(); 9225 if (a === true) { 9226 return [b.getLeft(true), b.getTop(true)] 9227 } 9228 return this.xy || b.getXY() 9229 }, 9230 getBox : function(a) { 9231 var c = this.getPosition(a); 9232 var b = this.getSize(); 9233 b.x = c[0]; 9234 b.y = c[1]; 9235 return b 9236 }, 9237 updateBox : function(a) { 9238 this.setSize(a.width, a.height); 9239 this.setPagePosition(a.x, a.y); 9240 return this 9241 }, 9242 getResizeEl : function() { 9243 return this.resizeEl || this.el 9244 }, 9245 setAutoScroll : function(a) { 9246 if (this.rendered) { 9247 this.getContentTarget().setOverflow(a ? "auto" : "") 9248 } 9249 this.autoScroll = a; 9250 return this 9251 }, 9252 setPosition : function(a, g) { 9253 if (a && typeof a[1] == "number") { 9254 g = a[1]; 9255 a = a[0] 9256 } 9257 this.x = a; 9258 this.y = g; 9259 if (!this.boxReady) { 9260 return this 9261 } 9262 var b = this.adjustPosition(a, g); 9263 var e = b.x, d = b.y; 9264 var c = this.getPositionEl(); 9265 if (e !== undefined || d !== undefined) { 9266 if (e !== undefined && d !== undefined) { 9267 c.setLeftTop(e, d) 9268 } else { 9269 if (e !== undefined) { 9270 c.setLeft(e) 9271 } else { 9272 if (d !== undefined) { 9273 c.setTop(d) 9274 } 9275 } 9276 } 9277 this.onPosition(e, d); 9278 this.fireEvent("move", this, e, d) 9279 } 9280 return this 9281 }, 9282 setPagePosition : function(a, c) { 9283 if (a && typeof a[1] == "number") { 9284 c = a[1]; 9285 a = a[0] 9286 } 9287 this.pageX = a; 9288 this.pageY = c; 9289 if (!this.boxReady) { 9290 return 9291 } 9292 if (a === undefined || c === undefined) { 9293 return 9294 } 9295 var b = this.getPositionEl().translatePoints(a, c); 9296 this.setPosition(b.left, b.top); 9297 return this 9298 }, 9299 afterRender : function() { 9300 Ext.BoxComponent.superclass.afterRender.call(this); 9301 if (this.resizeEl) { 9302 this.resizeEl = Ext.get(this.resizeEl) 9303 } 9304 if (this.positionEl) { 9305 this.positionEl = Ext.get(this.positionEl) 9306 } 9307 this.boxReady = true; 9308 Ext.isDefined(this.autoScroll) 9309 && this.setAutoScroll(this.autoScroll); 9310 this.setSize(this.width, this.height); 9311 if (this.x || this.y) { 9312 this.setPosition(this.x, this.y) 9313 } else { 9314 if (this.pageX || this.pageY) { 9315 this.setPagePosition(this.pageX, this.pageY) 9316 } 9317 } 9318 }, 9319 syncSize : function() { 9320 delete this.lastSize; 9321 this.setSize(this.autoWidth ? undefined : this.getResizeEl() 9322 .getWidth(), this.autoHeight ? undefined : this 9323 .getResizeEl().getHeight()); 9324 return this 9325 }, 9326 onResize : function(d, b, a, c) { 9327 }, 9328 onPosition : function(a, b) { 9329 }, 9330 adjustSize : function(a, b) { 9331 if (this.autoWidth) { 9332 a = "auto" 9333 } 9334 if (this.autoHeight) { 9335 b = "auto" 9336 } 9337 return { 9338 width : a, 9339 height : b 9340 } 9341 }, 9342 adjustPosition : function(a, b) { 9343 return { 9344 x : a, 9345 y : b 9346 } 9347 } 9348 }); 9349Ext.reg("box", Ext.BoxComponent); 9350Ext.Spacer = Ext.extend(Ext.BoxComponent, { 9351 autoEl : "div" 9352 }); 9353Ext.reg("spacer", Ext.Spacer); 9354Ext.SplitBar = function(c, e, b, d, a) { 9355 this.el = Ext.get(c, true); 9356 this.el.dom.unselectable = "on"; 9357 this.resizingEl = Ext.get(e, true); 9358 this.orientation = b || Ext.SplitBar.HORIZONTAL; 9359 this.minSize = 0; 9360 this.maxSize = 2000; 9361 this.animate = false; 9362 this.useShim = false; 9363 this.shim = null; 9364 if (!a) { 9365 this.proxy = Ext.SplitBar.createProxy(this.orientation) 9366 } else { 9367 this.proxy = Ext.get(a).dom 9368 } 9369 this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", { 9370 dragElId : this.proxy.id 9371 }); 9372 this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this); 9373 this.dd.endDrag = this.onEndProxyDrag.createDelegate(this); 9374 this.dragSpecs = {}; 9375 this.adapter = new Ext.SplitBar.BasicLayoutAdapter(); 9376 this.adapter.init(this); 9377 if (this.orientation == Ext.SplitBar.HORIZONTAL) { 9378 this.placement = d 9379 || (this.el.getX() > this.resizingEl.getX() 9380 ? Ext.SplitBar.LEFT 9381 : Ext.SplitBar.RIGHT); 9382 this.el.addClass("x-splitbar-h") 9383 } else { 9384 this.placement = d 9385 || (this.el.getY() > this.resizingEl.getY() 9386 ? Ext.SplitBar.TOP 9387 : Ext.SplitBar.BOTTOM); 9388 this.el.addClass("x-splitbar-v") 9389 } 9390 this.addEvents("resize", "moved", "beforeresize", "beforeapply"); 9391 Ext.SplitBar.superclass.constructor.call(this) 9392}; 9393Ext.extend(Ext.SplitBar, Ext.util.Observable, { 9394 onStartProxyDrag : function(a, e) { 9395 this.fireEvent("beforeresize", this);
9396 this.overlay = Ext.DomHelper.append(document.body, { 9397 cls : "x-drag-overlay", 9398 html : " " 9399 }, true); 9400 this.overlay.unselectable(); 9401 this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom 9402 .getViewHeight(true)); 9403 this.overlay.show(); 9404 Ext.get(this.proxy).setDisplayed("block"); 9405 var c = this.adapter.getElementSize(this); 9406 this.activeMinSize = this.getMinimumSize(); 9407 this.activeMaxSize = this.getMaximumSize(); 9408 var d = c - this.activeMinSize; 9409 var b = Math.max(this.activeMaxSize - c, 0); 9410 if (this.orientation == Ext.SplitBar.HORIZONTAL) { 9411 this.dd.resetConstraints(); 9412 this.dd.setXConstraint(this.placement == Ext.SplitBar.LEFT ? d : b, 9413 this.placement == Ext.SplitBar.LEFT ? b : d, this.tickSize); 9414 this.dd.setYConstraint(0, 0) 9415 } else { 9416 this.dd.resetConstraints(); 9417 this.dd.setXConstraint(0, 0); 9418 this.dd.setYConstraint(this.placement == Ext.SplitBar.TOP ? d : b, 9419 this.placement == Ext.SplitBar.TOP ? b : d, this.tickSize) 9420 } 9421 this.dragSpecs.startSize = c; 9422 this.dragSpecs.startPoint = [a, e]; 9423 Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, a, e) 9424 }, 9425 onEndProxyDrag : function(c) { 9426 Ext.get(this.proxy).setDisplayed(false); 9427 var b = Ext.lib.Event.getXY(c); 9428 if (this.overlay) { 9429 Ext.destroy(this.overlay); 9430 delete this.overlay 9431 } 9432 var a; 9433 if (this.orientation == Ext.SplitBar.HORIZONTAL) { 9434 a = this.dragSpecs.startSize 9435 + (this.placement == Ext.SplitBar.LEFT 9436 ? b[0] - this.dragSpecs.startPoint[0] 9437 : this.dragSpecs.startPoint[0] - b[0]) 9438 } else { 9439 a = this.dragSpecs.startSize 9440 + (this.placement == Ext.SplitBar.TOP 9441 ? b[1] - this.dragSpecs.startPoint[1] 9442 : this.dragSpecs.startPoint[1] - b[1]) 9443 } 9444 a = Math.min(Math.max(a, this.activeMinSize), this.activeMaxSize); 9445 if (a != this.dragSpecs.startSize) { 9446 if (this.fireEvent("beforeapply", this, a) !== false) { 9447 this.adapter.setElementSize(this, a); 9448 this.fireEvent("moved", this, a); 9449 this.fireEvent("resize", this, a) 9450 } 9451 } 9452 }, 9453 getAdapter : function() { 9454 return this.adapter 9455 }, 9456 setAdapter : function(a) { 9457 this.adapter = a; 9458 this.adapter.init(this) 9459 }, 9460 getMinimumSize : function() { 9461 return this.minSize 9462 }, 9463 setMinimumSize : function(a) { 9464 this.minSize = a 9465 }, 9466 getMaximumSize : function() { 9467 return this.maxSize 9468 }, 9469 setMaximumSize : function(a) { 9470 this.maxSize = a 9471 }, 9472 setCurrentSize : function(b) { 9473 var a = this.animate; 9474 this.animate = false; 9475 this.adapter.setElementSize(this, b); 9476 this.animate = a 9477 }, 9478 destroy : function(a) { 9479 Ext.destroy(this.shim, Ext.get(this.proxy)); 9480 this.dd.unreg(); 9481 if (a) { 9482 this.el.remove() 9483 } 9484 this.purgeListeners() 9485 } 9486}); 9487Ext.SplitBar.createProxy = function(b) { 9488 var c = new Ext.Element(document.createElement("div")); 9489 document.body.appendChild(c.dom); 9490 c.unselectable(); 9491 var a = "x-splitbar-proxy"; 9492 c.addClass(a + " " + (b == Ext.SplitBar.HORIZONTAL ? a + "-h" : a + "-v")); 9493 return c.dom 9494}; 9495Ext.SplitBar.BasicLayoutAdapter = function() { 9496}; 9497Ext.SplitBar.BasicLayoutAdapter.prototype = { 9498 init : function(a) { 9499 }, 9500 getElementSize : function(a) { 9501 if (a.orientation == Ext.SplitBar.HORIZONTAL) { 9502 return a.resizingEl.getWidth() 9503 } else { 9504 return a.resizingEl.getHeight() 9505 } 9506 }, 9507 setElementSize : function(b, a, c) { 9508 if (b.orientation == Ext.SplitBar.HORIZONTAL) { 9509 if (!b.animate) { 9510 b.resizingEl.setWidth(a); 9511 if (c) { 9512 c(b, a) 9513 } 9514 } else { 9515 b.resizingEl.setWidth(a, true, 0.1, c, "easeOut") 9516 } 9517 } else { 9518 if (!b.animate) { 9519 b.resizingEl.setHeight(a); 9520 if (c) { 9521 c(b, a) 9522 } 9523 } else { 9524 b.resizingEl.setHeight(a, true, 0.1, c, "easeOut") 9525 } 9526 } 9527 } 9528}; 9529Ext.SplitBar.AbsoluteLayoutAdapter = function(a) { 9530 this.basic = new Ext.SplitBar.BasicLayoutAdapter(); 9531 this.container = Ext.get(a) 9532}; 9533Ext.SplitBar.AbsoluteLayoutAdapter.prototype = { 9534 init : function(a) { 9535 this.basic.init(a) 9536 }, 9537 getElementSize : function(a) { 9538 return this.basic.getElementSize(a) 9539 }, 9540 setElementSize : function(b, a, c) { 9541 this.basic.setElementSize(b, a, this.moveSplitter.createDelegate(this, 9542 [b])) 9543 }, 9544 moveSplitter : function(a) { 9545 var b = Ext.SplitBar; 9546 switch (a.placement) { 9547 case b.LEFT : 9548 a.el.setX(a.resizingEl.getRight()); 9549 break; 9550 case b.RIGHT : 9551 a.el.setStyle("right", 9552 (this.container.getWidth() - a.resizingEl.getLeft()) 9553 + "px"); 9554 break; 9555 case b.TOP :
9556 a.el.setY(a.resizingEl.getBottom()); 9557 break; 9558 case b.BOTTOM : 9559 a.el.setY(a.resizingEl.getTop() - a.el.getHeight()); 9560 break 9561 } 9562 } 9563}; 9564Ext.SplitBar.VERTICAL = 1; 9565Ext.SplitBar.HORIZONTAL = 2; 9566Ext.SplitBar.LEFT = 1; 9567Ext.SplitBar.RIGHT = 2; 9568Ext.SplitBar.TOP = 3; 9569Ext.SplitBar.BOTTOM = 4; 9570Ext.Container = Ext.extend(Ext.BoxComponent, { 9571 bufferResize : 50, 9572 autoDestroy : true, 9573 forceLayout : false, 9574 defaultType : "panel", 9575 resizeEvent : "resize", 9576 bubbleEvents : ["add", "remove"], 9577 initComponent : function() { 9578 Ext.Container.superclass.initComponent.call(this); 9579 this.addEvents("afterlayout", "beforeadd", "beforeremove", "add", 9580 "remove"); 9581 var a = this.items; 9582 if (a) { 9583 delete this.items; 9584 this.add(a) 9585 } 9586 }, 9587 initItems : function() { 9588 if (!this.items) { 9589 this.items = new Ext.util.MixedCollection(false, 9590 this.getComponentId); 9591 this.getLayout() 9592 } 9593 }, 9594 setLayout : function(a) { 9595 if (this.layout && this.layout != a) { 9596 this.layout.setContainer(null) 9597 } 9598 this.layout = a; 9599 this.initItems(); 9600 a.setContainer(this) 9601 }, 9602 afterRender : function() { 9603 Ext.Container.superclass.afterRender.call(this); 9604 if (!this.layout) { 9605 this.layout = "auto" 9606 } 9607 if (Ext.isObject(this.layout) && !this.layout.layout) { 9608 this.layoutConfig = this.layout; 9609 this.layout = this.layoutConfig.type 9610 } 9611 if (Ext.isString(this.layout)) { 9612 this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig) 9613 } 9614 this.setLayout(this.layout); 9615 if (this.activeItem !== undefined && this.layout.setActiveItem) { 9616 var a = this.activeItem; 9617 delete this.activeItem; 9618 this.layout.setActiveItem(a) 9619 } 9620 if (!this.ownerCt) { 9621 this.doLayout(false, true) 9622 } 9623 if (this.monitorResize === true) { 9624 Ext.EventManager.onWindowResize(this.doLayout, this, [false]) 9625 } 9626 }, 9627 getLayoutTarget : function() { 9628 return this.el 9629 }, 9630 getComponentId : function(a) { 9631 return a.getItemId() 9632 }, 9633 add : function(b) { 9634 this.initItems(); 9635 var e = arguments.length > 1; 9636 if (e || Ext.isArray(b)) { 9637 var a = []; 9638 Ext.each(e ? arguments : b, function(h) { 9639 a.push(this.add(h)) 9640 }, this); 9641 return a 9642 } 9643 var g = this.lookupComponent(this.applyDefaults(b)); 9644 var d = this.items.length; 9645 if (this.fireEvent("beforeadd", this, g, d) !== false 9646 && this.onBeforeAdd(g) !== false) { 9647 this.items.add(g); 9648 g.onAdded(this, d); 9649 this.onAdd(g); 9650 this.fireEvent("add", this, g, d) 9651 } 9652 return g 9653 }, 9654 onAdd : function(a) { 9655 }, 9656 onAdded : function(a, b) { 9657 this.ownerCt = a; 9658 this.initRef(); 9659 this.cascade(function(d) { 9660 d.initRef() 9661 }); 9662 this.fireEvent("added", this, a, b) 9663 }, 9664 insert : function(e, b) { 9665 var d = arguments, h = d.length, a = [], g, j; 9666 this.initItems(); 9667 if (h > 2) { 9668 for (g = h - 1; g >= 1; --g) { 9669 a.push(this.insert(e, d[g])) 9670 } 9671 return a 9672 } 9673 j = this.lookupComponent(this.applyDefaults(b)); 9674 e = Math.min(e, this.items.length); 9675 if (this.fireEvent("beforeadd", this, j, e) !== false 9676 && this.onBeforeAdd(j) !== false) { 9677 if (j.ownerCt == this) { 9678 this.items.remove(j) 9679 } 9680 this.items.insert(e, j); 9681 j.onAdded(this, e); 9682 this.onAdd(j); 9683 this.fireEvent("add", this, j, e) 9684 } 9685 return j 9686 }, 9687 applyDefaults : function(b) { 9688 var a = this.defaults; 9689 if (a) { 9690 if (Ext.isFunction(a)) { 9691 a = a.call(this, b) 9692 } 9693 if (Ext.isString(b)) { 9694 b = Ext.ComponentMgr.get(b); 9695 Ext.apply(b, a) 9696 } else { 9697 if (!b.events) { 9698 Ext.applyIf(b.isAction ? b.initialConfig : b, a) 9699 } else { 9700 Ext.apply(b, a) 9701 } 9702 } 9703 } 9704 return b 9705 }, 9706 onBeforeAdd : function(a) { 9707 if (a.ownerCt) { 9708 a.ownerCt.remove(a, false) 9709 } 9710 if (this.hideBorders === true) { 9711 a.border = (a.border === true) 9712 } 9713 }, 9714 remove : function(a, b) { 9715 this.initItems(); 9716 var d = this.getComponent(a); 9717 if (d && this.fireEvent("beforeremove", this, d) !== false) { 9718 this.doRemove(d, b); 9719 this.fireEvent("remove", this, d) 9720 } 9721 return d 9722 }, 9723 onRemove : function(a) { 9724 }, 9725 doRemove : function(e, d) { 9726 var b = this.layout, a = b && this.rendered; 9727 if (a) { 9728 b.onRemove(e) 9729 } 9730 this.items.remove(e); 9731 e.onRemoved(); 9732 this.onRemove(e); 9733 if (d === true || (d !== false && this.autoDestroy)) { 9734 e.destroy() 9735 } 9736 if (a) { 9737 b.afterRemove(e) 9738 } 9739 }, 9740 removeAll : function(c) { 9741 this.initItems();
9742 var e, g = [], b = []; 9743 this.items.each(function(h) { 9744 g.push(h) 9745 }); 9746 for (var d = 0, a = g.length; d < a; ++d) { 9747 e = g[d]; 9748 this.remove(e, c); 9749 if (e.ownerCt !== this) { 9750 b.push(e) 9751 } 9752 } 9753 return b 9754 }, 9755 getComponent : function(a) { 9756 if (Ext.isObject(a)) { 9757 a = a.getItemId() 9758 } 9759 return this.items.get(a) 9760 }, 9761 lookupComponent : function(a) { 9762 if (Ext.isString(a)) { 9763 return Ext.ComponentMgr.get(a) 9764 } else { 9765 if (!a.events) { 9766 return this.createComponent(a) 9767 } 9768 } 9769 return a 9770 }, 9771 createComponent : function(a, d) { 9772 if (a.render) { 9773 return a 9774 } 9775 var b = Ext.create(Ext.apply({ 9776 ownerCt : this 9777 }, a), d || this.defaultType); 9778 delete b.initialConfig.ownerCt; 9779 delete b.ownerCt; 9780 return b 9781 }, 9782 canLayout : function() { 9783 var a = this.getVisibilityEl(); 9784 return a && a.dom && !a.isStyle("display", "none") 9785 }, 9786 doLayout : function(g, e) { 9787 var k = this.rendered, j = e || this.forceLayout; 9788 if (this.collapsed || !this.canLayout()
9788) { 9789 this.deferLayout = this.deferLayout || !g; 9790 if (!j) { 9791 return 9792 } 9793 g = g && !this.deferLayout 9794 } else { 9795 delete this.deferLayout 9796 } 9797 if (k && this.layout) { 9798 this.layout.layout() 9799 } 9800 if (g !== true && this.items) { 9801 var d = this.items.items; 9802 for (var b = 0, a = d.length; b < a; b++) { 9803 var h = d[b]; 9804 if (h.doLayout) { 9805 h.doLayout(false, j) 9806 } 9807 } 9808 } 9809 if (k) { 9810 this.onLayout(g, j) 9811 } 9812 this.hasLayout = true; 9813 delete this.forceLayout 9814 }, 9815 onLayout : Ext.emptyFn, 9816 shouldBufferLayout : function() { 9817 var a = this.hasLayout; 9818 if (this.ownerCt) { 9819 return a ? !this.hasLayoutPending() : false 9820 } 9821 return a 9822 }, 9823 hasLayoutPending : function() { 9824 var a = false; 9825 this.ownerCt.bubble(function(b) { 9826 if (b.layoutPending) { 9827 a = true; 9828 return false 9829 } 9830 }); 9831 return a 9832 }, 9833 onShow : function() { 9834 Ext.Container.superclass.onShow.call(this); 9835 if (Ext.isDefined(this.deferLayout)) { 9836 delete this.deferLayout; 9837 this.doLayout(true) 9838 } 9839 }, 9840 getLayout : function() { 9841 if (!this.layout) { 9842 var a = new Ext.layout.AutoLayout(this.layoutConfig); 9843 this.setLayout(a) 9844 } 9845 return this.layout 9846 }, 9847 beforeDestroy : function() { 9848 var a; 9849 if (this.items) { 9850 while (a = this.items.first()) { 9851 this.doRemove(a, true) 9852 } 9853 } 9854 if (this.monitorResize) { 9855 Ext.EventManager.removeResizeListener(this.doLayout, this) 9856 } 9857 Ext.destroy(this.layout); 9858 Ext.Container.superclass.beforeDestroy.call(this) 9859 }, 9860 cascade : function(g, e, b) { 9861 if (g.apply(e || this, b || [this]) !== false) { 9862 if (this.items) { 9863 var d = this.items.items; 9864 for (var c = 0, a = d.length; c < a; c++) { 9865 if (d[c].cascade) { 9866 d[c].cascade(g, e, b) 9867 } else { 9868 g.apply(e || d[c], b || [d[c]]) 9869 } 9870 } 9871 } 9872 } 9873 return this 9874 }, 9875 findById : function(c) { 9876 var a = null, b = this; 9877 this.cascade(function(d) { 9878 if (b != d && d.id === c) { 9879 a = d; 9880 return false 9881 } 9882 }); 9883 return a 9884 }, 9885 findByType : function(b, a) { 9886 return this.findBy(function(d) { 9887 return d.isXType(b, a) 9888 }) 9889 }, 9890 find : function(b, a) { 9891 return this.findBy(function(d) { 9892 return d[b] === a 9893 }) 9894 }, 9895 findBy : function(d, c) { 9896 var a = [], b = this; 9897 this.cascade(function(e) { 9898 if (b != e && d.call(c || e, e, b) === true) { 9899 a.push(e) 9900 } 9901 }); 9902 return a 9903 }, 9904 get : function(a) { 9905 return this.getComponent(a) 9906 } 9907}); 9908Ext.Container.LAYOUTS = {}; 9909Ext.reg("container", Ext.Container); 9910Ext.layout.ContainerLayout = Ext.extend(Object, { 9911 monitorResize : false, 9912 activeItem : null, 9913 constructor : function(a) { 9914 this.id = Ext.id(null, "ext-layout-"); 9915 Ext.apply(this, a) 9916 }, 9917 type : "container", 9918 IEMeasureHack : function(k, g) { 9919 var a = k.dom.childNodes, b = a.length, n, m = [], l, h, j; 9920 for (h = 0; h < b; h++) { 9921 n = a[h]; 9922 l = Ext.get(n); 9923 if (l) { 9924 m[h] = l.getStyle("display"); 9925 l.setStyle({ 9926 display : "none" 9927 }) 9928 } 9929 } 9930 j = k ? k.getViewSize(g) : {}; 9931 for (h = 0; h < b; h++) { 9932 n = a[h]; 9933 l = Ext.get(n); 9934 if (l) { 9935 l.setStyle({ 9936 display : m[h] 9937 }) 9938 } 9939 } 9940 return j 9941 }, 9942 getLayoutTargetSize : Ext.EmptyFn, 9943 layout : function() { 9944 var a = this.container, b = a.getLayoutTarget(); 9945 if (!(this.hasLayout || Ext.isEmpty(this.targetCls))) { 9946 b.addClass(this.targetCls) 9947 } 9948 this.onLayout(a, b); 9949 a.fireEvent("afterlayout", a, this) 9950 }, 9951 onLayout : function(a, b) { 9952 this.renderAll(a, b) 9953 }, 9954 isValidParent : function(b, a) { 9955 return a && b.getPositionEl().dom.parentNode == (a.dom || a) 9956 }, 9957 renderAll : function(e, g) { 9958 var b = e.items.items, d, h, a = b.length; 9959 for (d = 0; d < a; d++) { 9960 h = b[d]; 9961 if (h && (!h.rendered || !this.isValidParent(h, g))) { 9962 this.renderItem(h, d, g) 9963 } 9964 } 9965 }, 9966 renderItem : function(d, a, b) { 9967 if (d) { 9968 if (!d.rendered) { 9969 d.render(b, a); 9970 this.configureItem(d) 9971 } else { 9972 if (!this.isValidParent(d, b)) { 9973 if (Ext.isNumber(a)) { 9974 a = b.dom.childNodes[a] 9975 } 9976 b.dom.insertBefore(d.getPositionEl().dom, a || null); 9977 d.container = b; 9978 this.configureItem(d) 9979 } 9980 } 9981 } 9982 }, 9983 getRenderedItems : function(g) { 9984 var e = g.getLayoutTarget(), h = g.items.items, a = h.length, d, j, b = []; 9985 for (d = 0; d < a; d++) { 9986 if ((j = h[d]).rendered && this.isValidParent(j, e) 9987 && j.shouldLayout !== false) { 9988 b.push(j) 9989 } 9990 } 9991 return b 9992 }, 9993 configureItem : function(b) { 9994 if (this.extraCls) { 9995 var a = b.getPositionEl ? b.getPositionEl() : b; 9996 a.addClass(this.extraCls) 9997 } 9998 if (b.doLayout && this.forceLayout) { 9999 b.doLayout() 10000 } 10001 if (this.renderHidden && b != this.activeItem) { 10002 b.hide() 10003 } 10004 }, 10005 onRemove : function(b) { 10006 if (this.activeItem == b) { 10007 delete this.activeItem 10008 } 10009 if (b.rendered && this.extraCls) { 10010 var a = b.getPositionEl ? b.getPositionEl() : b; 10011 a.removeClass(this.extraCls) 10012 } 10013 }, 10014 afterRemove : function(a) { 10015 if (a.removeRestore) { 10016 a.removeMode = "container"; 10017 delete a.removeRestore 10018 } 10019 }, 10020 onResize : function() { 10021 var c = this.container, a; 10022 if (c.collapsed) { 10023 return 10024 } 10025 if (a = c.bufferResize && c.shouldBufferLayout()) { 10026 if (!this.resizeTask) { 10027 this.resizeTask = new Ext.util.DelayedTask(this.runLayout, this); 10028 this.resizeBuffer = Ext.isNumber(a) ? a : 50 10029 } 10030 c.layoutPending = true; 10031 this.resizeTask.delay(this.resizeBuffer) 10032 } else { 10033 this.runLayout() 10034 } 10035 }, 10036 runLayout : function() { 10037 var a = this.container; 10038 this.layout(); 10039 a.onLayout(); 10040 delete a.layoutPending 10041 }, 10042 setContainer : function(b) { 10043 if (this.monitorResize && b != this.container) { 10044 var a = this.container; 10045 if (a) { 10046 a.un(a.resizeEvent, this.onResize, this) 10047 } 10048 if (b) { 10049 b.on(b.resizeEvent, this.onResize, this) 10050 } 10051 } 10052 this.container = b 10053 }, 10054 parseMargins : function(b) { 10055 if (Ext.isNumber(b)) { 10056 b = b.toString() 10057 } 10058 var c = b.split(" "), a = c.length; 10059 if (a == 1) { 10060 c[1] = c[2] = c[3] = c[0] 10061 } else { 10062 if (a == 2) { 10063 c[2] = c[0]; 10064 c[3] = c[1] 10065 } else { 10066 if (a == 3) { 10067 c[3] = c[1] 10068 } 10069 } 10070 } 10071 return { 10072 top : parseInt(c[0], 10) || 0, 10073 right : parseInt(c[1], 10) || 0, 10074 bottom : parseInt(c[2], 10) || 0, 10075 left : parseInt(c[3], 10) || 0 10076 } 10077 }, 10078 fieldTpl : (function() { 10079 var a = new Ext.Template( 10080 '<div class="x-form-item {itemCls}" tabIndex="-1">', 10081 '<label for="{id}" style="{labelStyle}" class="x-form-item-label">{label}{labelSeparator}</label>', 10082 '<div class="x-form-element" id="x-form-el-{id}" style="{elementStyle}">', 10083 '</div><div class="{clearCls}"></div>', "</div>"); 10084 a.disableFormats = true; 10085 return a.compile() 10086 })(), 10087 destroy : function() { 10088 if (this.resizeTask && this.resizeTask.cancel) { 10089 this.resizeTask.cancel() 10090 } 10091 if (this.container) { 10092 this.container.un(this.container.resizeEvent, this.onResize, this) 10093 } 10094 if (!Ext.isEmpty(this.targetCls)) { 10095 var a = this.container.getLayoutTarget(); 10096 if (a) { 10097 a.removeClass(this.targetCls) 10098 } 10099 } 10100 } 10101}); 10102Ext.layout.AutoLayout = Ext.extend(Ext.layout.ContainerLayout, { 10103 type : "auto", 10104 monitorResize : true, 10105 onLayout : function(d, g) { 10106 Ext.layout.AutoLayout.superclass.onLayout.call(this, d, g); 10107 var e = this.getRenderedItems(d), a = e.length, b, h; 10108 for (b = 0; b < a; b++) { 10109 h = e[b]; 10110 if (h.doLayout) { 10111 h.doLayout(true) 10112 } 10113 } 10114 } 10115 }); 10116Ext.Container.LAYOUTS.auto = Ext.layout.AutoLayout; 10117Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, { 10118 monitorResize : true, 10119 type : "fit",
10120 getLayoutTargetSize : function() { 10121 var a = this.container.getLayoutTarget(); 10122 if (!a) { 10123 return {} 10124 } 10125 return a.getStyleSize() 10126 }, 10127 onLayout : function(a, b) { 10128 Ext.layout.FitLayout.superclass.onLayout.call(this, a, b); 10129 if (!a.collapsed) { 10130 this.setItemSize(this.activeItem || a.items.itemAt(0), this 10131 .getLayoutTargetSize()) 10132 } 10133 }, 10134 setItemSize : function(b, a) { 10135 if (b && a.height > 0) { 10136 b.setSize(a) 10137 } 10138 } 10139 }); 10140Ext.Container.LAYOUTS.fit = Ext.layout.FitLayout; 10141Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, { 10142 deferredRender : false, 10143 layoutOnCardChange : false, 10144 renderHidden : true, 10145 type : "card", 10146 setActiveItem : function(d) { 10147 var a = this.activeItem, b = this.container; 10148 d = b.getComponent(d); 10149 if (d && a != d) { 10150 if (a) { 10151 a.hide(); 10152 if (a.hidden !== true) { 10153 return false 10154 } 10155 a.fireEvent("deactivate", a) 10156 } 10157 var c = d.doLayout 10158 && (this.layoutOnCardChange || !d.rendered); 10159 this.activeItem = d; 10160 delete d.deferLayout; 10161 d.show(); 10162 this.layout(); 10163 if (c) { 10164 d.doLayout() 10165 } 10166 d.fireEvent("activate", d) 10167 } 10168 }, 10169 renderAll : function(a, b) { 10170 if (this.deferredRender) { 10171 this.renderItem(this.activeItem, undefined, b) 10172 } else { 10173 Ext.layout.CardLayout.superclass.renderAll.call(this, a, b) 10174 } 10175 } 10176 }); 10177Ext.Container.LAYOUTS.card = Ext.layout.CardLayout; 10178Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, { 10179 monitorResize : true, 10180 type : "anchor", 10181 defaultAnchor : "100%", 10182 parseAnchorRE : /^(r|right|b|bottom)$/i, 10183 getLayoutTargetSize : function() { 10184 var b = this.container.getLayoutTarget(), a = {}; 10185 if (b) { 10186 a = b.getViewSize(); 10187 if (Ext.isIE && Ext.isStrict && a.width == 0) { 10188 a = b.getStyleSize() 10189 } 10190 a.width -= b.getPadding("lr"); 10191 a.height -= b.getPadding("tb") 10192 } 10193 return a 10194 }, 10195 onLayout : function(m, w) { 10196 Ext.layout.AnchorLayout.superclass.onLayout.call(this, m, w); 10197 var p = this.getLayoutTargetSize(), k = p.width, o = p.height, q = w 10198 .getStyle("overflow"), n = this.getRenderedItems(m), t = n.length, g = [], j, a, v, l, h, c, e, d, u = 0, s, b; 10199 if (k < 20 && o < 20) { 10200 return 10201 } 10202 if (m.anchorSize) { 10203 if (typeof m.anchorSize == "number") { 10204 a = m.anchorSize 10205 } else { 10206 a = m.anchorSize.width; 10207 v = m.anchorSize.height 10208 } 10209 } else { 10210 a = m.initialConfig.width; 10211 v = m.initialConfig.height 10212 } 10213 for (s = 0; s < t; s++) { 10214 l = n[s]; 10215 b = l.getPositionEl(); 10216 if (!l.anchor && l.items && !Ext.isNumber(l.width) 10217 && !(Ext.isIE6 && Ext.isStrict)) { 10218 l.anchor = this.defaultAnchor 10219 } 10220 if (l.anchor) { 10221 h = l.anchorSpec; 10222 if (!h) { 10223 d = l.anchor.split(" "); 10224 l.anchorSpec = h = { 10225 right : this 10226 .parseAnchor(d[0], l.initialConfig.width, a), 10227 bottom : this.parseAnchor(d[1], l.initialConfig.height, 10228 v) 10229 } 10230 } 10231 c = h.right ? this.adjustWidthAnchor(h.right(k) 10232 - b.getMargins("lr"), l) : undefined; 10233 e = h.bottom ? this.adjustHeightAnchor(h.bottom(o) 10234 - b.getMargins("tb"), l) : undefined; 10235 if (c || e) { 10236 g.push({ 10237 component : l, 10238 width : c || undefined, 10239 height : e || undefined 10240 }) 10241 } 10242 } 10243 } 10244 for (s = 0, t = g.length; s < t; s++) { 10245 j = g[s]; 10246 j.component.setSize(j.width, j.height) 10247 } 10248 if (q && q != "hidden" && !this.adjustmentPass) { 10249 var r = this.getLayoutTargetSize(); 10250 if (r.width != p.width || r.height != p.height) { 10251 this.adjustmentPass = true; 10252 this.onLayout(m, w) 10253 } 10254 } 10255 delete this.adjustmentPass 10256 }, 10257 parseAnchor : function(c, h, b) { 10258 if (c && c != "none") { 10259 var e; 10260 if (this.parseAnchorRE.test(c)) { 10261 var g = b - h; 10262 return function(a) { 10263 if (a !== e) { 10264 e = a; 10265 return a - g 10266 } 10267 } 10268 } else { 10269 if (c.indexOf("%") != -1) { 10270 var d = parseFloat(c.replace("%", "")) * 0.01; 10271 return function(a) { 10272 if (a !== e) { 10273 e = a; 10274 return Math.floor(a * d) 10275 } 10276 } 10277 } else { 10278 c = parseInt(c, 10); 10279 if (!isNaN(c)) { 10280 return function(a) { 10281 if (a !== e) { 10282 e = a; 10283 return a + c 10284 } 10285 } 10286 } 10287 } 10288 } 10289 } 10290 return false 10291 }, 10292 adjustWidthAnchor : function(b, a) { 10293 return b 10294 }, 10295 adjustHeightAnchor : function(b, a) { 10296 return b 10297 } 10298}); 10299Ext.Container.LAYOUTS.anchor = Ext.layout.AnchorLayout; 10300Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, { 10301 monitorResize : true, 10302 type : "column", 10303 extraCls : "x-column", 10304 scrollOffset : 0, 10305 targetCls : "x-column-layout-ct", 10306 isValidParent : function(b, a) { 10307 return this.innerCt 10308 && b.getPositionEl().dom.parentNode == this.innerCt.dom 10309 },
10310 getLayoutTargetSize : function() { 10311 var b = this.container.getLayoutTarget(), a; 10312 if (b) { 10313 a = b.getViewSize(); 10314 if (Ext.isIE && Ext.isStrict && a.width == 0) { 10315 a = b.getStyleSize() 10316 } 10317 a.width -= b.getPadding("lr"); 10318 a.height -= b.getPadding("tb") 10319 } 10320 return a 10321 }, 10322 renderAll : function(a, b) { 10323 if (!this.innerCt) { 10324 this.innerCt = b.createChild({ 10325 cls : "x-column-inner" 10326 }); 10327 this.innerCt.createChild({ 10328 cls : "x-clear" 10329 }) 10330 } 10331 Ext.layout.ColumnLayout.superclass.renderAll.call(this, a, 10332 this.innerCt) 10333 }, 10334 onLayout : function(e, k) { 10335 var g = e.items.items, j = g.length, n, b, a, o = []; 10336 this.renderAll(e, k); 10337 var r = this.getLayoutTargetSize(); 10338 if (r.width < 1 && r.height < 1) { 10339 return 10340 } 10341 var p = r.width - this.scrollOffset, d = r.height, q = p; 10342 this.innerCt.setWidth(p); 10343 for (b = 0; b < j; b++) { 10344 n = g[b]; 10345 a = n.getPositionEl().getMargins("lr"); 10346 o[b] = a; 10347 if (!n.columnWidth) { 10348 q -= (n.getWidth() + a) 10349 } 10350 } 10351 q = q < 0 ? 0 : q; 10352 for (b = 0; b < j; b++) { 10353 n = g[b]; 10354 a = o[b]; 10355 if (n.columnWidth) { 10356 n.setSize(Math.floor(n.columnWidth * q) - a) 10357 } 10358 } 10359 if (Ext.isIE) { 10360 if (b = k.getStyle("overflow") && b != "hidden" 10361 && !this.adjustmentPass) { 10362 var l = this.getLayoutTargetSize(); 10363 if (l.width != r.width) { 10364 this.adjustmentPass = true; 10365 this.onLayout(e, k) 10366 } 10367 } 10368 } 10369 delete this.adjustmentPass 10370 } 10371 }); 10372Ext.Container.LAYOUTS.column = Ext.layout.ColumnLayout; 10373Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, { 10374 monitorResize : true, 10375 rendered : false, 10376 type : "border", 10377 targetCls : "x-border-layout-ct", 10378 getLayoutTargetSize : function() { 10379 var a = this.container.getLayoutTarget(); 10380 return a ? a.getViewSize() : {} 10381 }, 10382 onLayout : function(g, I) { 10383 var j, B, F, o, x = g.items.items, C = x.length; 10384 if (!this.rendered) { 10385 j = []; 10386 for (B = 0; B < C; B++) { 10387 F = x[B]; 10388 o = F.region; 10389 if (F.collapsed) { 10390 j.push(F) 10391 } 10392 F.collapsed = false; 10393 if (!F.rendered) { 10394 F.render(I, B); 10395 F.getPositionEl().addClass("x-border-panel") 10396 } 10397 this[o] = o != "center" && F.split 10398 ? new Ext.layout.BorderLayout.SplitRegion(this, 10399 F.initialConfig, o) 10400 : new Ext.layout.BorderLayout.Region(this, 10401 F.initialConfig, o); 10402 this[o].render(I, F) 10403 } 10404 this.rendered = true 10405 } 10406 var v = this.getLayoutTargetSize(); 10407 if (v.width < 20 || v.height < 20) { 10408 if (j) { 10409 this.restoreCollapsed = j 10410 } 10411 return 10412 } else { 10413 if (this.restoreCollapsed) { 10414 j = this.restoreCollapsed; 10415 delete this.restoreCollapsed 10416 } 10417 } 10418 var t = v.width, D = v.height, r = t, A = D, p = 0, q = 0, y = this.north, u = this.south, l = this.west, E = this.east, F = this.center, H, z, d, G; 10419 if (!F && Ext.layout.BorderLayout.WARN !== false) { 10420 throw "No center region defined in BorderLayout " + g.id 10421 } 10422 if (y && y.isVisible()) { 10423 H = y.getSize(); 10424 z = y.getMargins(); 10425 H.width = t - (z.left + z.right); 10426 H.x = z.left; 10427 H.y = z.top; 10428 p = H.height + H.y + z.bottom; 10429 A -= p; 10430 y.applyLayout(H) 10431 } 10432 if (u && u.isVisible()) { 10433 H = u.getSize(); 10434 z = u.getMargins(); 10435 H.width = t - (z.left + z.right); 10436 H.x = z.left; 10437 G = (H.height + z.top + z.bottom); 10438 H.y = D - G + z.top; 10439 A -= G; 10440 u.applyLayout(H) 10441 } 10442 if (l && l.isVisible()) { 10443 H = l.getSize(); 10444 z = l.getMargins(); 10445 H.height = A - (z.top + z.bottom); 10446 H.x = z.left; 10447 H.y = p + z.top; 10448 d = (H.width + z.left + z.right); 10449 q += d; 10450 r -= d; 10451 l.applyLayout(H) 10452 } 10453 if (E && E.isVisible()) { 10454 H = E.getSize(); 10455 z = E.getMargins(); 10456 H.height = A - (z.top + z.bottom); 10457 d = (H.width + z.left + z.right); 10458 H.x = t - d + z.left; 10459 H.y = p + z.top; 10460 r -= d; 10461 E.applyLayout(H) 10462 } 10463 if (F) { 10464 z = F.getMargins(); 10465 var k = { 10466 x : q + z.left, 10467 y : p + z.top, 10468 width : r - (z.left + z.right), 10469 height : A - (z.top + z.bottom) 10470 }; 10471 F.applyLayout(k) 10472 } 10473 if (j) { 10474 for (B = 0, C = j.length; B < C; B++) { 10475 j[B].collapse(false) 10476 } 10477 } 10478 if (Ext.isIE && Ext.isStrict) { 10479 I.repaint() 10480 }
10481 if (B = I.getStyle("overflow") && B != "hidden" && !this.adjustmentPass) { 10482 var a = this.getLayoutTargetSize(); 10483 if (a.width != v.width || a.height != v.height) { 10484 this.adjustmentPass = true; 10485 this.onLayout(g, I) 10486 } 10487 } 10488 delete this.adjustmentPass 10489 }, 10490 destroy : function() { 10491 var b = ["north", "south", "east", "west"], a, c; 10492 for (a = 0; a < b.length; a++) { 10493 c = this[b[a]]; 10494 if (c) { 10495 if (c.destroy) { 10496 c.destroy() 10497 } else { 10498 if (c.split) { 10499 c.split.destroy(true) 10500 } 10501 } 10502 } 10503 } 10504 Ext.layout.BorderLayout.superclass.destroy.call(this) 10505 } 10506}); 10507Ext.layout.BorderLayout.Region = function(b, a, c) { 10508 Ext.apply(this, a); 10509 this.layout = b; 10510 this.position = c; 10511 this.state = {}; 10512 if (typeof this.margins == "string") { 10513 this.margins = this.layout.parseMargins(this.margins) 10514 } 10515 this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins); 10516 if (this.collapsible) { 10517 if (typeof this.cmargins == "string") { 10518 this.cmargins = this.layout.parseMargins(this.cmargins) 10519 } 10520 if (this.collapseMode == "mini" && !this.cmargins) { 10521 this.cmargins = { 10522 left : 0, 10523 top : 0, 10524 right : 0, 10525 bottom : 0 10526 } 10527 } else { 10528 this.cmargins = Ext.applyIf(this.cmargins || {}, c == "north" 10529 || c == "south" 10530 ? this.defaultNSCMargins 10531 : this.defaultEWCMargins) 10532 } 10533 } 10534}; 10535Ext.layout.BorderLayout.Region.prototype = { 10536 collapsible : false, 10537 split : false, 10538 floatable : true, 10539 minWidth : 50, 10540 minHeight : 50, 10541 defaultMargins : { 10542 left : 0, 10543 top : 0, 10544 right : 0, 10545 bottom : 0 10546 }, 10547 defaultNSCMargins : { 10548 left : 5, 10549 top : 5, 10550 right : 5, 10551 bottom : 5 10552 }, 10553 defaultEWCMargins : { 10554 left : 5, 10555 top : 0, 10556 right : 5, 10557 bottom : 0 10558 }, 10559 floatingZIndex : 100, 10560 isCollapsed : false, 10561 render : function(b, c) { 10562 this.panel = c; 10563 c.el.enableDisplayMode(); 10564 this.targetEl = b; 10565 this.el = c.el; 10566 var a = c.getState, d = this.position; 10567 c.getState = function() { 10568 return Ext.apply(a.call(c) || {}, this.state) 10569 }.createDelegate(this); 10570 if (d != "center") { 10571 c.allowQueuedExpand = false; 10572 c.on({ 10573 beforecollapse : this.beforeCollapse, 10574 collapse : this.onCollapse, 10575 beforeexpand : this.beforeExpand, 10576 expand : this.onExpand, 10577 hide : this.onHide, 10578 show : this.onShow, 10579 scope : this 10580 }); 10581 if (this.collapsible || this.floatable) { 10582 c.collapseEl = "el"; 10583 c.slideAnchor = this.getSlideAnchor() 10584 } 10585 if (c.tools && c.tools.toggle) { 10586 c.tools.toggle.addClass("x-tool-collapse-" + d); 10587 c.tools.toggle.addClassOnOver("x-tool-collapse-" + d + "-over") 10588 } 10589 } 10590 }, 10591 getCollapsedEl : function() { 10592 if (!this.collapsedEl) { 10593 if (!this.toolTemplate) { 10594 var b = new Ext.Template('<div class="x-tool x-tool-{id}"> </div>'); 10595 b.disableFormats = true; 10596 b.compile(); 10597 Ext.layout.BorderLayout.Region.prototype.toolTemplate = b 10598 } 10599 this.collapsedEl = this.targetEl.createChild({ 10600 cls : "x-layout-collapsed x-layout-collapsed-" 10601 + this.position, 10602 id : this.panel.id + "-xcollapsed" 10603 }); 10604 this.collapsedEl.enableDisplayMode("block"); 10605 if (this.collapseMode == "mini") { 10606 this.collapsedEl.addClass("x-layout-cmini-" + this.position); 10607 this.miniCollapsedEl = this.collapsedEl.createChild({ 10608 cls : "x-layout-mini x-layout-mini-" 10609 + this.position, 10610 html : " " 10611 }); 10612 this.miniCollapsedEl.addClassOnOver("x-layout-mini-over"); 10613 this.collapsedEl.addClassOnOver("x-layout-collapsed-over"); 10614 this.collapsedEl.on("click", this.onExpandClick, this, { 10615 stopEvent : true 10616 }) 10617 } else { 10618 if (this.collapsible !== false && !this.hideCollapseTool) { 10619 var a = this.expandToolEl = this.toolTemplate.append( 10620 this.collapsedEl.dom, { 10621 id : "expand-" + this.position 10622 }, true); 10623 a 10624 .addClassOnOver("x-tool-expand-" + this.position 10625 + "-over"); 10626 a.on("click", this.onExpandClick, this, { 10627 stopEvent : true 10628 }) 10629 } 10630 if (this.floatable !== false || this.titleCollapse) { 10631 this.collapsedEl.addClassOnOver("x-layout-collapsed-over"); 10632 this.collapsedEl.on("click", this[this.floatable 10633 ? "collapseClick" 10634 : "onExpandClick"], this) 10635 } 10636 } 10637 } 10638 return this.collapsedEl 10639 }, 10640 onExpandClick : function(a) { 10641 if (this.isSlid) { 10642 this.panel.expand(false) 10643 } else { 10644 this.panel.expand() 10645 } 10646 }, 10647 onCollapseClick : function(a) { 10648 this.panel.collapse() 10649 }, 10650 beforeCollapse : function(c, a) { 10651 this.lastAnim = a; 10652 if (this.splitEl) { 10653 this.splitEl.hide() 10654 } 10655 this.getCollapsedEl().show(); 10656 var b = this.panel.getEl(); 10657 this.originalZIndex = b.getStyle("z-index"); 10658 b.setStyle("z-index", 100); 10659 this.isCollapsed = true; 10660 this.layout.layout() 10661 }, 10662 onCollapse : function(a) { 10663 this.panel.el.setStyle("z-index", 1); 10664 if (this.lastAnim === false || this.panel.animCollapse === false) { 10665 this.getCollapsedEl().dom.style.visibility = "visible" 10666 } else { 10667 this.getCollapsedEl().slideIn(this.panel.slideAnchor, { 10668 duration : 0.2 10669 }) 10670 } 10671 this.state.collapsed = true; 10672 this.panel.saveState() 10673 }, 10674 beforeExpand : function(a) { 10675 if (this.isSlid) { 10676 this.afterSlideIn() 10677 } 10678 var b = this.getCollapsedEl(); 10679 this.el.show(); 10680 if (this.position == "east" || this.position == "west") { 10681 this.panel.setSize(undefined, b.getHeight()) 10682 } else { 10683 this.panel.setSize(b.getWidth(), undefined) 10684 } 10685 b.hide(); 10686 b.dom.style.visibility = "hidden"; 10687 this.panel.el.setStyle("z-index", this.floatingZIndex) 10688 }, 10689 onExpand : function() { 10690 this.isCollapsed = false; 10691 if (this.splitEl) { 10692 this.splitEl.show() 10693 } 10694 this.layout.layout(); 10695 this.panel.el.setStyle("z-index", this.originalZIndex); 10696 this.state.collapsed = false; 10697 this.panel.saveState() 10698 }, 10699 collapseClick : function(a) { 10700 if (this.isSlid) { 10701 a.stopPropagation(); 10702 this.slideIn() 10703 } else { 10704 a.stopPropagation(); 10705 this.slideOut() 10706 } 10707 }, 10708 onHide : function() { 10709 if (this.isCollapsed) { 10710 this.getCollapsedEl().hide() 10711 } else { 10712 if (this.splitEl) { 10713 this.splitEl.hide() 10714 } 10715 } 10716 }, 10717 onShow : function() { 10718 if (this.isCollapsed) { 10719 this.getCollapsedEl().show() 10720 } else { 10721 if (this.splitEl) { 10722 this.splitEl.show() 10723 } 10724 } 10725 }, 10726 isVisible : function() { 10727 return !this.panel.hidden 10728 }, 10729 getMargins : function() { 10730 return this.isCollapsed && this.cmargins ? this.cmargins : this.margins 10731 }, 10732 getSize : function() { 10733 return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel 10734 .getSize() 10735 }, 10736 setPanel : function(a) { 10737 this.panel = a 10738 }, 10739 getMinWidth : function() { 10740 return this.minWidth 10741 }, 10742 getMinHeight : function() { 10743 return this.minHeight 10744 }, 10745 applyLayoutCollapsed : function(a) { 10746 var b = this.getCollapsedEl(); 10747 b.setLeftTop(a.x, a.y); 10748 b.setSize(a.width, a.height) 10749 }, 10750 applyLayout : function(a) { 10751 if (this.isCollapsed) { 10752 this.applyLayoutCollapsed(a) 10753 } else { 10754 this.panel.setPosition(a.x, a.y); 10755 this.panel.setSize(a.width, a.height) 10756 } 10757 }, 10758 beforeSlide : function() { 10759 this.panel.beforeEffect() 10760 }, 10761 afterSlide : function() { 10762 this.panel.afterEffect() 10763 }, 10764 initAutoHide : function() { 10765 if (this.autoHide !== false) { 10766 if (!this.autoHideHd) { 10767 this.autoHideSlideTask = new Ext.util.DelayedTask(this.slideIn, 10768 this); 10769 this.autoHideHd = { 10770 mouseout : function(a) { 10771 if (!a.within(this.el, true)) { 10772 this.autoHideSlideTask.delay(500) 10773 } 10774 }, 10775 mouseover : function(a) { 10776 this.autoHideSlideTask.cancel() 10777 }, 10778 scope : this 10779 } 10780 } 10781 this.el.on(this.autoHideHd); 10782 this.collapsedEl.on(this.autoHideHd) 10783 } 10784 }, 10785 clearAutoHide : function() { 10786 if (this.autoHide !== false) { 10787 this.el.un("mouseout", this.autoHideHd.mouseout); 10788 this.el.un("mouseover", this.autoHideHd.mouseover); 10789 this.collapsedEl.un("mouseout", this.autoHideHd.mouseout); 10790 this.collapsedEl.un("mouseover", this.autoHideHd.mouseover) 10791 } 10792 }, 10793 clearMonitor : function() { 10794 Ext.getDoc().un("click", this.slideInIf, this) 10795 }, 10796 slideOut : function() { 10797 if (this.isSlid || this.el.hasActiveFx()) { 10798 return 10799 } 10800 this.isSlid = true; 10801 var b = this.panel.tools, c, a; 10802 if (b && b.toggle) { 10803 b.toggle.hide() 10804 } 10805 this.el.show(); 10806 a = this.panel.collapsed; 10807 this.panel.collapsed = false; 10808 if (this.position == "east" || this.position == "west") { 10809 c = this.panel.deferHeight; 10810 this.panel.deferHeight = false; 10811 this.panel.setSize(undefined, this.collapsedEl.getHeight()); 10812 this.panel.deferHeight = c 10813 } else { 10814 this.panel.setSize(this.collapsedEl.getWidth(), undefined) 10815 } 10816 this.panel.collapsed = a; 10817 this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top]; 10818 this.el.alignTo(this.collapsedEl, this.getCollapseAnchor()); 10819 this.el.setStyle("z-index", this.floatingZIndex + 2); 10820 this.panel.el.replaceClass("x-panel-collapsed", "x-panel-floating"); 10821 if (this.animFloat !== false) { 10822 this.beforeSlide(); 10823 this.el.slideIn(this.getSlideAnchor(), { 10824 callback : function() { 10825 this.afterSlide(); 10826 this.initAutoHide(); 10827 Ext.getDoc().on("click", this.slideInIf, this) 10828 }, 10829 scope : this, 10830 block : true 10831 }) 10832 } else { 10833 this.initAutoHide(); 10834 Ext.getDoc().on("click", this.slideInIf, this) 10835 } 10836 }, 10837 afterSlideIn : function() { 10838 this.clearAutoHide(); 10839 this.isSlid = false; 10840 this.clearMonitor(); 10841 this.el.setStyle("z-index", ""); 10842 this.panel.el.replaceClass("x-panel-floating", "x-panel-collapsed"); 10843 this.el.dom.style.left = this.restoreLT[0]; 10844 this.el.dom.style.top = this.restoreLT[1]; 10845 var a = this.panel.tools; 10846 if (a && a.toggle) { 10847 a.toggle.show() 10848 } 10849 }, 10850 slideIn : function(a) { 10851 if (!this.isSlid || this.el.hasActiveFx()) { 10852 Ext.callback(a); 10853 return 10854 } 10855 this.isSlid = false; 10856 if (this.animFloat !== false) { 10857 this.beforeSlide(); 10858 this.el.slideOut(this.getSlideAnchor(), { 10859 callback : function() { 10860 this.el.hide(); 10861 this.afterSlide(); 10862 this.afterSlideIn(); 10863 Ext.callback(a) 10864 }, 10865 scope : this, 10866 block : true 10867 }) 10868 } else { 10869 this.el.hide(); 10870 this.afterSlideIn() 10871 } 10872 }, 10873 slideInIf : function(a) { 10874 if (!a.within(this.el)) { 10875 this.slideIn() 10876 } 10877 }, 10878 anchors : { 10879 west : "left", 10880 east : "right", 10881 north : "top", 10882 south : "bottom" 10883 }, 10884 sanchors : { 10885 west : "l", 10886 east : "r", 10887 north : "t", 10888 south : "b" 10889 }, 10890 canchors : { 10891 west : "tl-tr", 10892 east : "tr-tl", 10893 north : "tl-bl", 10894 south : "bl-tl" 10895 }, 10896 getAnchor : function() { 10897 return this.anchors[this.position] 10898 }, 10899 getCollapseAnchor : function() { 10900 return this.canchors[this.position] 10901 }, 10902 getSlideAnchor : function() { 10903 return this.sanchors[this.position] 10904 }, 10905 getAlignAdj : function() { 10906 var a = this.cmargins; 10907 switch (this.position) { 10908 case "west" : 10909 return [0, 0]; 10910 break; 10911 case "east" : 10912 return [0, 0]; 10913 break; 10914 case "north" : 10915 return [0, 0]; 10916 break; 10917 case "south" : 10918 return [0, 0]; 10919 break 10920 } 10921 },
10922 getExpandAdj : function() { 10923 var b = this.collapsedEl, a = this.cmargins; 10924 switch (this.position) { 10925 case "west" : 10926 return [-(a.right + b.getWidth() + a.left), 0]; 10927 break; 10928 case "east" : 10929 return [a.right + b.getWidth() + a.left, 0]; 10930 break; 10931 case "north" : 10932 return [0, -(a.top + a.bottom + b.getHeight())]; 10933 break; 10934 case "south" : 10935 return [0, a.top + a.bottom + b.getHeight()]; 10936 break 10937 } 10938 }, 10939 destroy : function() { 10940 if (this.autoHideSlideTask && this.autoHideSlideTask.cancel) { 10941 this.autoHideSlideTask.cancel() 10942 } 10943 Ext.destroyMembers(this, "miniCollapsedEl", "collapsedEl", 10944 "expandToolEl") 10945 } 10946}; 10947Ext.layout.BorderLayout.SplitRegion = function(b, a, c) { 10948 Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, b, a, 10949 c); 10950 this.applyLayout = this.applyFns[c] 10951}; 10952Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, 10953 { 10954 splitTip : "Drag to resize.", 10955 collapsibleSplitTip : "Drag to resize. Double click to hide.", 10956 useSplitTips : false, 10957 splitSettings : { 10958 north : { 10959 orientation : Ext.SplitBar.VERTICAL, 10960 placement : Ext.SplitBar.TOP, 10961 maxFn : "getVMaxSize", 10962 minProp : "minHeight", 10963 maxProp : "maxHeight" 10964 }, 10965 south : { 10966 orientation : Ext.SplitBar.VERTICAL, 10967 placement : Ext.SplitBar.BOTTOM, 10968 maxFn : "getVMaxSize", 10969 minProp : "minHeight", 10970 maxProp : "maxHeight" 10971 }, 10972 east : { 10973 orientation : Ext.SplitBar.HORIZONTAL, 10974 placement : Ext.SplitBar.RIGHT, 10975 maxFn : "getHMaxSize", 10976 minProp : "minWidth", 10977 maxProp : "maxWidth" 10978 }, 10979 west : { 10980 orientation : Ext.SplitBar.HORIZONTAL, 10981 placement : Ext.SplitBar.LEFT, 10982 maxFn : "getHMaxSize", 10983 minProp : "minWidth", 10984 maxProp : "maxWidth" 10985 } 10986 }, 10987 applyFns : { 10988 west : function(c) { 10989 if (this.isCollapsed) { 10990 return this.applyLayoutCollapsed(c) 10991 } 10992 var d = this.splitEl.dom, b = d.style; 10993 this.panel.setPosition(c.x, c.y); 10994 var a = d.offsetWidth; 10995 b.left = (c.x + c.width - a) + "px"; 10996 b.top = (c.y) + "px"; 10997 b.height = Math.max(0, c.height) + "px"; 10998 this.panel.setSize(c.width - a, c.height) 10999 }, 11000 east : function(c) { 11001 if (this.isCollapsed) { 11002 return this.applyLayoutCollapsed(c) 11003 } 11004 var d = this.splitEl.dom, b = d.style; 11005 var a = d.offsetWidth; 11006 this.panel.setPosition(c.x + a, c.y); 11007 b.left = (c.x) + "px"; 11008 b.top = (c.y) + "px"; 11009 b.height = Math.max(0, c.height) + "px"; 11010 this.panel.setSize(c.width - a, c.height) 11011 }, 11012 north : function(c) { 11013 if (this.isCollapsed) { 11014 return this.applyLayoutCollapsed(c) 11015 } 11016 var d = this.splitEl.dom, b = d.style; 11017 var a = d.offsetHeight; 11018 this.panel.setPosition(c.x, c.y); 11019 b.left = (c.x) + "px"; 11020 b.top = (c.y + c.height - a) + "px"; 11021 b.width = Math.max(0, c.width) + "px"; 11022 this.panel.setSize(c.width, c.height - a) 11023 }, 11024 south : function(c) { 11025 if (this.isCollapsed) { 11026 return this.applyLayoutCollapsed(c) 11027 } 11028 var d = this.splitEl.dom, b = d.style; 11029 var a = d.offsetHeight; 11030 this.panel.setPosition(c.x, c.y + a); 11031 b.left = (c.x) + "px"; 11032 b.top = (c.y) + "px"; 11033 b.width = Math.max(0, c.width) + "px"; 11034 this.panel.setSize(c.width, c.height - a) 11035 } 11036 }, 11037 render : function(a, c) { 11038 Ext.layout.BorderLayout.SplitRegion.superclass.render.call( 11039 this, a, c); 11040 var d = this.position; 11041 this.splitEl = a.createChild({ 11042 cls : "x-layout-split x-layout-split-" + d, 11043 html : " ", 11044 id : this.panel.id + "-xsplit" 11045 }); 11046 11047 /* add : ch197cm : 2013.05.10 */ 11048 if (this.resizeCollapse === false) { 11049 this.splitEl.addClassOnOver("x-layout-split-over"); 11050 this.splitEl.on("click", this.onCollapseClick, this, { 11051 stopEvent : true 11052 }); 11053 } 11054 11055 if (this.collapseMode == "mini") { 11056 this.miniSplitEl = this.splitEl.createChild({ 11057 cls : "x-layout-mini x-layout-mini-" + d, 11058 html : " " 11059 });
11060 /* 11061 this.miniSplitEl.addClassOnOver("x-layout-mini-over"); 11062 this.miniSplitEl.on("click", this.onCollapseClick, this, { 11063 stopEvent : true 11064 }) 11065 */ 11066 } 11067 var b = this.splitSettings[d]; 11068 /* modify : ch197cm : 2013.05.10 > ì¤íë¦¿ë° ìì */ 11069 if (this.resizeCollapse !== false) { 11070 this.split = new Ext.SplitBar(this.splitEl.dom, c.el, b.orientation); 11071 this.split.tickSize = this.tickSize; 11072 this.split.placement = b.placement; 11073 this.split.getMaximumSize = this[b.maxFn].createDelegate(this); 11074 this.split.minSize = this.minSize || this[b.minProp]; 11075 this.split.on("beforeapply", this.onSplitMove, this); 11076 this.split.useShim = this.useShim === true; 11077 } 11078 11079 this.maxSize = this.maxSize || this[b.maxProp]; 11080 if (c.hidden) { 11081 this.splitEl.hide() 11082 } 11083 if (this.useSplitTips) { 11084 this.splitEl.dom.title = this.collapsible 11085 ? this.collapsibleSplitTip 11086 : this.splitTip 11087 } 11088 if (this.collapsible) { 11089 this.splitEl.on("dblclick", this.onCollapseClick, this) 11090 } 11091 }, 11092 getSize : function() { 11093 if (this.isCollapsed) { 11094 return this.collapsedEl.getSize() 11095 } 11096 var a = this.panel.getSize(); 11097 if (this.position == "north" || this.position == "south") { 11098 a.height += this.splitEl.dom.offsetHeight 11099 } else { 11100 a.width += this.splitEl.dom.offsetWidth 11101 } 11102 return a 11103 }, 11104 getHMaxSize : function() { 11105 var b = this.maxSize || 10000; 11106 var a = this.layout.center; 11107 return Math.min(b, (this.el.getWidth() + a.el.getWidth()) 11108 - a.getMinWidth()) 11109 }, 11110 getVMaxSize : function() { 11111 var b = this.maxSize || 10000; 11112 var a = this.layout.center; 11113 return Math.min(b, (this.el.getHeight() + a.el.getHeight()) 11114 - a.getMinHeight()) 11115 }, 11116 onSplitMove : function(b, a) { 11117 var c = this.panel.getSize(); 11118 this.lastSplitSize = a; 11119 if (this.position == "north" || this.position == "south") { 11120 this.panel.setSize(c.width, a); 11121 this.state.height = a 11122 } else { 11123 this.panel.setSize(a, c.height); 11124 this.state.width = a 11125 } 11126 this.layout.layout(); 11127 this.panel.saveState(); 11128 return false 11129 }, 11130 getSplitBar : function() { 11131 return this.split 11132 }, 11133 destroy : function() { 11134 Ext.destroy(this.miniSplitEl, this.split, this.splitEl); 11135 Ext.layout.BorderLayout.SplitRegion.superclass.destroy 11136 .call(this) 11137 } 11138 }); 11139Ext.Container.LAYOUTS.border = Ext.layout.BorderLayout; 11140Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, { 11141 labelSeparator : ":", 11142 trackLabels : true, 11143 type : "form", 11144 onRemove : function(d) { 11145 Ext.layout.FormLayout.superclass.onRemove.call(this, d); 11146 if (this.trackLabels) { 11147 d.un("show", this.onFieldShow, this); 11148 d.un("hide", this.onFieldHide, this) 11149 } 11150 var b = d.getPositionEl(), a = d.getItemCt && d.getItemCt(); 11151 if (d.rendered && a) { 11152 if (b && b.dom) { 11153 b.insertAfter(a) 11154 } 11155 Ext.destroy(a); 11156 Ext.destroyMembers(d, "label", "itemCt"); 11157 if (d.customItemCt) { 11158 Ext.destroyMembers(d, "getItemCt", "customItemCt") 11159 } 11160 } 11161 }, 11162 setContainer : function(a) { 11163 Ext.layout.FormLayout.superclass.setContainer.call(this, a); 11164 if (a.labelAlign) { 11165 a.addClass("x-form-label-" + a.labelAlign) 11166 } 11167 if (a.hideLabels) { 11168 Ext.apply(this, { 11169 labelStyle : "display:none", 11170 elementStyle : "padding-left:0;", 11171 labelAdjust : 0 11172 }) 11173 } else { 11174 this.labelSeparator = Ext.isDefined(a.labelSeparator) 11175 ? a.labelSeparator 11176 : this.labelSeparator; 11177 a.labelWidth = a.labelWidth || 100; 11178 if (Ext.isNumber(a.labelWidth)) { 11179 var b = Ext.isNumber(a.labelPad) ? a.labelPad : 5; 11180 Ext.apply(this, { 11181 labelAdjust : a.labelWidth + b, 11182 labelStyle : "width:" + a.labelWidth + "px;", 11183 elementStyle : "padding-left:" + (a.labelWidth + b) 11184 + "px" 11185 }) 11186 } 11187 if (a.labelAlign == "top") { 11188 Ext.apply(this, { 11189 labelStyle : "width:auto;", 11190 labelAdjust : 0, 11191 elementStyle : "padding-left:0;" 11192 }) 11193 } 11194 } 11195 }, 11196 isHide : function(a) { 11197 return a.hideLabel || this.container.hideLabels 11198 }, 11199 onFieldShow : function(a) { 11200 a.getItemCt().removeClass("x-hide-" + a.hideMode); 11201 if (a.isComposite) { 11202 a.doLayout() 11203 } 11204 }, 11205 onFieldHide : function(a) { 11206 a.getItemCt().addClass("x-hide-" + a.hideMode) 11207 }, 11208 getLabelStyle : function(e) { 11209 var b = "", c = [this.labelStyle, e]; 11210 for (var d = 0, a = c.length; d < a; ++d) { 11211 if (c[d]) { 11212 b += c[d]; 11213 if (b.substr(-1, 1) != ";") { 11214 b += ";" 11215 } 11216 } 11217 } 11218 return b 11219 }, 11220 renderItem : function(e, a, d) { 11221 if (e && (e.isFormField || e.fieldLabel) && e.inputType != "hidden") { 11222 var b = this.getTemplateArgs(e); 11223 if (Ext.isNumber(a)) { 11224 a = d.dom.childNodes[a] || null 11225 } 11226 if (a) { 11227 e.itemCt = this.fieldTpl.insertBefore(a, b, true) 11228 } else { 11229 e.itemCt = this.fieldTpl.append(d, b, true) 11230 } 11231 if (!e.getItemCt) { 11232 Ext.apply(e, { 11233 getItemCt : function() { 11234 return e.itemCt 11235 }, 11236 customItemCt : true 11237 }) 11238 } 11239 e.label = e.getItemCt().child("label.x-form-item-label"); 11240 if (!e.rendered) { 11241 e.render("x-form-el-" + e.id) 11242 } else { 11243 if (!this.isValidParent(e, d)) { 11244 Ext.fly("x-form-el-" + e.id).appendChild(e.getPositionEl()) 11245 } 11246 } 11247 if (this.trackLabels) { 11248 if (e.hidden) { 11249 this.onFieldHide(e) 11250 } 11251 e.on({ 11252 scope : this, 11253 show : this.onFieldShow, 11254 hide : this.onFieldHide 11255 }) 11256 } 11257 this.configureItem(e) 11258 } else { 11259 Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments) 11260 } 11261 }, 11262 getTemplateArgs : function(c) { 11263 var a = !c.fieldLabel || c.hideLabel, b = (c.itemCls 11264 || this.container.itemCls || "") 11265 + (c.hideLabel ? " x-hide-label" : ""); 11266 if (Ext.isIE9 && Ext.isIEQuirks && c instanceof Ext.form.TextField) { 11267 b += " x-input-wrapper" 11268 } 11269 return { 11270 id : c.id, 11271 label : c.fieldLabel, 11272 itemCls : b, 11273 clearCls : c.clearCls || "x-form-clear-left", 11274 labelStyle : this.getLabelStyle(c.labelStyle), 11275 elementStyle : this.elementStyle || "", 11276 labelSeparator : a ? "" : (Ext.isDefined(c.labelSeparator) 11277 ? c.labelSeparator 11278 : this.labelSeparator) 11279 } 11280 }, 11281 adjustWidthAnchor : function(a, d) { 11282 if (d.label && !this.isHide(d) && (this.container.labelAlign != "top")) { 11283 var b = Ext.isIE6 || (Ext.isIE && !Ext.isStrict); 11284 return a - this.labelAdjust + (b ? -3 : 0) 11285 } 11286 return a 11287 }, 11288 adjustHeightAnchor : function(a, b) { 11289 if (b.label && !this.isHide(b) && (this.container.labelAlign == "top")) { 11290 return a - b.label.getHeight() 11291 } 11292 return a 11293 }, 11294 isValidParent : function(b, a) { 11295 return a && this.container.getEl().contains(b.getPositionEl()) 11296 } 11297}); 11298Ext.Container.LAYOUTS.form = Ext.layout.FormLayout; 11299Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, { 11300 fill : true, 11301 autoWidth : true, 11302 titleCollapse : true, 11303 hideCollapseTool : false, 11304 collapseFirst : false, 11305 animate : false, 11306 sequence : false, 11307 activeOnTop : false, 11308 type : "accordion", 11309 renderItem : function(a) { 11310 if (this.animate === false) { 11311 a.animCollapse = false 11312 } 11313 a.collapsible = true; 11314 if (this.autoWidth) { 11315 a.autoWidth = true 11316 } 11317 if (this.titleCollapse) { 11318 a.titleCollapse = true 11319 } 11320 if (this.hideCollapseTool) { 11321 a.hideCollapseTool = true 11322 } 11323 if (this.collapseFirst !== undefined) { 11324 a.collapseFirst = this.collapseFirst 11325 } 11326 if (!this.activeItem && !a.collapsed) { 11327 this.setActiveItem(a, true) 11328 } else { 11329 if (this.activeItem && this.activeItem != a) { 11330 a.collapsed = true 11331 } 11332 } 11333 Ext.layout.AccordionLayout.superclass.renderItem.apply(this, arguments); 11334 a.header.addClass("x-accordion-hd");
11335 a.on("beforeexpand", this.beforeExpand, this) 11336 }, 11337 onRemove : function(a) { 11338 Ext.layout.AccordionLayout.superclass.onRemove.call(this, a); 11339 if (a.rendered) { 11340 a.header.removeClass("x-accordion-hd") 11341 } 11342 a.un("beforeexpand", this.beforeExpand, this) 11343 }, 11344 beforeExpand : function(c, b) { 11345 var a = this.activeItem; 11346 if (a) { 11347 if (this.sequence) { 11348 delete this.activeItem; 11349 if (!a.collapsed) { 11350 a.collapse({ 11351 callback : function() { 11352 c.expand(b || true) 11353 }, 11354 scope : this 11355 }); 11356 return false 11357 } 11358 } else { 11359 a.collapse(this.animate) 11360 } 11361 } 11362 this.setActive(c); 11363 if (this.activeOnTop) { 11364 c.el.dom.parentNode.insertBefore(c.el.dom, 11365 c.el.dom.parentNode.firstChild) 11366 } 11367 this.layout() 11368 }, 11369 setItemSize : function(g, e) { 11370 if (this.fill && g) { 11371 var d = 0, c, b = this.getRenderedItems(this.container), a = b.length, h; 11372 for (c = 0; c < a; c++) { 11373 if ((h = b[c]) != g && !h.hidden) { 11374 d += h.header.getHeight() 11375 } 11376 } 11377 e.height -= d; 11378 g.setSize(e) 11379 } 11380 }, 11381 setActiveItem : function(a) { 11382 this.setActive(a, true) 11383 }, 11384 setActive : function(c, b) { 11385 var a = this.activeItem; 11386 c = this.container.getComponent(c); 11387 if (a != c) { 11388 if (c.rendered && c.collapsed && b) { 11389 c.expand() 11390 } else { 11391 if (a) { 11392 a.fireEvent("deactivate", a) 11393 } 11394 this.activeItem = c; 11395 c.fireEvent("activate", c) 11396 } 11397 } 11398 } 11399}); 11400Ext.Container.LAYOUTS.accordion = Ext.layout.AccordionLayout; 11401Ext.layout.Accordion = Ext.layout.AccordionLayout; 11402Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, { 11403 monitorResize : false, 11404 type : "table", 11405 targetCls : "x-table-layout-ct", 11406 tableAttrs : null, 11407 setContainer : function(a) { 11408 Ext.layout.TableLayout.superclass.setContainer.call(this, a); 11409 this.currentRow = 0; 11410 this.currentColumn = 0; 11411 this.cells = [] 11412 }, 11413 onLayout : function(d, g) { 11414 var e = d.items.items, a = e.length, h, b; 11415 if (!this.table) { 11416 g.addClass("x-table-layout-ct"); 11417 this.table = g.createChild(Ext.apply({ 11418 tag : "table", 11419 cls : "x-table-layout", 11420 cellspacing : 0, 11421 cn : { 11422 tag : "tbody" 11423 } 11424 }, this.tableAttrs), null, true) 11425 } 11426 this.renderAll(d, g) 11427 }, 11428 getRow : function(a) { 11429 var b = this.table.tBodies[0].childNodes[a]; 11430 if (!b) { 11431 b = document.createElement("tr"); 11432 this.table.tBodies[0].appendChild(b) 11433 } 11434 return b 11435 }, 11436 getNextCell : function(j) { 11437 var a = this 11438 .getNextNonSpan(this.currentColumn, this.currentRow); 11439 var g = this.currentColumn = a[0], e = this.currentRow = a[1]; 11440 for (var i = e; i < e + (j.rowspan || 1); i++) { 11441 if (!this.cells[i]) { 11442 this.cells[i] = [] 11443 } 11444 for (var d = g; d < g + (j.colspan || 1); d++) { 11445 this.cells[i][d] = true 11446 } 11447 } 11448 var h = document.createElement("td"); 11449 if (j.cellId) { 11450 h.id = j.cellId 11451 } 11452 var b = "x-table-layout-cell"; 11453 if (j.cellCls) { 11454 b += " " + j.cellCls 11455 } 11456 h.className = b; 11457 if (j.colspan) { 11458 h.colSpan = j.colspan 11459 } 11460 if (j.rowspan) { 11461 h.rowSpan = j.rowspan 11462 } 11463 this.getRow(e).appendChild(h); 11464 return h 11465 }, 11466 getNextNonSpan : function(a, c) { 11467 var b = this.columns; 11468 while ((b && a >= b) || (this.cells[c] && this.cells[c][a])) { 11469 if (b && a >= b) { 11470 c++; 11471 a = 0 11472 } else { 11473 a++ 11474 } 11475 } 11476 return [a, c] 11477 }, 11478 renderItem : function(e, a, d) { 11479 if (!this.table) { 11480 this.table = d.createChild(Ext.apply({ 11481 tag : "table", 11482 cls : "x-table-layout", 11483 cellspacing : 0, 11484 cn : { 11485 tag : "tbody" 11486 } 11487 }, this.tableAttrs), null, true) 11488 } 11489 if (e && !e.rendered) { 11490 e.render(this.getNextCell(e)); 11491 this.configureItem(e) 11492 } else { 11493 if (e && !this.isValidParent(e, d)) { 11494 var b = this.getNextCell(e); 11495 b.insertBefore(e.getPositionEl().dom, null); 11496 e.container = Ext.get(b); 11497 this.configureItem(e) 11498 } 11499 } 11500 }, 11501 isValidParent : function(b, a) { 11502 return b.getPositionEl().up("table", 5).dom.parentNode === (a.dom || a) 11503 }, 11504 destroy : function() { 11505 delete this.table; 11506 Ext.layout.TableLayout.superclass.destroy.call(this) 11507 } 11508 }); 11509Ext.Container.LAYOUTS.table = Ext.layout.TableLayout; 11510Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, { 11511 extraCls : "x-abs-layout-item", 11512 type : "absolute",
11513 onLayout : function(a, b) { 11514 b.position(); 11515 this.paddingLeft = b.getPadding("l"); 11516 this.paddingTop = b.getPadding("t"); 11517 Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, a, b) 11518 }, 11519 adjustWidthAnchor : function(b, a) { 11520 return b ? b - a.getPosition(true)[0] + this.paddingLeft : b 11521 }, 11522 adjustHeightAnchor : function(b, a) { 11523 return b ? b - a.getPosition(true)[1] + this.paddingTop : b 11524 } 11525 }); 11526Ext.Container.LAYOUTS.absolute = Ext.layout.AbsoluteLayout; 11527Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, { 11528 defaultMargins : { 11529 left : 0, 11530 top : 0, 11531 right : 0, 11532 bottom : 0 11533 }, 11534 padding : "0", 11535 pack : "start", 11536 monitorResize : true, 11537 type : "box", 11538 scrollOffset : 0, 11539 extraCls : "x-box-item", 11540 targetCls : "x-box-layout-ct", 11541 innerCls : "x-box-inner", 11542 constructor : function(a) { 11543 Ext.layout.BoxLayout.superclass.constructor.call(this, a); 11544 if (Ext.isString(this.defaultMargins)) { 11545 this.defaultMargins = this.parseMargins(this.defaultMargins) 11546 } 11547 var d = this.overflowHandler; 11548 if (typeof d == "string") { 11549 d = { 11550 type : d 11551 } 11552 } 11553 var c = "none"; 11554 if (d && d.type != undefined) { 11555 c = d.type 11556 } 11557 var b = Ext.layout.boxOverflow[c]; 11558 if (b[this.type]) { 11559 b = b[this.type] 11560 } 11561 this.overflowHandler = new b(this, d) 11562 }, 11563 onLayout : function(b, h) { 11564 Ext.layout.BoxLayout.superclass.onLayout.call(this, b, h); 11565 var d = this.getLayoutTargetSize(), i = this.getVisibleItems(b), c = this 11566 .calculateChildBoxes(i, d), g = c.boxes, j = c.meta; 11567 if (d.width > 0) { 11568 var k = this.overflowHandler, a = j.tooNarrow 11569 ? "handleOverflow" 11570 : "clearOverflow"; 11571 var e = k[a](c, d); 11572 if (e) { 11573 if (e.targetSize) { 11574 d = e.targetSize 11575 } 11576 if (e.recalculate) { 11577 i = this.getVisibleItems(b); 11578 c = this.calculateChildBoxes(i, d); 11579 g = c.boxes 11580 } 11581 } 11582 } 11583 this.layoutTargetLastSize = d; 11584 this.childBoxCache = c; 11585 this.updateInnerCtSize(d, c); 11586 this.updateChildBoxes(g); 11587 this.handleTargetOverflow(d, b, h) 11588 }, 11589 updateChildBoxes : function(c) { 11590 for (var b = 0, e = c.length; b < e; b++) { 11591 var d = c[b], a = d.component; 11592 if (d.dirtySize) { 11593 a.setSize(d.width, d.height) 11594 } 11595 if (isNaN(d.left) || isNaN(d.top)) { 11596 continue 11597 } 11598 a.setPosition(d.left, d.top) 11599 } 11600 }, 11601 updateInnerCtSize : function(c, h) { 11602 var i = this.align, g = this.padding, e = c.width, a = c.height; 11603 if (this.type == "hbox") { 11604 var b = e, d = h.meta.maxHeight + g.top + g.bottom; 11605 if (i == "stretch") { 11606 d = a 11607 } else { 11608 if (i == "middle") { 11609 d = Math.max(a, d) 11610 } 11611 } 11612 } else { 11613 var d = a, b = h.meta.maxWidth + g.left + g.right; 11614 if (i == "stretch") { 11615 b = e 11616 } else { 11617 if (i == "center") { 11618 b = Math.max(e, b) 11619 } 11620 } 11621 } 11622 this.innerCt.setSize(b || undefined, d || undefined) 11623 }, 11624 handleTargetOverflow : function(d, a, c) { 11625 var e = c.getStyle("overflow"); 11626 if (e && e != "hidden" && !this.adjustmentPass) { 11627 var b = this.getLayoutTargetSize(); 11628 if (b.width != d.width || b.height != d.height) { 11629 this.adjustmentPass = true; 11630 this.onLayout(a, c) 11631 } 11632 } 11633 delete this.adjustmentPass 11634 }, 11635 isValidParent : function(b, a) { 11636 return this.innerCt 11637 && b.getPositionEl().dom.parentNode == this.innerCt.dom 11638 }, 11639 getVisibleItems : function(g) { 11640 var g = g || this.container, e = g.getLayoutTarget(), h = g.items.items, a = h.length, d, j, b = []; 11641 for (d = 0; d < a; d++) { 11642 if ((j = h[d]).rendered && this.isValidParent(j, e) 11643 && j.hidden !== true && j.collapsed !== true 11644 && j.shouldLayout !== false) { 11645 b.push(j) 11646 } 11647 } 11648 return b 11649 }, 11650 renderAll : function(a, b) { 11651 if (!this.innerCt) { 11652 this.innerCt = b.createChild({ 11653 cls : this.innerCls 11654 }); 11655 this.padding = this.parseMargins(this.padding) 11656 } 11657 Ext.layout.BoxLayout.superclass.renderAll.call(this, a, this.innerCt) 11658 }, 11659 getLayoutTargetSize : function() { 11660 var b = this.container.getLayoutTarget(), a; 11661 if (b) { 11662 a = b.getViewSize(); 11663 if (Ext.isIE && Ext.isStrict && a.width == 0) { 11664 a = b.getStyleSize() 11665 } 11666 a.width -= b.getPadding("lr"); 11667 a.height -= b.getPadding("tb") 11668 } 11669 return a 11670 }, 11671 renderItem : function(a) { 11672 if (Ext.isString(a.margins)) { 11673 a.margins = this.parseMargins(a.margins) 11674 } else { 11675 if (!a.margins) { 11676 a.margins = this.defaultMargins 11677 } 11678 } 11679 Ext.layout.BoxLayout.superclass.renderItem.apply(this, arguments) 11680 }, 11681 destroy : function() { 11682 Ext.destroy(this.overflowHandler); 11683 Ext.layout.BoxLayout.superclass.destroy.apply(this, arguments) 11684 } 11685}); 11686Ext.layout.boxOverflow.None = Ext.extend(Object, { 11687 constructor : function(b, a) { 11688 this.layout = b; 11689 Ext.apply(this, a || {}) 11690 }, 11691 handleOverflow : Ext.emptyFn, 11692 clearOverflow : Ext.emptyFn 11693 }); 11694Ext.layout.boxOverflow.none = Ext.layout.boxOverflow.None; 11695Ext.layout.boxOverflow.Menu = Ext.extend(Ext.layout.boxOverflow.None, { 11696 afterCls : "x-strip-right", 11697 noItemsMenuText : '<div class="x-toolbar-no-items">(None)</div>', 11698 constructor : function(a) { 11699 Ext.layout.boxOverflow.Menu.superclass.constructor.apply(this, 11700 arguments); 11701 this.menuItems = [] 11702 }, 11703 createInnerElements : function() { 11704 if (!this.afterCt) { 11705 this.afterCt = this.layout.innerCt.insertSibling({ 11706 cls : this.afterCls 11707 }, "before") 11708 } 11709 }, 11710 clearOverflow : function(a, g) { 11711 var e = g.width + (this.afterCt ? this.afterCt.getWidth() : 0), b = this.menuItems; 11712 this.hideTrigger(); 11713 for (var c = 0, d = b.length; c < d; c++) { 11714 b.pop().component.show() 11715 } 11716 return { 11717 targetSize : { 11718 height : g.height, 11719 width : e 11720 } 11721 } 11722 }, 11723 showTrigger : function() { 11724 this.createMenu(); 11725 this.menuTrigger.show() 11726 }, 11727 hideTrigger : function() { 11728 if (this.menuTrigger != undefined) { 11729 this.menuTrigger.hide() 11730 } 11731 }, 11732 beforeMenuShow : function(h) { 11733 var b = this.menuItems, a = b.length, g, e; 11734 var c = function(j, i) { 11735 return j.isXType("buttongroup") 11736 && !(i instanceof Ext.Toolbar.Separator) 11737 }; 11738 this.clearMenu(); 11739 h.removeAll(); 11740 for (var d = 0; d < a; d++) { 11741 g = b[d].component; 11742 if (e && (c(g, e) || c(e, g))) { 11743 h.add("-") 11744 } 11745 this.addComponentToMenu(h, g); 11746 e = g 11747 } 11748 if (h.items.length < 1) { 11749 h.add(this.noItemsMenuText) 11750 } 11751 }, 11752 createMenuConfig : function(c, a) { 11753 var b = Ext.apply({}, c.initialConfig), d = c.toggleGroup; 11754 Ext.copyTo(b, c, ["iconCls", "icon", "itemId", "disabled", "handler", 11755 "scope", "menu"]); 11756 Ext.apply(b, { 11757 text : c.overflowText || c.text, 11758 hideOnClick : a 11759 }); 11760 if (d || c.enableToggle) { 11761 Ext.apply(b, { 11762 group : d, 11763 checked : c.pressed, 11764 listeners : { 11765 checkchange : function(g, e) { 11766 c.toggle(e) 11767 } 11768 } 11769 }) 11770 } 11771 delete b.ownerCt; 11772 delete b.xtype; 11773 delete b.id; 11774 return b 11775 }, 11776 addComponentToMenu : function(b, a) { 11777 if (a instanceof Ext.Toolbar.Separator) { 11778 b.add("-") 11779 } else { 11780 if (Ext.isFunction(a.isXType)) { 11781 if (a.isXType("splitbutton")) { 11782 b.add(this.createMenuConfig(a, true)) 11783 } else { 11784 if (a.isXType("button")) { 11785 b.add(this.createMenuConfig(a, !a.menu)) 11786 } else { 11787 if (a.isXType("buttongroup")) { 11788 a.items.each(function(c) { 11789 this.addComponentToMenu(b, c) 11790 }, this) 11791 } 11792 } 11793 } 11794 } 11795 } 11796 }, 11797 clearMenu : function() { 11798 var a = this.moreMenu; 11799 if (a && a.items) { 11800 a.items.each(function(b) { 11801 delete b.menu 11802 }) 11803 } 11804 }, 11805 createMenu : function() { 11806 if (!this.menuTrigger) { 11807 this.createInnerElements(); 11808 this.menu = new Ext.menu.Menu({ 11809 ownerCt : this.layout.container, 11810 listeners : { 11811 scope : this, 11812 beforeshow : this.beforeMenuShow 11813 } 11814 });
11815 this.menuTrigger = new Ext.Button({ 11816 iconCls : "x-toolbar-more-icon", 11817 cls : "x-toolbar-more", 11818 menu : this.menu, 11819 renderTo : this.afterCt 11820 }) 11821 } 11822 }, 11823 destroy : function() { 11824 Ext.destroy(this.menu, this.menuTrigger) 11825 } 11826}); 11827Ext.layout.boxOverflow.menu = Ext.layout.boxOverflow.Menu; 11828Ext.layout.boxOverflow.HorizontalMenu = Ext.extend(Ext.layout.boxOverflow.Menu, 11829 { 11830 constructor : function() { 11831 Ext.layout.boxOverflow.HorizontalMenu.superclass.constructor 11832 .apply(this, arguments); 11833 var c = this, b = c.layout, a = b.calculateChildBoxes; 11834 b.calculateChildBoxes = function(d, i) { 11835 var l = a.apply(b, arguments), k = l.meta, e = c.menuItems; 11836 var j = 0; 11837 for (var g = 0, h = e.length; g < h; g++) { 11838 j += e[g].width 11839 } 11840 k.minimumWidth += j; 11841 k.tooNarrow = k.minimumWidth > i.width; 11842 return l 11843 } 11844 }, 11845 handleOverflow : function(d, h) { 11846 this.showTrigger(); 11847 var k = h.width - this.afterCt.getWidth(), l = d.boxes, e = 0, r = false; 11848 for (var o = 0, c = l.length; o < c; o++) { 11849 e += l[o].width 11850 } 11851 var a = k - e, g = 0; 11852 for (var o = 0, c = this.menuItems.length; o < c; o++) { 11853 var n = this.menuItems[o], m = n.component, b = n.width; 11854 if (b < a) { 11855 m.show(); 11856 a -= b; 11857 g++; 11858 r = true 11859 } else { 11860 break 11861 } 11862 } 11863 if (r) { 11864 this.menuItems = this.menuItems.slice(g) 11865 } else { 11866 for (var j = l.length - 1; j >= 0; j--) { 11867 var q = l[j].component, p = l[j].left + l[j].width; 11868 if (p >= k) { 11869 this.menuItems.unshift({ 11870 component : q, 11871 width : l[j].width 11872 }); 11873 q.hide() 11874 } else { 11875 break 11876 } 11877 } 11878 } 11879 if (this.menuItems.length == 0) { 11880 this.hideTrigger() 11881 } 11882 return { 11883 targetSize : { 11884 height : h.height, 11885 width : k 11886 }, 11887 recalculate : r 11888 } 11889 } 11890 }); 11891Ext.layout.boxOverflow.menu.hbox = Ext.layout.boxOverflow.HorizontalMenu; 11892Ext.layout.boxOverflow.Scroller = Ext.extend(Ext.layout.boxOverflow.None, { 11893 animateScroll : true, 11894 scrollIncrement : 100, 11895 wheelIncrement : 3, 11896 scrollRepeatInterval : 400, 11897 scrollDuration : 0.4, 11898 beforeCls : "x-strip-left", 11899 afterCls : "x-strip-right", 11900 scrollerCls : "x-strip-scroller", 11901 beforeScrollerCls : "x-strip-scroller-left", 11902 afterScrollerCls : "x-strip-scroller-right", 11903 createWheelListener : function() { 11904 this.layout.innerCt.on({ 11905 scope : this, 11906 mousewheel : function(a) { 11907 a.stopEvent(); 11908 this.scrollBy(a.getWheelDelta() * this.wheelIncrement 11909 * -1, false) 11910 } 11911 }) 11912 }, 11913 handleOverflow : function(a, b) { 11914 this.createInnerElements(); 11915 this.showScrollers() 11916 }, 11917 clearOverflow : function() { 11918 this.hideScrollers() 11919 }, 11920 showScrollers : function() { 11921 this.createScrollers(); 11922 this.beforeScroller.show(); 11923 this.afterScroller.show(); 11924 this.updateScrollButtons() 11925 }, 11926 hideScrollers : function() { 11927 if (this.beforeScroller != undefined) { 11928 this.beforeScroller.hide(); 11929 this.afterScroller.hide() 11930 } 11931 }, 11932 createScrollers : function() { 11933 if (!this.beforeScroller && !this.afterScroller) { 11934 var a = this.beforeCt.createChild({ 11935 cls : String.format("{0} {1} ", this.scrollerCls, 11936 this.beforeScrollerCls) 11937 }); 11938 var b = this.afterCt.createChild({ 11939 cls : String.format("{0} {1}", this.scrollerCls, 11940 this.afterScrollerCls) 11941 }); 11942 a.addClassOnOver(this.beforeScrollerCls + "-hover"); 11943 b.addClassOnOver(this.afterScrollerCls + "-hover"); 11944 a.setVisibilityMode(Ext.Element.DISPLAY); 11945 b.setVisibilityMode(Ext.Element.DISPLAY); 11946 this.beforeRepeater = new Ext.util.ClickRepeater(a, { 11947 interval : this.scrollRepeatInterval, 11948 handler : this.scrollLeft, 11949 scope : this 11950 }); 11951 this.afterRepeater = new Ext.util.ClickRepeater(b, { 11952 interval : this.scrollRepeatInterval, 11953 handler : this.scrollRight, 11954 scope : this 11955 }); 11956 this.beforeScroller = a; 11957 this.afterScroller = b 11958 } 11959 }, 11960 destroy : function() { 11961 Ext.destroy(this.beforeScroller, this.afterScroller, 11962 this.beforeRepeater, this.afterRepeater, this.beforeCt, 11963 this.afterCt) 11964 }, 11965 scrollBy : function(b, a) { 11966 this.scrollTo(this.getScrollPosition() + b, a) 11967 }, 11968 getItem : function(a) { 11969 if (Ext.isString(a)) { 11970 a = Ext.getCmp(a) 11971 } else { 11972 if (Ext.isNumber(a)) { 11973 a = this.items[a] 11974 } 11975 } 11976 return a 11977 }, 11978 getScrollAnim : function() { 11979 return { 11980 duration : this.scrollDuration, 11981 callback : this.updateScrollButtons, 11982 scope : this 11983 } 11984 }, 11985 updateScrollButtons : function() { 11986 if (this.beforeScroller == undefined || this.afterScroller == undefined) { 11987 return 11988 } 11989 var d = this.atExtremeBefore() ? "addClass" : "removeClass", c = this 11990 .atExtremeAfter() ? "addClass" : "removeClass", a = this.beforeScrollerCls 11991 + "-disabled", b = this.afterScrollerCls + "-disabled"; 11992 this.beforeScroller[d](a); 11993 this.afterScroller[c](b); 11994 this.scrolling = false 11995 }, 11996 atExtremeBefore : function() {
11997 return this.getScrollPosition() === 0 11998 }, 11999 scrollLeft : function(a) { 12000 this.scrollBy(-this.scrollIncrement, a) 12001 }, 12002 scrollRight : function(a) { 12003 this.scrollBy(this.scrollIncrement, a) 12004 }, 12005 scrollToItem : function(d, b) { 12006 d = this.getItem(d); 12007 if (d != undefined) { 12008 var a = this.getItemVisibility(d); 12009 if (!a.fullyVisible) { 12010 var c = d.getBox(true, true), e = c.x; 12011 if (a.hiddenRight) { 12012 e -= (this.layout.innerCt.getWidth() - c.width) 12013 } 12014 this.scrollTo(e, b) 12015 } 12016 } 12017 }, 12018 getItemVisibility : function(e) { 12019 var d = this.getItem(e).getBox(true, true), a = d.x, c = d.x + d.width, g = this 12020 .getScrollPosition(), b = this.layout.innerCt.getWidth() + g; 12021 return { 12022 hiddenLeft : a < g, 12023 hiddenRight : c > b, 12024 fullyVisible : a > g && c < b 12025 } 12026 } 12027}); 12028Ext.layout.boxOverflow.scroller = Ext.layout.boxOverflow.Scroller; 12029Ext.layout.boxOverflow.VerticalScroller = Ext.extend( 12030 Ext.layout.boxOverflow.Scroller, { 12031 scrollIncrement : 75, 12032 wheelIncrement : 2, 12033 handleOverflow : function(a, b) { 12034 Ext.layout.boxOverflow.VerticalScroller.superclass.handleOverflow 12035 .apply(this, arguments); 12036 return { 12037 targetSize : { 12038 height : b.height 12039 - (this.beforeCt.getHeight() + this.afterCt 12040 .getHeight()), 12041 width : b.width 12042 } 12043 } 12044 }, 12045 createInnerElements : function() { 12046 var a = this.layout.innerCt; 12047 if (!this.beforeCt) { 12048 this.beforeCt = a.insertSibling({ 12049 cls : this.beforeCls 12050 }, "before"); 12051 this.afterCt = a.insertSibling({ 12052 cls : this.afterCls 12053 }, "after"); 12054 this.createWheelListener() 12055 } 12056 }, 12057 scrollTo : function(a, b) { 12058 var d = this.getScrollPosition(), c = a.constrain(0, this 12059 .getMaxScrollBottom()); 12060 if (c != d && !this.scrolling) { 12061 if (b == undefined) { 12062 b = this.animateScroll 12063 } 12064 this.layout.innerCt.scrollTo("top", c, b ? this 12065 .getScrollAnim() : false); 12066 if (b) { 12067 this.scrolling = true 12068 } else { 12069 this.scrolling = false; 12070 this.updateScrollButtons() 12071 } 12072 } 12073 }, 12074 getScrollPosition : function() { 12075 return parseInt(this.layout.innerCt.dom.scrollTop, 10) || 0 12076 }, 12077 getMaxScrollBottom : function() { 12078 return this.layout.innerCt.dom.scrollHeight 12079 - this.layout.innerCt.getHeight() 12080 }, 12081 atExtremeAfter : function() { 12082 return this.getScrollPosition() >= this.getMaxScrollBottom() 12083 } 12084 }); 12085Ext.layout.boxOverflow.scroller.vbox = Ext.layout.boxOverflow.VerticalScroller; 12086Ext.layout.boxOverflow.HorizontalScroller = Ext.extend( 12087 Ext.layout.boxOverflow.Scroller, { 12088 handleOverflow : function(a, b) { 12089 Ext.layout.boxOverflow.HorizontalScroller.superclass.handleOverflow 12090 .apply(this, arguments); 12091 return { 12092 targetSize : { 12093 height : b.height, 12094 width : b.width 12095 - (this.beforeCt.getWidth() + this.afterCt 12096 .getWidth()) 12097 } 12098 } 12099 }, 12100 createInnerElements : function() { 12101 var a = this.layout.innerCt; 12102 if (!this.beforeCt) { 12103 this.afterCt = a.insertSibling({ 12104 cls : this.afterCls 12105 }, "before"); 12106 this.beforeCt = a.insertSibling({ 12107 cls : this.beforeCls 12108 }, "before"); 12109 this.createWheelListener() 12110 } 12111 }, 12112 scrollTo : function(a, b) { 12113 var d = this.getScrollPosition(), c = a.constrain(0, this 12114 .getMaxScrollRight()); 12115 if (c != d && !this.scrolling) { 12116 if (b == undefined) { 12117 b = this.animateScroll 12118 } 12119 this.layout.innerCt.scrollTo("left", c, b ? this 12120 .getScrollAnim() : false); 12121 if (b) { 12122 this.scrolling = true 12123 } else { 12124 this.scrolling = false; 12125 this.updateScrollButtons() 12126 } 12127 } 12128 }, 12129 getScrollPosition : function() { 12130 return parseInt(this.layout.innerCt.dom.scrollLeft, 10) || 0 12131 }, 12132 getMaxScrollRight : function() { 12133 return this.layout.innerCt.dom.scrollWidth 12134 - this.layout.innerCt.getWidth() 12135 }, 12136 atExtremeAfter : function() {
12137 return this.getScrollPosition() >= this.getMaxScrollRight() 12138 } 12139 }); 12140Ext.layout.boxOverflow.scroller.hbox = Ext.layout.boxOverflow.HorizontalScroller; 12141Ext.layout.HBoxLayout = Ext.extend(Ext.layout.BoxLayout, { 12142 align : "top", 12143 type : "hbox", 12144 calculateChildBoxes : function(r, b) { 12145 var F = r.length, R = this.padding, D = R.top, U = R.left, y = D 12146 + R.bottom, O = U + R.right, a = b.width - this.scrollOffset, e = b.height, o = Math 12147 .max(0, e - y), P = this.pack == "start", W = this.pack == "center", A = this.pack == "end", L = 0, Q = 0, T = 0, l = 0, X = 0, H = [], k, J, M, V, w, j, S, I, c, x, q, N; 12148 for (S = 0; S < F; S++) { 12149 k = r[S]; 12150 M = k.height; 12151 J = k.width; 12152 j = !k.hasLayout && typeof k.doLayout == "function"; 12153 if (typeof J != "number") { 12154 if (k.flex && !J) { 12155 T += k.flex 12156 } else { 12157 if (!J && j) { 12158 k.doLayout() 12159 } 12160 V = k.getSize(); 12161 J = V.width; 12162 M = V.height 12163 } 12164 } 12165 w = k.margins; 12166 x = w.left + w.right; 12167 L += x + (J || 0); 12168 l += x + (k.flex ? k.minWidth || 0 : J); 12169 X += x + (k.minWidth || J || 0); 12170 if (typeof M != "number") { 12171 if (j) { 12172 k.doLayout() 12173 } 12174 M = k.getHeight() 12175 } 12176 Q = Math.max(Q, M + w.top + w.bottom); 12177 H.push({ 12178 component : k, 12179 height : M || undefined, 12180 width : J || undefined 12181 }) 12182 } 12183 var K = l - a, p = X > a; 12184 var n = Math.max(0, a - L - O); 12185 if (p) { 12186 for (S = 0; S < F; S++) { 12187 H[S].width = r[S].minWidth || r[S].width || H[S].width 12188 } 12189 } else { 12190 if (K > 0) { 12191 var C = []; 12192 for (var E = 0, v = F; E < v; E++) { 12193 var B = r[E], t = B.minWidth || 0; 12194 if (B.flex) { 12195 H[E].width = t 12196 } else { 12197 C.push({ 12198 minWidth : t, 12199 available : H[E].width - t, 12200 index : E 12201 }) 12202 } 12203 } 12204 C.sort(function(Y, i) { 12205 return Y.available > i.available ? 1 : -1 12206 }); 12207 for (var S = 0, v = C.length; S < v; S++) { 12208 var G = C[S].index; 12209 if (G == undefined) { 12210 continue 12211 } 12212 var B = r[G], m = H[G], u = m.width, t = B.minWidth, d = Math 12213 .max(t, u - Math.ceil(K / (v - S))), g = u - d; 12214 H[G].width = d; 12215 K -= g 12216 } 12217 } else { 12218 var h = n, s = T; 12219 for (S = 0; S < F; S++) { 12220 k = r[S]; 12221 I = H[S]; 12222 w = k.margins; 12223 q = w.top + w.bottom; 12224 if (P && k.flex && !k.width) { 12225 c = Math.ceil((k.flex / s) * h); 12226 h -= c; 12227 s -= k.flex; 12228 I.width = c; 12229 I.dirtySize = true 12230 } 12231 } 12232 } 12233 } 12234 if (W) { 12235 U += n / 2 12236 } else { 12237 if (A) { 12238 U += n 12239 } 12240 } 12241 for (S = 0; S < F; S++) { 12242 k = r[S]; 12243 I = H[S]; 12244 w = k.margins; 12245 U += w.left; 12246 q = w.top + w.bottom; 12247 I.left = U; 12248 I.top = D + w.top; 12249 switch (this.align) { 12250 case "stretch" : 12251 N = o - q; 12252 I.height = N.constrain(k.minHeight || 0, k.maxHeight 12253 || 1000000); 12254 I.dirtySize = true; 12255 break; 12256 case "stretchmax" : 12257 N = Q - q; 12258 I.height = N.constrain(k.minHeight || 0, k.maxHeight 12259 || 1000000); 12260 I.dirtySize = true; 12261 break; 12262 case "middle" : 12263 var z = o - I.height - q; 12264 if (z > 0) { 12265 I.top = D + q + (z / 2) 12266 } 12267 } 12268 U += I.width + w.right 12269 } 12270 return { 12271 boxes : H, 12272 meta : { 12273 maxHeight : Q, 12274 nonFlexWidth : L, 12275 desiredWidth : l, 12276 minimumWidth : X, 12277 shortfall : l - a, 12278 tooNarrow : p 12279 } 12280 } 12281 } 12282}); 12283Ext.Container.LAYOUTS.hbox = Ext.layout.HBoxLayout; 12284Ext.layout.VBoxLayout = Ext.extend(Ext.layout.BoxLayout, { 12285 align : "left", 12286 type : "vbox", 12287 calculateChildBoxes : function(o, b) { 12288 var E = o.length, R = this.padding, C = R.top, V = R.left, x = C 12289 + R.bottom, O = V + R.right, a = b.width - this.scrollOffset, c = b.height, K = Math 12290 .max(0, a - O), P = this.pack == "start", X = this.pack == "center", z = this.pack == "end", k = 0, u = 0, U = 0, L = 0, m = 0, G = [], h, I, N, W, t, g, T, H, S, w, n, d, r; 12291 for (T = 0; T < E; T++) { 12292 h = o[T]; 12293 N = h.height; 12294 I = h.width; 12295 g = !h.hasLayout && typeof h.doLayout == "function"; 12296 if (typeof N != "number") { 12297 if (h.flex && !N) { 12298 U += h.flex 12299 } else { 12300 if (!N && g) { 12301 h.doLayout() 12302 } 12303 W = h.getSize(); 12304 I = W.width; 12305 N = W.height 12306 } 12307 } 12308 t = h.margins; 12309 n = t.top + t.bottom; 12310 k += n + (N || 0); 12311 L += n + (h.flex ? h.minHeight || 0 : N); 12312 m += n + (h.minHeight || N || 0); 12313 if (typeof I != "number") { 12314 if (g) { 12315 h.doLayout() 12316 } 12317 I = h.getWidth() 12318 } 12319 u = Math.max(u, I + t.left + t.right); 12320 G.push({ 12321 component : h, 12322 height : N || undefined, 12323 width : I || undefined 12324 }) 12325 } 12326 var M = L - c, l = m > c; 12327 var q = Math.max(0, (c - k - x)); 12328 if (l) { 12329 for (T = 0, r = E; T < r; T++) { 12330 G[T].height = o[T].minHeight || o[T].height || G[T].height 12331 } 12332 } else { 12333 if (M > 0) { 12334 var J = []; 12335 for (var D = 0, r = E; D < r; D++) { 12336 var A = o[D], s = A.minHeight || 0; 12337 if (A.flex) { 12338 G[D].height = s 12339 } else { 12340 J.push({ 12341 minHeight : s, 12342 available : G[D].height - s, 12343 index : D 12344 }) 12345 } 12346 } 12347 J.sort(function(Y, i) { 12348 return Y.available > i.available ? 1 : -1 12349 });
12350 for (var T = 0, r = J.length; T < r; T++) { 12351 var F = J[T].index; 12352 if (F == undefined) { 12353 continue 12354 } 12355 var A = o[F], j = G[F], v = j.height, s = A.minHeight, B = Math 12356 .max(s, v - Math.ceil(M / (r - T))), e = v - B; 12357 G[F].height = B; 12358 M -= e 12359 } 12360 } else { 12361 var Q = q, p = U; 12362 for (T = 0; T < E; T++) { 12363 h = o[T]; 12364 H = G[T]; 12365 t = h.margins; 12366 w = t.left + t.right; 12367 if (P && h.flex && !h.height) { 12368 S = Math.ceil((h.flex / p) * Q); 12369 Q -= S; 12370 p -= h.flex; 12371 H.height = S; 12372 H.dirtySize = true 12373 } 12374 } 12375 } 12376 } 12377 if (X) { 12378 C += q / 2 12379 } else { 12380 if (z) { 12381 C += q 12382 } 12383 } 12384 for (T = 0; T < E; T++) { 12385 h = o[T]; 12386 H = G[T]; 12387 t = h.margins; 12388 C += t.top; 12389 w = t.left + t.right; 12390 H.left = V + t.left; 12391 H.top = C; 12392 switch (this.align) { 12393 case "stretch" : 12394 d = K - w; 12395 H.width = d.constrain(h.minWidth || 0, h.maxWidth 12396 || 1000000); 12397 H.dirtySize = true; 12398 break; 12399 case "stretchmax" : 12400 d = u - w; 12401 H.width = d.constrain(h.minWidth || 0, h.maxWidth 12402 || 1000000); 12403 H.dirtySize = true; 12404 break; 12405 case "center" : 12406 var y = K - H.width - w; 12407 if (y > 0) { 12408 H.left = V + w + (y / 2) 12409 } 12410 } 12411 C += H.height + t.bottom 12412 } 12413 return { 12414 boxes : G, 12415 meta : { 12416 maxWidth : u, 12417 nonFlexHeight : k, 12418 desiredHeight : L, 12419 minimumHeight : m, 12420 shortfall : L - c, 12421 tooNarrow : l 12422 } 12423 } 12424 } 12425}); 12426Ext.Container.LAYOUTS.vbox = Ext.layout.VBoxLayout; 12427Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, { 12428 monitorResize : true, 12429 type : "toolbar", 12430 triggerWidth : 18, 12431 noItemsMenuText : '<div class="x-toolbar-no-items">(None)</div>', 12432 lastOverflow : false, 12433 tableHTML : ['<table cellspacing="0" class="x-toolbar-ct">', "<tbody>", 12434 "<tr>", '<td class="x-toolbar-left" align="{0}">', 12435 '<table cellspacing="0">', "<tbody>", 12436 '<tr class="x-toolbar-left-row"></tr>', "</tbody>", "</table>", 12437 "</td>", '<td class="x-toolbar-right" align="right">', 12438 '<table cellspacing="0" class="x-toolbar-right-ct">', "<tbody>", 12439 "<tr>", "<td>", '<table cellspacing="0">', "<tbody>", 12440 '<tr class="x-toolbar-right-row"></tr>', "</tbody>", "</table>", 12441 "</td>", "<td>", '<table cellspacing="0">', "<tbody>", 12442 '<tr class="x-toolbar-extras-row"></tr>', "</tbody>", "</table>", 12443 "</td>", "</tr>", "</tbody>", "</table>", "</td>", "</tr>", 12444 "</tbody>", "</table>"].join(""), 12445 onLayout : function(e, j) { 12446 if (!this.leftTr) { 12447 var h = e.buttonAlign == "center" ? "center" : "left"; 12448 j.addClass("x-toolbar-layout-ct"); 12449 j.insertHtml("beforeEnd", String.format(this.tableHTML, h)); 12450 this.leftTr = j.child("tr.x-toolbar-left-row", true); 12451 this.rightTr = j.child("tr.x-toolbar-right-row", true); 12452 this.extrasTr = j.child("tr.x-toolbar-extras-row", true); 12453 if (this.hiddenItem == undefined) { 12454 this.hiddenItems = [] 12455 } 12456 } 12457 var k = e.buttonAlign == "right" ? this.rightTr : this.leftTr, l = e.items.items, d = 0; 12458 for (var b = 0, g = l.length, m; b < g; b++, d++) { 12459 m = l[b]; 12460 if (m.isFill) { 12461 k = this.rightTr; 12462 d = -1 12463 } else { 12464 if (!m.rendered) { 12465 m.render(this.insertCell(m, k, d)); 12466 this.configureItem(m) 12467 } else { 12468 if (!m.xtbHidden && !this.isValidParent(m, k.childNodes[d])) { 12469 var a = this.insertCell(m, k, d); 12470 a.appendChild(m.getPositionEl().dom); 12471 m.container = Ext.get(a) 12472 } 12473 } 12474 } 12475 } 12476 this.cleanup(this.leftTr); 12477 this.cleanup(this.rightTr); 12478 this.cleanup(this.extrasTr); 12479 this.fitToSize(j) 12480 }, 12481 cleanup : function(b) { 12482 var e = b.childNodes, a, d; 12483 for (a = e.length - 1; a >= 0 && (d = e[a]); a--) { 12484 if (!d.firstChild) { 12485 b.removeChild(d) 12486 } 12487 } 12488 }, 12489 insertCell : function(e, b, a) { 12490 var d = document.createElement("td"); 12491 d.className = "x-toolbar-cell"; 12492 b.insertBefore(d, b.childNodes[a] || null); 12493 return d 12494 }, 12495 hideItem : function(a) { 12496 this.hiddenItems.push(a); 12497 a.xtbHidden = true; 12498 a.xtbWidth = a.getPositionEl().dom.parentNode.offsetWidth; 12499 a.hide() 12500 }, 12501 unhideItem : function(a) { 12502 a.show(); 12503 a.xtbHidden = false; 12504 this.hiddenItems.remove(a) 12505 }, 12506 getItemWidth : function(a) { 12507 return a.hidden 12508 ? (a.xtbWidth || 0) 12509 : a.getPositionEl().dom.parentNode.offsetWidth 12510 }, 12511 fitToSize : function(k) { 12512 if (this.container.enableOverflow === false) { 12513 return 12514 } 12515 var b = k.dom.clientWidth, j = k.dom.firstChild.offsetWidth, m = b 12516 - this.triggerWidth, a = this.lastWidth || 0, c = this.hiddenItems, e = c.length != 0, n = b >= a; 12517 this.lastWidth = b; 12518 if (j > b || (e && n)) { 12519 var l = this.container.items.items, h = l.length, d = 0, o; 12520 for (var g = 0; g < h; g++) { 12521 o = l[g]; 12522 if (!o.isFill) { 12523 d += this.getItemWidth(o); 12524 if (d > m) { 12525 if (!(o.hidden || o.xtbHidden)) { 12526 this.hideItem(o) 12527 } 12528 } else { 12529 if (o.xtbHidden) { 12530 this.unhideItem(o) 12531 } 12532 } 12533 } 12534 } 12535 } 12536 e = c.length != 0; 12537 if (e) { 12538 this.initMore(); 12539 if (!this.lastOverflow) { 12540 this.container 12541 .fireEvent("overflowchange", this.container, true); 12542 this.lastOverflow = true 12543 } 12544 } else { 12545 if (this.more) { 12546 this.clearMenu(); 12547 this.more.destroy(); 12548 delete this.more; 12549 if (this.lastOverflow) { 12550 this.container.fireEvent("overflowchange", this.container, 12551 false); 12552 this.lastOverflow = false 12553 } 12554 } 12555 } 12556 }, 12557 createMenuConfig : function(c, a) { 12558 var b = Ext.apply({}, c.initialConfig), d = c.toggleGroup; 12559 Ext.copyTo(b, c, ["iconCls", "icon", "itemId", "disabled", "handler", 12560 "scope", "menu"]); 12561 Ext.apply(b, { 12562 text : c.overflowText || c.text, 12563 hideOnClick : a 12564 }); 12565 if (d || c.enableToggle) { 12566 Ext.apply(b, { 12567 group : d, 12568 checked : c.pressed, 12569 listeners : { 12570 checkchange : function(g, e) { 12571 c.toggle(e) 12572 } 12573 } 12574 }) 12575 } 12576 delete b.ownerCt; 12577 delete b.xtype; 12578 delete b.id; 12579 return b 12580 }, 12581 addComponentToMenu : function(b, a) { 12582 if (a instanceof Ext.Toolbar.Separator) { 12583 b.add("-") 12584 } else { 12585 if (Ext.isFunction(a.isXType)) { 12586 if (a.isXType("splitbutton")) { 12587 b.add(this.createMenuConfig(a, true)) 12588 } else { 12589 if (a.isXType("button")) { 12590 b.add(this.createMenuConfig(a, !a.menu)) 12591 } else { 12592 if (a.isXType("buttongroup")) { 12593 a.items.each(function(c) { 12594 this.addComponentToMenu(b, c) 12595 }, this) 12596 } 12597 } 12598 } 12599 } 12600 } 12601 }, 12602 clearMenu : function() { 12603 var a = this.moreMenu; 12604 if (a && a.items) { 12605 a.items.each(function(b) { 12606 delete b.menu 12607 }) 12608 } 12609 }, 12610 beforeMoreShow : function(h) { 12611 var b = this.container.items.items, a = b.length, g, e; 12612 var c = function(j, i) { 12613 return j.isXType("buttongroup") 12614 && !(i instanceof Ext.Toolbar.Separator) 12615 }; 12616 this.clearMenu(); 12617 h.removeAll(); 12618 for (var d = 0; d < a; d++) { 12619 g = b[d]; 12620 if (g.xtbHidden) { 12621 if (e && (c(g, e) || c(e, g))) { 12622 h.add("-") 12623 } 12624 this.addComponentToMenu(h, g); 12625 e = g 12626 } 12627 } 12628 if (h.items.length < 1) { 12629 h.add(this.noItemsMenuText) 12630 } 12631 }, 12632 initMore : function() { 12633 if (!this.more) { 12634 this.moreMenu = new Ext.menu.Menu({ 12635 ownerCt : this.container, 12636 listeners : { 12637 beforeshow : this.beforeMoreShow, 12638 scope : this 12639 } 12640 });
12641 this.more = new Ext.Button({ 12642 iconCls : "x-toolbar-more-icon", 12643 cls : "x-toolbar-more", 12644 menu : this.moreMenu, 12645 ownerCt : this.container 12646 }); 12647 var a = this.insertCell(this.more, this.extrasTr, 100); 12648 this.more.render(a) 12649 } 12650 }, 12651 destroy : function() { 12652 Ext.destroy(this.more, this.moreMenu); 12653 delete this.leftTr; 12654 delete this.rightTr; 12655 delete this.extrasTr; 12656 Ext.layout.ToolbarLayout.superclass.destroy.call(this) 12657 } 12658}); 12659Ext.Container.LAYOUTS.toolbar = Ext.layout.ToolbarLayout; 12660Ext.layout.MenuLayout = Ext.extend(Ext.layout.ContainerLayout, { 12661 monitorResize : true, 12662 type : "menu", 12663 setContainer : function(a) { 12664 this.monitorResize = !a.floating; 12665 a.on("autosize", this.doAutoSize, this); 12666 Ext.layout.MenuLayout.superclass.setContainer.call(this, a) 12667 }, 12668 renderItem : function(g, b, e) { 12669 if (!this.itemTpl) { 12670 this.itemTpl = Ext.layout.MenuLayout.prototype.itemTpl = new Ext.XTemplate( 12671 '<li id="{itemId}" class="{itemCls}">', 12672 '<tpl if="needsIcon">', 12673 '<img alt="{altText}" src="{icon}" class="{iconCls}"/>', 12674 "</tpl>", "</li>") 12675 } 12676 if (g && !g.rendered) { 12677 if (Ext.isNumber(b)) { 12678 b = e.dom.childNodes[b] 12679 } 12680 var d = this.getItemArgs(g); 12681 g.render(g.positionEl = b 12682 ? this.itemTpl.insertBefore(b, d, true) 12683 : this.itemTpl.append(e, d, true)); 12684 g.positionEl.menuItemId = g.getItemId(); 12685 if (!d.isMenuItem && d.needsIcon) { 12686 g.positionEl.addClass("x-menu-list-item-indent") 12687 } 12688 this.configureItem(g) 12689 } else { 12690 if (g && !this.isValidParent(g, e)) { 12691 if (Ext.isNumber(b)) { 12692 b = e.dom.childNodes[b] 12693 } 12694 e.dom.insertBefore(g.getActionEl().dom, b || null) 12695 } 12696 } 12697 }, 12698 getItemArgs : function(d) { 12699 var a = d instanceof Ext.menu.Item, b = !(a || d instanceof Ext.menu.Separator); 12700 return { 12701 isMenuItem : a, 12702 needsIcon : b && (d.icon || d.iconCls), 12703 icon : d.icon || Ext.BLANK_IMAGE_URL, 12704 iconCls : "x-menu-item-icon " + (d.iconCls || ""), 12705 itemId : "x-menu-el-" + d.id, 12706 itemCls : "x-menu-list-item ", 12707 altText : d.altText || "" 12708 } 12709 }, 12710 isValidParent : function(b, a) { 12711 return b.el.up("li.x-menu-list-item", 5).dom.parentNode === (a.dom || a) 12712 }, 12713 onLayout : function(a, b) { 12714 Ext.layout.MenuLayout.superclass.onLayout.call(this, a, b); 12715 this.doAutoSize() 12716 }, 12717 doAutoSize : function() { 12718 var c = this.container, a = c.width; 12719 if (c.floating) { 12720 if (a) { 12721 c.setWidth(a) 12722 } else { 12723 if (Ext.isIE) { 12724 c.setWidth(Ext.isStrict 12725 && (Ext.isIE7 || Ext.isIE8 || Ext.isIE9) 12726 ? "auto" 12727 : c.minWidth); 12728 var d = c.getEl(), b = d.dom.offsetWidth; 12729 c.setWidth(c.getLayoutTarget().getWidth() 12730 + d.getFrameWidth("lr")) 12731 } 12732 } 12733 } 12734 } 12735}); 12736Ext.Container.LAYOUTS.menu = Ext.layout.MenuLayout; 12737Ext.Viewport = Ext.extend(Ext.Container, { 12738 initComponent : function() { 12739 Ext.Viewport.superclass.initComponent.call(this); 12740 document.getElementsByTagName("html")[0].className += " x-viewport"; 12741 this.el = Ext.getBody(); 12742 this.el.setHeight = Ext.emptyFn; 12743 this.el.setWidth = Ext.emptyFn; 12744 this.el.setSize = Ext.emptyFn; 12745 this.el.dom.scroll = "no"; 12746 this.allowDomMove = false; 12747 this.autoWidth = true; 12748 this.autoHeight = true; 12749 Ext.EventManager.onWindowResize(this.fireResize, this); 12750 this.renderTo = this.el 12751 }, 12752 fireResize : function(a, b) { 12753 this.fireEvent("resize", this, a, b, a, b) 12754 } 12755 }); 12756Ext.reg("viewport", Ext.Viewport); 12757Ext.Panel = Ext.extend(Ext.Container, { 12758 baseCls : "x-panel", 12759 collapsedCls : "x-panel-collapsed", 12760 maskDisabled : true, 12761 animCollapse : Ext.enableFx, 12762 headerAsText : true, 12763 buttonAlign : "right", 12764 collapsed : false, 12765 collapseFirst : true, 12766 minButtonWidth : 75, 12767 elements : "body", 12768 preventBodyReset : false, 12769 padding : undefined, 12770 resizeEvent : "bodyresize", 12771 toolTarget : "header", 12772 collapseEl : "bwrap", 12773 slideAnchor : "t", 12774 disabledClass : "", 12775 deferHeight : true, 12776 loadMsg : "loading...", 12777 expandDefaults : { 12778 duration : 0.25 12779 }, 12780 collapseDefaults : { 12781 duration : 0.25 12782 }, 12783 initComponent : function() { 12784 Ext.Panel.superclass.initComponent.call(this); 12785 this.addEvents("bodyresize", "titlechange", "iconchange", "collapse", 12786 "expand", "beforecollapse", "beforeexpand", "beforeclose", 12787 "close", "activate", "deactivate"); 12788 if (this.unstyled) { 12789 this.baseCls = "x-plain" 12790 } 12791 this.toolbars = []; 12792 if (this.tbar) { 12793 this.elements += ",tbar"; 12794 this.topToolbar = this.createToolbar(this.tbar); 12795 this.tbar = null 12796 } 12797 if (this.bbar) { 12798 this.elements += ",bbar"; 12799 this.bottomToolbar = this.createToolbar(this.bbar); 12800 this.bbar = null 12801 } 12802 if (this.header === true) { 12803 this.elements += ",header"; 12804 this.header = null 12805 } else { 12806 if (this.headerCfg || (this.title && this.header !== false)) { 12807 this.elements += ",header" 12808 } 12809 } 12810 if (this.footerCfg || this.footer === true) { 12811 this.elements += ",footer"; 12812 this.footer = null 12813 } 12814 if (this.buttons) { 12815 this.fbar = this.buttons; 12816 this.buttons = null 12817 } 12818 if (this.fbar) { 12819 this.createFbar(this.fbar) 12820 } 12821 if (this.autoLoad) { 12822 this.on("render", this.doAutoLoad, this, { 12823 delay : 10 12824 }) 12825 } 12826 }, 12827 createFbar : function(b) { 12828 var a = this.minButtonWidth; 12829 this.elements += ",footer"; 12830 this.fbar = this.createToolbar(b, { 12831 buttonAlign : this.buttonAlign, 12832 toolbarCls : "x-panel-fbar", 12833 enableOverflow : false, 12834 defaults : function(d) { 12835 return { 12836 minWidth : d.minWidth || a 12837 } 12838 } 12839 }); 12840 this.fbar.items.each(function(d) { 12841 d.minWidth = d.minWidth || this.minButtonWidth 12842 }, this); 12843 this.buttons = this.fbar.items.items 12844 }, 12845 createToolbar : function(b, c) { 12846 var a; 12847 if (Ext.isArray(b)) { 12848 b = { 12849 items : b 12850 } 12851 } 12852 a = b.events ? Ext.apply(b, c) : this.createComponent(Ext.apply({}, b, 12853 c), "toolbar"); 12854 this.toolbars.push(a); 12855 return a 12856 }, 12857 createElement : function(a, c) { 12858 if (this[a]) { 12859 c.appendChild(this[a].dom); 12860 return 12861 } 12862 if (a === "bwrap" || this.elements.indexOf(a) != -1) { 12863 if (this[a + "Cfg"]) { 12864 this[a] = Ext.fly(c).createChild(this[a + "Cfg"]) 12865 } else { 12866 var b = document.createElement("div"); 12867 b.className = this[a + "Cls"]; 12868 this[a] = Ext.get(c.appendChild(b)) 12869 } 12870 if (this[a + "CssClass"]) { 12871 this[a].addClass(this[a + "CssClass"]) 12872 } 12873 if (this[a + "Style"]) { 12874 this[a].applyStyles(this[a + "Style"]) 12875 } 12876 } 12877 }, 12878 onRender : function(g, e) { 12879 Ext.Panel.superclass.onRender.call(this, g, e); 12880 this.createClasses(); 12881 var a = this.el, h = a.dom, k, i; 12882 if (this.collapsible && !this.hideCollapseTool) { 12883 this.tools = this.tools ? this.tools.slice(0) : []; 12884 this.tools[this.collapseFirst ? "unshift" : "push"]({ 12885 id : "toggle", 12886 handler : this.toggleCollapse, 12887 scope : this 12888 }) 12889 } 12890 if (this.tools) { 12891 i = this.tools; 12892 this.elements += (this.header !== false) ? ",header" : "" 12893 } 12894 this.tools = {}; 12895 a.addClass(this.baseCls); 12896 if (h.firstChild) { 12897 this.header = a.down("." + this.headerCls); 12898 this.bwrap = a.down("." + this.bwrapCls); 12899 var j = this.bwrap ? this.bwrap : a; 12900 this.tbar = j.down("." + this.tbarCls); 12901 this.body = j.down("." + this.bodyCls); 12902 this.bbar = j.down("." + this.bbarCls); 12903 this.footer = j.down("." + this.footerCls); 12904 this.fromMarkup = true 12905 } 12906 if (this.preventBodyReset === true) { 12907 a.addClass("x-panel-reset") 12908 } 12909 if (this.cls) { 12910 a.addClass(this.cls) 12911 } 12912 if (this.buttons) { 12913 this.elements += ",footer" 12914 } 12915 if (this.frame) { 12916 a.insertHtml("afterBegin", String.format(Ext.Element.boxMarkup, 12917 this.baseCls)); 12918 this.createElement("header", h.firstChild.firstChild.firstChild); 12919 this.createElement("bwrap", h); 12920 k = this.bwrap.dom; 12921 var c = h.childNodes[1], b = h.childNodes[2]; 12922 k.appendChild(c); 12923 k.appendChild(b); 12924 var l = k.firstChild.firstChild.firstChild; 12925 this.createElement("tbar", l); 12926 this.createElement("body", l); 12927 this.createElement("bbar", l); 12928 this.createElement("footer", k.lastChild.firstChild.firstChild); 12929 if (!this.footer) { 12930 this.bwrap.dom.lastChild.className += " x-panel-nofooter" 12931 } 12932 this.ft = Ext.get(this.bwrap.dom.lastChild); 12933 this.mc = Ext.get(l) 12934 } else { 12935 this.createElement("header", h);
12936 this.createElement("bwrap", h); 12937 k = this.bwrap.dom; 12938 this.createElement("tbar", k); 12939 this.createElement("body", k); 12940 this.createElement("bbar", k); 12941 this.createElement("footer", k); 12942 if (!this.header) { 12943 this.body.addClass(this.bodyCls + "-noheader"); 12944 if (this.tbar) { 12945 this.tbar.addClass(this.tbarCls + "-noheader") 12946 } 12947 } 12948 } 12949 if (Ext.isDefined(this.padding)) { 12950 this.body.setStyle("padding", this.body.addUnits(this.padding)) 12951 } 12952 if (this.border === false) { 12953 this.el.addClass(this.baseCls + "-noborder"); 12954 this.body.addClass(this.bodyCls + "-noborder"); 12955 if (this.header) { 12956 this.header.addClass(this.headerCls + "-noborder") 12957 } 12958 if (this.footer) { 12959 this.footer.addClass(this.footerCls + "-noborder") 12960 } 12961 if (this.tbar) { 12962 this.tbar.addClass(this.tbarCls + "-noborder") 12963 } 12964 if (this.bbar) { 12965 this.bbar.addClass(this.bbarCls + "-noborder") 12966 } 12967 } 12968 if (this.bodyBorder === false) { 12969 this.body.addClass(this.bodyCls + "-noborder") 12970 } 12971 this.bwrap.enableDisplayMode("block"); 12972 if (this.header) { 12973 /* 12974 * IE ìì tab ìë¨ì ê²ìë°ë¥¼ ì¶ê°í ê²½ì° input ë°ì¤ì ë¸ëì§ì ì´ ëì§ ì기 ë문ì 12975 * this.header.unselectable(); 를 주ì ì²ë¦¬ íë¤. 12976 */ 12977 if (this.headerAsText) { 12978 this.header.dom.innerHTML = '<span class="' 12979 + this.headerTextCls + '">' + this.header.dom.innerHTML 12980 + "</span>"; 12981 if (this.iconCls) { 12982 this.setIconClass(this.iconCls) 12983 } 12984 } 12985 } 12986 if (this.floating) { 12987 this.makeFloating(this.floating) 12988 } 12989 if (this.collapsible && this.titleCollapse && this.header) { 12990 this.mon(this.header, "click", this.toggleCollapse, this); 12991 this.header.setStyle("cursor", "pointer") 12992 } 12993 if (i) { 12994 this.addTool.apply(this, i) 12995 } 12996 if (this.fbar) { 12997 this.footer.addClass("x-panel-btns"); 12998 this.fbar.ownerCt = this; 12999 this.fbar.render(this.footer); 13000 this.footer.createChild({ 13001 cls : "x-clear" 13002 }) 13003 } 13004 if (this.tbar && this.topToolbar) { 13005 this.topToolbar.ownerCt = this; 13006 this.topToolbar.render(this.tbar) 13007 } 13008 if (this.bbar && this.bottomToolbar) { 13009 this.bottomToolbar.ownerCt = this; 13010 this.bottomToolbar.render(this.bbar) 13011 } 13012 }, 13013 setIconClass : function(b) { 13014 var a = this.iconCls; 13015 this.iconCls = b; 13016 if (this.rendered && this.header) { 13017 if (this.frame) { 13018 this.header.addClass("x-panel-icon"); 13019 this.header.replaceClass(a, this.iconCls) 13020 } else { 13021 var e = this.header, c = e.child("img.x-panel-inline-icon"); 13022 if (c) { 13023 Ext.fly(c).replaceClass(a, this.iconCls) 13024 } else { 13025 var d = e.child("span." + this.headerTextCls); 13026 if (d) { 13027 Ext.DomHelper.insertBefore(d.dom, { 13028 tag : "img", 13029 alt : "", 13030 src : Ext.BLANK_IMAGE_URL, 13031 cls : "x-panel-inline-icon " + this.iconCls 13032 }) 13033 } 13034 } 13035 } 13036 } 13037 this.fireEvent("iconchange", this, b, a) 13038 }, 13039 makeFloating : function(a) { 13040 this.floating = true; 13041 this.el = new Ext.Layer(Ext.apply({}, a, { 13042 shadow : Ext.isDefined(this.shadow) ? this.shadow : "sides", 13043 shadowOffset : this.shadowOffset, 13044 constrain : false, 13045 shim : this.shim === false ? false : undefined 13046 }), this.el) 13047 }, 13048 getTopToolbar : function() { 13049 return this.topToolbar 13050 }, 13051 getBottomToolbar : function() { 13052 return this.bottomToolbar 13053 }, 13054 getFooterToolbar : function() { 13055 return this.fbar 13056 }, 13057 addButton : function(a, c, b) { 13058 if (!this.fbar) { 13059 this.createFbar([]) 13060 } 13061 if (c) { 13062 if (Ext.isString(a)) { 13063 a = { 13064 text : a 13065 } 13066 } 13067 a = Ext.apply({ 13068 handler : c, 13069 scope : b 13070 }, a) 13071 } 13072 return this.fbar.add(a) 13073 }, 13074 addTool : function() { 13075 if (!this.rendered) { 13076 if (!this.tools) { 13077 this.tools = [] 13078 } 13079 Ext.each(arguments, function(a) { 13080 this.tools.push(a) 13081 }, this); 13082 return 13083 } 13084 if (!this[this.toolTarget]) { 13085 return 13086 } 13087 if (!this.toolTemplate) { 13088 var h = new Ext.Template('<div class="x-tool x-tool-{id}"> </div>'); 13089 h.disableFormats = true; 13090 h.compile(); 13091 Ext.Panel.prototype.toolTemplate = h 13092 } 13093 for (var g = 0, d = arguments, c = d.length; g < c; g++) { 13094 var b = d[g]; 13095 if (!this.tools[b.id]) { 13096 var j = "x-tool-" + b.id + "-over"; 13097 var e = this.toolTemplate.insertFirst(this[this.toolTarget], b, 13098 true); 13099 this.tools[b.id] = e; 13100 e.enableDisplayMode("block"); 13101 this.mon(e, "click", this.createToolHandler(e, b, j, this)); 13102 if (b.on) { 13103 this.mon(e, b.on) 13104 } 13105 if (b.hidden) { 13106 e.hide() 13107 } 13108 if (b.qtip) { 13109 if (Ext.isObject(b.qtip)) { 13110 Ext.QuickTips.register(Ext.apply({
13111 target : e.id 13112 }, b.qtip)) 13113 } else { 13114 e.dom.qtip = b.qtip 13115 } 13116 } 13117 e.addClassOnOver(j) 13118 } 13119 } 13120 }, 13121 onLayout : function(b, a) { 13122 Ext.Panel.superclass.onLayout.apply(this, arguments); 13123 if (this.hasLayout && this.toolbars.length > 0) { 13124 Ext.each(this.toolbars, function(c) { 13125 c.doLayout(undefined, a) 13126 }); 13127 this.syncHeight() 13128 } 13129 }, 13130 syncHeight : function() { 13131 var b = this.toolbarHeight, c = this.body, a = this.lastSize.height, d; 13132 if (this.autoHeight || !Ext.isDefined(a) || a == "auto") { 13133 return 13134 } 13135 if (b != this.getToolbarHeight()) { 13136 b = Math.max(0, a - this.getFrameHeight()); 13137 c.setHeight(b); 13138 d = c.getSize(); 13139 this.toolbarHeight = this.getToolbarHeight(); 13140 this.onBodyResize(d.width, d.height) 13141 } 13142 }, 13143 onShow : function() { 13144 if (this.floating) { 13145 return this.el.show() 13146 } 13147 Ext.Panel.superclass.onShow.call(this) 13148 }, 13149 onHide : function() { 13150 if (this.floating) { 13151 return this.el.hide() 13152 } 13153 Ext.Panel.superclass.onHide.call(this) 13154 }, 13155 createToolHandler : function(c, a, d, b) { 13156 return function(g) { 13157 c.removeClass(d); 13158 if (a.stopEvent !== false) { 13159 g.stopEvent() 13160 } 13161 if (a.handler) { 13162 a.handler.call(a.scope || c, g, c, b, a) 13163 } 13164 } 13165 }, 13166 afterRender : function() { 13167 if (this.floating && !this.hidden) { 13168 this.el.show() 13169 } 13170 if (this.title) { 13171 this.setTitle(this.title) 13172 } 13173 Ext.Panel.superclass.afterRender.call(this); 13174 if (this.collapsed) { 13175 this.collapsed = false; 13176 this.collapse(false) 13177 } 13178 this.initEvents() 13179 }, 13180 getKeyMap : function() { 13181 if (!this.keyMap) { 13182 this.keyMap = new Ext.KeyMap(this.el, this.keys) 13183 } 13184 return this.keyMap 13185 }, 13186 initEvents : function() { 13187 if (this.keys) { 13188 this.getKeyMap() 13189 } 13190 if (this.draggable) { 13191 this.initDraggable() 13192 } 13193 if (this.toolbars.length > 0) { 13194 Ext.each(this.toolbars, function(a) { 13195 a.doLayout(); 13196 a.on({ 13197 scope : this, 13198 afterlayout : this.syncHeight, 13199 remove : this.syncHeight 13200 }) 13201 }, this); 13202 this.syncHeight() 13203 } 13204 }, 13205 initDraggable : function() { 13206 this.dd = new Ext.Panel.DD(this, Ext.isBoolean(this.draggable) 13207 ? null 13208 : this.draggable) 13209 }, 13210 beforeEffect : function(a) { 13211 if (this.floating) { 13212 this.el.beforeAction() 13213 } 13214 if (a !== false) { 13215 this.el.addClass("x-panel-animated") 13216 } 13217 }, 13218 afterEffect : function(a) { 13219 this.syncShadow(); 13220 this.el.removeClass("x-panel-animated") 13221 }, 13222 createEffect : function(c, b, d) { 13223 var e = { 13224 scope : d, 13225 block : true 13226 }; 13227 if (c === true) { 13228 e.callback = b; 13229 return e 13230 } else { 13231 if (!c.callback) { 13232 e.callback = b 13233 } else { 13234 e.callback = function() { 13235 b.call(d); 13236 Ext.callback(c.callback, c.scope) 13237 } 13238 } 13239 } 13240 return Ext.applyIf(e, c) 13241 }, 13242 collapse : function(b) { 13243 if (this.collapsed || this.el.hasFxBlock() 13244 || this.fireEvent("beforecollapse", this, b) === false) { 13245 return 13246 } 13247 var a = b === true || (b !== false && this.animCollapse); 13248 this.beforeEffect(a); 13249 this.onCollapse(a, b); 13250 return this 13251 }, 13252 onCollapse : function(a, b) { 13253 if (a) { 13254 this[this.collapseEl].slideOut(this.slideAnchor, Ext.apply(this 13255 .createEffect(b || true, 13256 this.afterCollapse, this), 13257 this.collapseDefaults)) 13258 } else { 13259 this[this.collapseEl].hide(this.hideMode); 13260 this.afterCollapse(false) 13261 } 13262 }, 13263 afterCollapse : function(a) { 13264 this.collapsed = true; 13265 this.el.addClass(this.collapsedCls); 13266 if (a !== false) { 13267 this[this.collapseEl].hide(this.hideMode) 13268 } 13269 this.afterEffect(a); 13270 this.cascade(function(b) { 13271 if (b.lastSize) { 13272 b.lastSize = { 13273 width : undefined, 13274 height : undefined 13275 } 13276 } 13277 }); 13278 this.fireEvent("collapse", this) 13279 }, 13280 expand : function(b) { 13281 if (!this.collapsed || this.el.hasFxBlock() 13282 || this.fireEvent("beforeexpand", this, b) === false) { 13283 return 13284 } 13285 var a = b === true || (b !== false && this.animCollapse); 13286 this.el.removeClass(this.collapsedCls); 13287 this.beforeEffect(a); 13288 this.onExpand(a, b); 13289 return this 13290 }, 13291 onExpand : function(a, b) { 13292 if (a) { 13293 this[this.collapseEl].slideIn(this.slideAnchor, Ext.apply(this
13294 .createEffect(b || true, this.afterExpand, 13295 this), this.expandDefaults)) 13296 } else { 13297 this[this.collapseEl].show(this.hideMode); 13298 this.afterExpand(false) 13299 } 13300 }, 13301 afterExpand : function(a) { 13302 this.collapsed = false; 13303 if (a !== false) { 13304 this[this.collapseEl].show(this.hideMode) 13305 } 13306 this.afterEffect(a); 13307 if (this.deferLayout) { 13308 delete this.deferLayout; 13309 this.doLayout(true) 13310 } 13311 this.fireEvent("expand", this) 13312 }, 13313 toggleCollapse : function(a) { 13314 this[this.collapsed ? "expand" : "collapse"](a); 13315 return this 13316 }, 13317 onDisable : function() { 13318 if (this.rendered && this.maskDisabled) { 13319 this.el.mask() 13320 } 13321 Ext.Panel.superclass.onDisable.call(this) 13322 }, 13323 onEnable : function() { 13324 if (this.rendered && this.maskDisabled) { 13325 this.el.unmask() 13326 } 13327 Ext.Panel.superclass.onEnable.call(this) 13328 }, 13329 onResize : function(g, d, c, e) { 13330 var a = g, b = d; 13331 if (Ext.isDefined(a) || Ext.isDefined(b)) { 13332 if (!this.collapsed) { 13333 if (Ext.isNumber(a)) { 13334 this.body.setWidth(a = this.adjustBodyWidth(a 13335 - this.getFrameWidth())) 13336 } else { 13337 if (a == "auto") { 13338 a = this.body.setWidth("auto").dom.offsetWidth 13339 } else { 13340 a = this.body.dom.offsetWidth 13341 } 13342 } 13343 if (this.tbar) { 13344 this.tbar.setWidth(a); 13345 if (this.topToolbar) { 13346 this.topToolbar.setSize(a) 13347 } 13348 } 13349 if (this.bbar) { 13350 this.bbar.setWidth(a); 13351 if (this.bottomToolbar) { 13352 this.bottomToolbar.setSize(a); 13353 if (Ext.isIE) { 13354 this.bbar.setStyle("position", "static"); 13355 this.bbar.setStyle("position", "") 13356 } 13357 } 13358 } 13359 if (this.footer) { 13360 this.footer.setWidth(a); 13361 if (this.fbar) { 13362 this.fbar.setSize(Ext.isIE ? (a - this.footer 13363 .getFrameWidth("lr")) : "auto") 13364 } 13365 } 13366 if (Ext.isNumber(b)) { 13367 b = Math.max(0, b - this.getFrameHeight()); 13368 this.body.setHeight(b) 13369 } else { 13370 if (b == "auto") { 13371 this.body.setHeight(b) 13372 } 13373 } 13374 if (this.disabled && this.el._mask) { 13375 this.el._mask.setSize(this.el.dom.clientWidth, this.el 13376 .getHeight()) 13377 } 13378 } else { 13379 this.queuedBodySize = { 13380 width : a, 13381 height : b 13382 }; 13383 if (!this.queuedExpand && this.allowQueuedExpand !== false) { 13384 this.queuedExpand = true; 13385 this.on("expand", function() { 13386 delete this.queuedExpand; 13387 this.onResize(this.queuedBodySize.width, 13388 this.queuedBodySize.height) 13389 }, this, { 13390 single : true 13391 }) 13392 } 13393 } 13394 this.onBodyResize(a, b) 13395 } 13396 this.syncShadow(); 13397 Ext.Panel.superclass.onResize.call(this, g, d, c, e) 13398 }, 13399 onBodyResize : function(a, b) { 13400 this.fireEvent("bodyresize", this, a, b) 13401 }, 13402 getToolbarHeight : function() { 13403 var a = 0; 13404 if (this.rendered) { 13405 Ext.each(this.toolbars, function(b) { 13406 a += b.getHeight() 13407 }, this) 13408 } 13409 return a 13410 }, 13411 adjustBodyHeight : function(a) { 13412 return a 13413 }, 13414 adjustBodyWidth : function(a) { 13415 return a 13416 }, 13417 onPosition : function() { 13418 this.syncShadow() 13419 }, 13420 getFrameWidth : function() { 13421 var b = this.el.getFrameWidth("lr") + this.bwrap.getFrameWidth("lr"); 13422 if (this.frame) { 13423 var a = this.bwrap.dom.firstChild; 13424 b += (Ext.fly(a).getFrameWidth("l") + Ext.fly(a.firstChild) 13425 .getFrameWidth("r")); 13426 b += this.mc.getFrameWidth("lr") 13427 } 13428 return b 13429 }, 13430 getFrameHeight : function() { 13431 var a = this.el.getFrameWidth("tb") + this.bwrap.getFrameWidth("tb"); 13432 a += (this.tbar ? this.tbar.getHeight() : 0) 13433 + (this.bbar ? this.bbar.getHeight() : 0); 13434 if (this.frame) { 13435 a += this.el.dom.firstChild.offsetHeight + this.ft.dom.offsetHeight 13436 + this.mc.getFrameWidth("tb") 13437 } else { 13438 a += (this.header ? this.header.getHeight() : 0) 13439 + (this.footer ? this.footer.getHeight() : 0) 13440 } 13441 return a 13442 }, 13443 getInnerWidth : function() { 13444 return this.getSize().width - this.getFrameWidth() 13445 }, 13446 getInnerHeight : function() { 13447 return this.body.getHeight() 13448 }, 13449 syncShadow : function() { 13450 if (this.floating) { 13451 this.el.sync(true) 13452 } 13453 }, 13454 getLayoutTarget : function() { 13455 return this.body 13456 }, 13457 getContentTarget : function() { 13458 return this.body 13459 }, 13460 setTitle : function(b, a) { 13461 this.title = b; 13462 if (this.header && this.headerAsText) { 13463 this.header.child("span").update(b) 13464 } 13465 if (a) { 13466 this.setIconClass(a) 13467 } 13468 this.fireEvent("titlechange", this, b); 13469 return this 13470 }, 13471 getUpdater : function() { 13472 return this.body.getUpdater() 13473 }, 13474 load : function() { 13475 var a = this.body.getUpdater(); 13476 a.update.apply(a, arguments); 13477 return this 13478 }, 13479 beforeDestroy : function() { 13480 Ext.Panel.superclass.beforeDestroy.call(this); 13481 if (this.header) { 13482 this.header.removeAllListeners() 13483 } 13484 if (this.tools) { 13485 for (var a in this.tools) { 13486 Ext.destroy(this.tools[a]) 13487 } 13488 } 13489 if (this.toolbars.length > 0) { 13490 Ext.each(this.toolbars, function(b) { 13491 b.un("afterlayout", this.syncHeight, this); 13492 b.un("remove", this.syncHeight, this) 13493 }, this) 13494 } 13495 if (Ext.isArray(this.buttons)) { 13496 while (this.buttons.length) { 13497 Ext.destroy(this.buttons[0]) 13498 } 13499 } 13500 if (this.rendered) { 13501 Ext.destroy(this.ft, this.header, this.footer, this.tbar, 13502 this.bbar, this.body, this.mc, this.bwrap, this.dd); 13503 if (this.fbar) { 13504 Ext.destroy(this.fbar, this.fbar.el) 13505 } 13506 } 13507 Ext.destroy(this.toolbars) 13508 }, 13509 createClasses : function() { 13510 this.headerCls = this.baseCls + "-header"; 13511 this.headerTextCls = this.baseCls + "-header-text"; 13512 this.bwrapCls = this.baseCls + "-bwrap"; 13513 this.tbarCls = this.baseCls + "-tbar"; 13514 this.bodyCls = this.baseCls + "-body"; 13515 this.bbarCls = this.baseCls + "-bbar"; 13516 this.footerCls = this.baseCls + "-footer" 13517 }, 13518 createGhost : function(a, e, b) { 13519 var d = document.createElement("div"); 13520 d.className = "x-panel-ghost " + (a ? a : ""); 13521 if (this.header) { 13522 d.appendChild(this.el.dom.firstChild.cloneNode(true)) 13523 } 13524 Ext.fly(d.appendChild(document.createElement("ul"))) 13525 .setHeight(this.bwrap.getHeight()); 13526 d.style.width = this.el.dom.offsetWidth + "px"; 13527 if (!b) { 13528 this.container.dom.appendChild(d) 13529 } else { 13530 Ext.getDom(b).appendChild(d) 13531 } 13532 if (e !== false && this.el.useShim !== false) { 13533 var c = new Ext.Layer({ 13534 shadow : false, 13535 useDisplay : true, 13536 constrain : false 13537 }, d); 13538 c.show(); 13539 return c 13540 } else { 13541 return new Ext.Element(d) 13542 } 13543 }, 13544 doAutoLoad : function() { 13545 var a = this.body.getUpdater(); 13546 if (this.renderer) { 13547 a.setRenderer(this.renderer) 13548 } 13549 a.update(Ext.isObject(this.autoLoad) ? this.autoLoad : { 13550 url : this.autoLoad 13551 }) 13552 }, 13553 getTool : function(a) { 13554 return this.tools[a] 13555 } 13556}); 13557Ext.reg("panel", Ext.Panel); 13558Ext.Editor = function(b, a) { 13559 if (b.field) { 13560 this.field = Ext.create(b.field, "textfield"); 13561 a = Ext.apply({}, b); 13562 delete a.field 13563 } else { 13564 this.field = b 13565 } 13566 Ext.Editor.superclass.constructor.call(this, a) 13567}; 13568Ext.extend(Ext.Editor, Ext.Component, { 13569 allowBlur : true, 13570 value : "", 13571 alignment : "c-c?", 13572 offsets : [0, 0], 13573 shadow : "frame", 13574 constrain : false, 13575 swallowKeys : true, 13576 completeOnEnter : true, 13577 cancelOnEsc : true, 13578 updateEl : false, 13579 initComponent : function() { 13580 Ext.Editor.superclass.initComponent.call(this); 13581 this.addEvents("beforestartedit", "startedit", "beforecomplete",
13582 "complete", "canceledit", "specialkey") 13583 }, 13584 onRender : function(b, a) { 13585 this.el = new Ext.Layer({ 13586 shadow : this.shadow, 13587 cls : "x-editor", 13588 parentEl : b, 13589 shim : this.shim, 13590 shadowOffset : this.shadowOffset || 4, 13591 id : this.id, 13592 constrain : this.constrain 13593 }); 13594 if (this.zIndex) { 13595 this.el.setZIndex(this.zIndex) 13596 } 13597 this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden"); 13598 if (this.field.msgTarget != "title") { 13599 this.field.msgTarget = "qtip" 13600 } 13601 this.field.inEditor = true; 13602 this.mon(this.field, { 13603 scope : this, 13604 blur : this.onBlur, 13605 specialkey : this.onSpecialKey 13606 }); 13607 if (this.field.grow) { 13608 this.mon(this.field, "autosize", this.el.sync, this.el, { 13609 delay : 1 13610 }) 13611 } 13612 this.field.render(this.el).show(); 13613 this.field.getEl().dom.name = ""; 13614 if (this.swallowKeys) { 13615 this.field.el.swallowEvent(["keypress", "keydown"]) 13616 } 13617 }, 13618 onSpecialKey : function(g, d) { 13619 var b = d.getKey(), a = this.completeOnEnter && b == d.ENTER, c = this.cancelOnEsc 13620 && b == d.ESC; 13621 if (a || c) { 13622 d.stopEvent(); 13623 if (a) { 13624 this.completeEdit() 13625 } else { 13626 this.cancelEdit() 13627 } 13628 if (g.triggerBlur) { 13629 g.triggerBlur() 13630 } 13631 } 13632 this.fireEvent("specialkey", g, d) 13633 }, 13634 startEdit : function(b, c) { 13635 if (this.editing) { 13636 this.completeEdit() 13637 } 13638 this.boundEl = Ext.get(b); 13639 var a = c !== undefined ? c : this.boundEl.dom.innerHTML; 13640 if (!this.rendered) { 13641 this.render(this.parentEl || document.body) 13642 } 13643 if (this.fireEvent("beforestartedit", this, this.boundEl, a) !== false) { 13644 this.startValue = a; 13645 this.field.reset(); 13646 this.field.setValue(a); 13647 this.realign(true); 13648 this.editing = true; 13649 this.show() 13650 } 13651 }, 13652 doAutoSize : function() { 13653 if (this.autoSize) { 13654 var b = this.boundEl.getSize(), a = this.field.getSize(); 13655 switch (this.autoSize) { 13656 case "width" : 13657 this.setSize(b.width, a.height); 13658 break; 13659 case "height" : 13660 this.setSize(a.width, b.height); 13661 break; 13662 case "none" : 13663 this.setSize(a.width, a.height); 13664 break; 13665 default : 13666 this.setSize(b.width, b.height) 13667 } 13668 } 13669 }, 13670 setSize : function(a, b) { 13671 delete this.field.lastSize; 13672 this.field.setSize(a, b); 13673 if (this.el) { 13674 if (Ext.isGecko2 || Ext.isOpera || (Ext.isIE7 && Ext.isStrict)) { 13675 this.el.setSize(a, b) 13676 } 13677 this.el.sync() 13678 } 13679 }, 13680 realign : function(a) { 13681 if (a === true) { 13682 this.doAutoSize() 13683 } 13684 this.el.alignTo(this.boundEl, this.alignment, this.offsets) 13685 }, 13686 completeEdit : function(a) { 13687 if (!this.editing) { 13688 return 13689 } 13690 if (this.field.assertValue) { 13691 this.field.assertValue() 13692 } 13693 var b = this.getValue(); 13694 if (!this.field.isValid()) { 13695 if (this.revertInvalid !== false) { 13696 this.cancelEdit(a) 13697 } 13698 return 13699 } 13700 if (String(b) === String(this.startValue) && this.ignoreNoChange) { 13701 this.hideEdit(a); 13702 return 13703 } 13704 if (this.fireEvent("beforecomplete", this, b, this.startValue) !== false) { 13705 b = this.getValue(); 13706 if (this.updateEl && this.boundEl) { 13707 this.boundEl.update(b) 13708 } 13709 this.hideEdit(a); 13710 this.fireEvent("complete", this, b, this.startValue) 13711 } 13712 }, 13713 onShow : function() { 13714 this.el.show(); 13715 if (this.hideEl !== false) { 13716 this.boundEl.hide() 13717 } 13718 this.field.show().focus(false, true); 13719 this.fireEvent("startedit", this.boundEl, this.startValue) 13720 }, 13721 cancelEdit : function(a) { 13722 if (this.editing) { 13723 var b = this.getValue(); 13724 this.setValue(this.startValue); 13725 this.hideEdit(a); 13726 this.fireEvent("canceledit", this, b, this.startValue) 13727 } 13728 }, 13729 hideEdit : function(a) { 13730 if (a !== true) { 13731 this.editing = false; 13732 this.hide() 13733 } 13734 }, 13735 onBlur : function() { 13736 if (this.allowBlur === true && this.editing 13737 && this.selectSameEditor !== true) { 13738 this.completeEdit() 13739 } 13740 }, 13741 onHide : function() { 13742 if (this.editing) { 13743 this.completeEdit(); 13744 return 13745 } 13746 this.field.blur(); 13747 if (this.field.collapse) { 13748 this.field.collapse() 13749 } 13750 this.el.hide(); 13751 if (this.hideEl !== false) { 13752 this.boundEl.show() 13753 } 13754 }, 13755 setValue : function(a) { 13756 this.field.setValue(a) 13757 }, 13758 getValue : function() { 13759 return this.field.getValue() 13760 }, 13761 beforeDestroy : function() { 13762 Ext.destroyMembers(this, "field"); 13763 delete this.parentEl; 13764 delete this.boundEl 13765 } 13766}); 13767Ext.reg("editor", Ext.Editor); 13768Ext.ColorPalette = Ext.extend(Ext.Component, { 13769 itemCls : "x-color-palette", 13770 value : null, 13771 clickEvent : "click", 13772 ctype : "Ext.ColorPalette", 13773 allowReselect : false, 13774 colors : ["000000", "993300", "333300", "003300", "003366", "000080", 13775 "333399", "333333", "800000", "FF6600", "808000", "008000", 13776 "008080", "0000FF", "666699", "808080", "FF0000", "FF9900", 13777 "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696", 13778 "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", 13779 "993366", "C0C0C0", "FF99CC", "FFCC99", "FFFF99", "CCFFCC", 13780 "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"], 13781 initComponent : function() { 13782 Ext.ColorPalette.superclass.initComponent.call(this); 13783 this.addEvents("select"); 13784 if (this.handler) { 13785 this.on("select", this.handler, this.scope, true) 13786 } 13787 }, 13788 onRender : function(b, a) { 13789 this.autoEl = { 13790 tag : "div", 13791 cls : this.itemCls 13792 }; 13793 Ext.ColorPalette.superclass.onRender.call(this, b, a); 13794 var c = this.tpl 13795 || new Ext.XTemplate('<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on"> </span></em></a></tpl>'); 13796 c.overwrite(this.el, this.colors); 13797 this.mon(this.el, this.clickEvent, this.handleClick, this, { 13798 delegate : "a" 13799 }); 13800 if (this.clickEvent != "click") { 13801 this.mon(this.el, "click", Ext.emptyFn, this, { 13802 delegate : "a", 13803 preventDefault : true 13804 }) 13805 } 13806 },
13807 afterRender : function() { 13808 Ext.ColorPalette.superclass.afterRender.call(this); 13809 if (this.value) { 13810 var a = this.value; 13811 this.value = null; 13812 this.select(a, true) 13813 } 13814 }, 13815 handleClick : function(b, a) { 13816 b.preventDefault(); 13817 if (!this.disabled) { 13818 var d = a.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1]; 13819 this.select(d.toUpperCase()) 13820 } 13821 }, 13822 select : function(b, a) { 13823 b = b.replace("#", ""); 13824 if (b != this.value || this.allowReselect) { 13825 var c = this.el; 13826 if (this.value) { 13827 c.child("a.color-" + this.value) 13828 .removeClass("x-color-palette-sel") 13829 } 13830 c.child("a.color-" + b).addClass("x-color-palette-sel"); 13831 this.value = b; 13832 if (a !== true) { 13833 this.fireEvent("select", this, b) 13834 } 13835 } 13836 } 13837}); 13838Ext.reg("colorpalette", Ext.ColorPalette); 13839Ext.DatePicker = Ext.extend(Ext.BoxComponent, { 13840 todayText : "Today", 13841 okText : " OK ", 13842 cancelText : "Cancel", 13843 todayTip : "{0} (Spacebar)", 13844 minText : "This date is before the minimum date", 13845 maxText : "This date is after the maximum date", 13846 format : "m/d/y", 13847 disabledDaysText : "Disabled", 13848 disabledDatesText : "Disabled", 13849 monthNames : Date.monthNames, 13850 dayNames : Date.dayNames, 13851 nextText : "Next Month (Control+Right)", 13852 prevText : "Previous Month (Control+Left)", 13853 monthYearText : "Choose a month (Control+Up/Down to move years)", 13854 startDay : 0, 13855 showToday : true, 13856 focusOnSelect : true, 13857 initHour : 12, 13858 initComponent : function() { 13859 Ext.DatePicker.superclass.initComponent.call(this); 13860 this.value = this.value ? this.value.clearTime(true) : new Date() 13861 .clearTime(); 13862 this.addEvents("select"); 13863 if (this.handler) { 13864 this.on("select", this.handler, this.scope || this) 13865 } 13866 this.initDisabledDays() 13867 }, 13868 initDisabledDays : function() { 13869 if (!this.disabledDatesRE && this.disabledDates) { 13870 var b = this.disabledDates, a = b.length - 1, c = "(?:"; 13871 Ext.each(b, function(g, e) { 13872 c += Ext.isDate(g) 13873 ? "^" + Ext.escapeRe(g.dateFormat(this.format)) 13874 + "$" 13875 : b[e]; 13876 if (e != a) { 13877 c += "|" 13878 } 13879 }, this); 13880 this.disabledDatesRE = new RegExp(c + ")") 13881 } 13882 }, 13883 setDisabledDates : function(a) { 13884 if (Ext.isArray(a)) { 13885 this.disabledDates = a; 13886 this.disabledDatesRE = null 13887 } else { 13888 this.disabledDatesRE = a 13889 } 13890 this.initDisabledDays(); 13891 this.update(this.value, true) 13892 }, 13893 setDisabledDays : function(a) { 13894 this.disabledDays = a; 13895 this.update(this.value, true) 13896 }, 13897 setMinDate : function(a) { 13898 this.minDate = a; 13899 this.update(this.value, true) 13900 }, 13901 setMaxDate : function(a) { 13902 this.maxDate = a; 13903 this.update(this.value, true) 13904 }, 13905 setValue : function(a) { 13906 this.value = a.clearTime(true); 13907 this.update(this.value) 13908 }, 13909 getValue : function() { 13910 return this.value 13911 }, 13912 focus : function() { 13913 this.update(this.activeDate) 13914 }, 13915 onEnable : function(a) { 13916 Ext.DatePicker.superclass.onEnable.call(this); 13917 this.doDisabled(false); 13918 this.update(a ? this.value : this.activeDate); 13919 if (Ext.isIE) { 13920 this.el.repaint() 13921 } 13922 }, 13923 onDisable : function() { 13924 Ext.DatePicker.superclass.onDisable.call(this); 13925 this.doDisabled(true); 13926 if (Ext.isIE && !Ext.isIE8) { 13927 Ext.each([].concat(this.textNodes, this.el.query("th span")), 13928 function(a) { 13929 Ext.fly(a).repaint() 13930 }) 13931 } 13932 }, 13933 doDisabled : function(a) { 13934 this.keyNav.setDisabled(a); 13935 this.prevRepeater.setDisabled(a); 13936 this.nextRepeater.setDisabled(a); 13937 if (this.showToday) { 13938 this.todayKeyListener.setDisabled(a); 13939 this.todayBtn.setDisabled(a) 13940 } 13941 }, 13942 onRender : function(e, b) { 13943 var a = [ 13944 '<table cellspacing="0">', 13945 '<tr><td class="x-date-left"><a href="#" title="', 13946 this.prevText, 13947 '"> </a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', 13948 this.nextText, '"> </a></td></tr>', 13949 '<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'], c = this.dayNames, h; 13950 for (h = 0; h < 7; h++) { 13951 var k = this.startDay + h; 13952 if (k > 6) { 13953 k = k - 7 13954 } 13955 a.push("<th><span>", c[k].substr(0, 1), "</span></th>") 13956 } 13957 a[a.length] = "</tr></thead><tbody><tr>"; 13958 for (h = 0; h < 42; h++) { 13959 if (h % 7 === 0 && h !== 0) { 13960 a[a.length] = "</tr><tr>" 13961 } 13962 a[a.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>' 13963 } 13964 a 13965 .push( 13966 "</tr></tbody></table></td></tr>", 13967 this.showToday 13968 ? '<tr><td colspan="3" class="x-date-bottom" align="center"></td></tr>' 13969 : "", '</table><div class="x-date-mp"></div>'); 13970 var j = document.createElement("div"); 13971 j.className = "x-date-picker"; 13972 j.innerHTML = a.join(""); 13973 e.dom.insertBefore(j, b); 13974 this.el = Ext.get(j); 13975 this.eventEl = Ext.get(j.firstChild); 13976 this.prevRepeater = new Ext.util.ClickRepeater(this.el 13977 .child("td.x-date-left a"), { 13978 handler : this.showPrevMonth, 13979 scope : this, 13980 preventDefault : true, 13981 stopDefault : true 13982 }); 13983 this.nextRepeater = new Ext.util.ClickRepeater(this.el 13984 .child("td.x-date-right a"), { 13985 handler : this.showNextMonth, 13986 scope : this, 13987 preventDefault : true, 13988 stopDefault : true 13989 }); 13990 this.monthPicker = this.el.down("div.x-date-mp"); 13991 this.monthPicker.enableDisplayMode("block"); 13992 this.keyNav = new Ext.KeyNav(this.eventEl, { 13993 left : function(d) { 13994 if (d.ctrlKey) { 13995 this.showPrevMonth() 13996 } else { 13997 this.update(this.activeDate.add("d", -1)) 13998 } 13999 }, 14000 right : function(d) { 14001 if (d.ctrlKey) { 14002 this.showNextMonth() 14003 } else { 14004 this.update(this.activeDate.add("d", 1)) 14005 } 14006 }, 14007 up : function(d) { 14008 if (d.ctrlKey) { 14009 this.showNextYear() 14010 } else { 14011 this.update(this.activeDate.add("d", -7)) 14012 } 14013 }, 14014 down : function(d) { 14015 if (d.ctrlKey) { 14016 this.showPrevYear() 14017 } else { 14018 this.update(this.activeDate.add("d", 7)) 14019 } 14020 }, 14021 pageUp : function(d) { 14022 this.showNextMonth() 14023 }, 14024 pageDown : function(d) { 14025 this.showPrevMonth() 14026 }, 14027 enter : function(d) { 14028 d.stopPropagation(); 14029 return true 14030 }, 14031 scope : this 14032 }); 14033 this.el.unselectable(); 14034 this.cells = this.el.select("table.x-date-inner tbody td"); 14035 this.textNodes = this.el.query("table.x-date-inner tbody span"); 14036 this.mbtn = new Ext.Button({ 14037 text : " ", 14038 tooltip : this.monthYearText, 14039 renderTo : this.el.child("td.x-date-middle", true) 14040 }); 14041 this.mbtn.el.child("em").addClass("x-btn-arrow"); 14042 if (this.showToday) { 14043 this.todayKeyListener = this.eventEl.addKeyListener( 14044 Ext.EventObject.SPACE, this.selectToday, this); 14045 var g = (new Date()).dateFormat(this.format); 14046 this.todayBtn = new Ext.Button({ 14047 renderTo : this.el.child("td.x-date-bottom", true), 14048 text : String.format(this.todayText, g), 14049 tooltip : String.format(this.todayTip, g), 14050 handler : this.selectToday, 14051 scope : this 14052 }) 14053 } 14054 this.mon(this.eventEl, "mousewheel", this.handleMouseWheel, this); 14055 this.mon(this.eventEl, "click", this.handleDateClick, this, { 14056 delegate : "a.x-date-date" 14057 }); 14058 this.mon(this.mbtn, "click", this.showMonthPicker, this); 14059 14060 this.mon(this.el, "click", function(e) { 14061 e.stopEvent(); 14062 e.stopPropagation(); 14063 var evt = e.browserEvent ? e.browserEvent:window.event; 14064 if (evt.stopPropagation) evt.stopPropagation(); 14065 if (evt.cancelBubble!=null) evt.cancelBubble = true; 14066 }, this); 14067 14068 this.onEnable(true) 14069 }, 14070 createMonthPicker : function() { 14071 if (!this.monthPicker.dom.firstChild) { 14072 var a = ['<table border="0" cellspacing="0">']; 14073 for (var b = 0; b < 6; b++) { 14074 a 14075 .push( 14076 '<tr><td class="x-date-mp-month"><a href="#">', 14077 Date.getShortMonthName(b), 14078 "</a></td>", 14079 '<td class="x-date-mp-month x-date-mp-sep"><a href="#">', 14080 Date.getShortMonthName(b + 6), 14081 "</a></td>", 14082 b === 0 14083 ? '<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>' 14084 : '<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>') 14085 } 14086 a 14087 .push( 14088 '<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">', 14089 this.okText, 14090 '</button><button type="button" class="x-date-mp-cancel">', 14091 this.cancelText, "</button></td></tr>", "</table>"); 14092 this.monthPicker.update(a.join("")); 14093 this.mon(this.monthPicker, "click", this.onMonthClick, this); 14094 this.mon(this.monthPicker, "dblclick", this.onMonthDblClick, this); 14095 this.mpMonths = this.monthPicker.select("td.x-date-mp-month"); 14096 this.mpYears = this.monthPicker.select("td.x-date-mp-year"); 14097 this.mpMonths.each(function(c, d, e) { 14098 e += 1; 14099 if ((e % 2) === 0) { 14100 c.dom.xmonth = 5 + Math.round(e * 0.5) 14101 } else { 14102 c.dom.xmonth = Math.round((e - 1) * 0.5) 14103 } 14104 }) 14105 } 14106 }, 14107 showMonthPicker : function() { 14108 if (!this.disabled) { 14109 this.createMonthPicker(); 14110 var a = this.el.getSize(); 14111 this.monthPicker.setSize(a); 14112 this.monthPicker.child("table").setSize(a); 14113 this.mpSelMonth = (this.activeDate || this.value).getMonth(); 14114 this.updateMPMonth(this.mpSelMonth); 14115 this.mpSelYear = (this.activeDate || this.value).getFullYear(); 14116 this.updateMPYear(this.mpSelYear); 14117 this.monthPicker.slideIn("t", { 14118 duration : 0.2 14119 }) 14120 } 14121 }, 14122 updateMPYear : function(e) { 14123 this.mpyear = e; 14124 var c = this.mpYears.elements; 14125 for (var b = 1; b <= 10; b++) { 14126 var d = c[b - 1], a; 14127 if ((b % 2) === 0) { 14128 a = e + Math.round(b * 0.5); 14129 d.firstChild.innerHTML = a; 14130 d.xyear = a 14131 } else { 14132 a = e - (5 - Math.round(b * 0.5)); 14133 d.firstChild.innerHTML = a; 14134 d.xyear = a 14135 } 14136 this.mpYears.item(b - 1)[a == this.mpSelYear 14137 ? "addClass" 14138 : "removeClass"]("x-date-mp-sel") 14139 } 14140 }, 14141 updateMPMonth : function(a) { 14142 this.mpMonths.each(function(b, c, d) { 14143 b[b.dom.xmonth == a ? "addClass" : "removeClass"]("x-date-mp-sel") 14144 }) 14145 }, 14146 selectMPMonth : function(a) { 14147 }, 14148 onMonthClick : function(g, b) { 14149 g.stopEvent(); 14150 var c = new Ext.Element(b), a; 14151 if (c.is("button.x-date-mp-cancel")) { 14152 this.hideMonthPicker() 14153 } else { 14154 if (c.is("button.x-date-mp-ok")) { 14155 var h = new Date(this.mpSelYear, this.mpSelMonth, 14156 (this.activeDate || this.value).getDate()); 14157 if (h.getMonth() != this.mpSelMonth) { 14158 h = new Date(this.mpSelYear, this.mpSelMonth, 1) 14159 .getLastDateOfMonth() 14160 } 14161 this.update(h); 14162 this.hideMonthPicker() 14163 } else { 14164 if ((a = c.up("td.x-date-mp-month", 2))) { 14165 this.mpMonths.removeClass("x-date-mp-sel"); 14166 a.addClass("x-date-mp-sel"); 14167 this.mpSelMonth = a.dom.xmonth 14168 } else { 14169 if ((a = c.up("td.x-date-mp-year", 2))) { 14170 this.mpYears.removeClass("x-date-mp-sel"); 14171 a.addClass("x-date-mp-sel"); 14172 this.mpSelYear = a.dom.xyear 14173 } else { 14174 if (c.is("a.x-date-mp-prev")) { 14175 this.updateMPYear(this.mpyear - 10) 14176 } else { 14177 if (c.is("a.x-date-mp-next")) { 14178 this.updateMPYear(this.mpyear + 10) 14179 } 14180 } 14181 } 14182 } 14183 } 14184 } 14185 }, 14186 onMonthDblClick : function(d, b) { 14187 d.stopEvent(); 14188 var c = new Ext.Element(b), a; 14189 if ((a = c.up("td.x-date-mp-month", 2))) { 14190 this.update(new Date(this.mpSelYear, a.dom.xmonth, 14191 (this.activeDate || this.value).getDate())); 14192 this.hideMonthPicker() 14193 } else { 14194 if ((a = c.up("td.x-date-mp-year", 2))) { 14195 this.update(new Date(a.dom.xyear, this.mpSelMonth, 14196 (this.activeDate || this.value).getDate())); 14197 this.hideMonthPicker() 14198 } 14199 } 14200 }, 14201 hideMonthPicker : function(a) { 14202 if (this.monthPicker) { 14203 if (a === true) { 14204 this.monthPicker.hide() 14205 } else { 14206 this.monthPicker.slideOut("t", { 14207 duration : 0.2 14208 }) 14209 } 14210 } 14211 }, 14212 showPrevMonth : function(a) { 14213 this.update(this.activeDate.add("mo", -1)) 14214 }, 14215 showNextMonth : function(a) { 14216 this.update(this.activeDate.add("mo", 1)) 14217 }, 14218 showPrevYear : function() { 14219 this.update(this.activeDate.add("y", -1)) 14220 }, 14221 showNextYear : function() { 14222 this.update(this.activeDate.add("y", 1)) 14223 }, 14224 handleMouseWheel : function(a) { 14225 a.stopEvent(); 14226 if (!this.disabled) { 14227 var b = a.getWheelDelta(); 14228 if (b > 0) { 14229 this.showPrevMonth() 14230 } else { 14231 if (b < 0) { 14232 this.showNextMonth() 14233 } 14234 } 14235 } 14236 }, 14237 handleDateClick : function(b, a) { 14238 b.stopEvent(); 14239 if (!this.disabled && a.dateValue 14240 && !Ext.fly(a.parentNode).hasClass("x-date-disabled")) { 14241 this.cancelFocus = this.focusOnSelect === false; 14242 this.setValue(new Date(a.dateValue)); 14243 delete this.cancelFocus; 14244 this.fireEvent("select", this, this.value) 14245 } 14246 }, 14247 selectToday : function() { 14248 if (this.todayBtn && !this.todayBtn.disabled) { 14249 this.setValue(new Date().clearTime()); 14250 this.fireEvent("select", this, this.value) 14251 } 14252 }, 14253 update : function(G, A) { 14254 if (this.rendered) { 14255 var a = this.activeDate, p = this.isVisible(); 14256 this.activeDate = G; 14257 if (!A && a && this.el) { 14258 var o = G.getTime(); 14259 if (a.getMonth() == G.getMonth() 14260 && a.getFullYear() == G.getFullYear()) { 14261 this.cells.removeClass("x-date-selected"); 14262 this.cells.each(function(d) { 14263 if (d.dom.firstChild.dateValue == o) { 14264 d.addClass("x-date-selected"); 14265 if (p && !this.cancelFocus) { 14266 Ext.fly(d.dom.firstChild).focus(50) 14267 } 14268 return false 14269 } 14270 }, this); 14271 return 14272 } 14273 } 14274 var k = G.getDaysInMonth(), q = G.getFirstDateOfMonth(), g = q 14275 .getDay() 14276 - this.startDay; 14277 if (g < 0) { 14278 g += 7 14279 } 14280 k += g; 14281 var B = G.add("mo", -1), h = B.getDaysInMonth() - g, e = this.cells.elements, r = this.textNodes, D = (new Date( 14282 B.getFullYear(), B.getMonth(), h, this.initHour)), C = new Date() 14283 .clearTime().getTime(), v = G.clearTime(true).getTime(), u = this.minDate 14284 ? this.minDate.clearTime(true) 14285 : Number.NEGATIVE_INFINITY, y = this.maxDate ? this.maxDate 14286 .clearTime(true) : Number.POSITIVE_INFINITY, F = this.disabledDatesRE, s = this.disabledDatesText, I = this.disabledDays 14287 ? this.disabledDays.join("") 14288 : false, E = this.disabledDaysText, z = this.format; 14289 if (this.showToday) { 14290 var m = new Date().clearTime(), c = (m < u || m > y 14291 || (F && z && F.test(m.dateFormat(z))) || (I && I 14292 .indexOf(m.getDay()) != -1)); 14293 if (!this.disabled) { 14294 this.todayBtn.setDisabled(c); 14295 this.todayKeyListener[c ? "disable" : "enable"]() 14296 } 14297 } 14298 var l = function(J, d) { 14299 d.title = ""; 14300 var i = D.clearTime(true).getTime(); 14301 d.firstChild.dateValue = i; 14302 if (i == C) { 14303 d.className += " x-date-today"; 14304 d.title = J.todayText 14305 } 14306 if (i == v) { 14307 d.className += " x-date-selected"; 14308 if (p) { 14309 Ext.fly(d.firstChild).focus(50) 14310 } 14311 } 14312 if (i < u) { 14313 d.className = " x-date-disabled"; 14314 d.title = J.minText; 14315 return 14316 } 14317 if (i > y) { 14318 d.className = " x-date-disabled"; 14319 d.title = J.maxText; 14320 return 14321 } 14322 if (I) { 14323 if (I.indexOf(D.getDay()) != -1) { 14324 d.title = E; 14325 d.className = " x-date-disabled" 14326 } 14327 } 14328 if (F && z) { 14329 var w = D.dateFormat(z); 14330 if (F.test(w)) { 14331 d.title = s.replace("%0", w); 14332 d.className = " x-date-disabled" 14333 } 14334 } 14335 }; 14336 var x = 0; 14337 for (; x < g; x++) { 14338 r[x].innerHTML = (++h); 14339 D.setDate(D.getDate() + 1); 14340 e[x].className = "x-date-prevday"; 14341 l(this, e[x]) 14342 } 14343 for (; x < k; x++) { 14344 var b = x - g + 1; 14345 r[x].innerHTML = (b); 14346 D.setDate(D.getDate() + 1); 14347 e[x].className = "x-date-active"; 14348 l(this, e[x]) 14349 } 14350 var H = 0; 14351 for (; x < 42; x++) { 14352 r[x].innerHTML = (++H); 14353 D.setDate(D.getDate() + 1); 14354 e[x].className = "x-date-nextday"; 14355 l(this, e[x]) 14356 } 14357 this.mbtn.setT
14357ext(this.monthNames[G.getMonth()] + " " 14358 + G.getFullYear()); 14359 if (!this.internalRender) { 14360 var j = this.el.dom.firstChild, n = j.offsetWidth; 14361 this.el.setWidth(n + this.el.getBorderWidth("lr")); 14362 Ext.fly(j).setWidth(n); 14363 this.internalRender = true; 14364 if (Ext.isOpera && !this.secondPass) { 14365 j.rows[0].cells[1].style.width = (n - (j.rows[0].cells[0].offsetWidth + j.rows[0].cells[2].offsetWidth)) 14366 + "px"; 14367 this.secondPass = true; 14368 this.update.defer(10, this, [G]) 14369 } 14370 } 14371 } 14372 }, 14373 beforeDestroy : function() { 14374 if (this.rendered) { 14375 Ext.destroy(this.keyNav, this.monthPicker, this.eventEl, this.mbtn, 14376 this.nextRepeater, this.prevRepeater, this.cells.el, 14377 this.todayBtn); 14378 delete this.textNodes; 14379 delete this.cells.elements 14380 } 14381 } 14382}); 14383Ext.reg("datepicker", Ext.DatePicker); 14384Ext.LoadMask = function(c, b) { 14385 this.el = Ext.get(c); 14386 Ext.apply(this, b); 14387 if (this.store) { 14388 this.store.on({ 14389 scope : this, 14390 beforeload : this.onBeforeLoad, 14391 load : this.onLoad, 14392 exception : this.onLoad 14393 }); 14394 this.removeMask = Ext.value(this.removeMask, false) 14395 } else { 14396 var a = this.el.getUpdater(); 14397 a.showLoadIndicator = false; 14398 a.on({ 14399 scope : this, 14400 beforeupdate : this.onBeforeLoad, 14401 update : this.onLoad, 14402 failure : this.onLoad 14403 }); 14404 this.removeMask = Ext.value(this.removeMask, true) 14405 } 14406}; 14407Ext.LoadMask.prototype = { 14408 msg : "Loading...", 14409 msgCls : "x-mask-loading", 14410 disabled : false, 14411 disable : function() { 14412 this.disabled = true 14413 }, 14414 enable : function() { 14415 this.disabled = false 14416 }, 14417 onLoad : function() { 14418 this.el.unmask(this.removeMask) 14419 }, 14420 onBeforeLoad : function() { 14421 if (!this.disabled) { 14422 this.el.mask(this.msg, this.msgCls) 14423 } 14424 }, 14425 show : function() { 14426 this.onBeforeLoad() 14427 }, 14428 hide : function() { 14429 this.onLoad() 14430 }, 14431 destroy : function() { 14432 if (this.store) { 14433 this.store.un("beforeload", this.onBeforeLoad, this); 14434 this.store.un("load", this.onLoad, this); 14435 this.store.un("exception", this.onLoad, this) 14436 } else { 14437 var a = this.el.getUpdater(); 14438 a.un("beforeupdate", this.onBeforeLoad, this); 14439 a.un("update", this.onLoad, this); 14440 a.un("failure", this.onLoad, this) 14441 } 14442 } 14443}; 14444 14445Ext.ProgressBar = Ext.extend(Ext.BoxComponent, { 14446 baseCls : "x-progress", 14447 animate : false, 14448 waitTimer : null, 14449 initComponent : function() { 14450 Ext.ProgressBar.superclass.initComponent.call(this); 14451 this.addEvents("update") 14452 }, 14453 onRender : function(d, a) { 14454 var c = new Ext.Template('<div class="{cls}-wrap">', 14455 '<div class="{cls}-inner">', '<div class="{cls}-bar">', 14456 '<div class="{cls}-text">', "<div> </div>", 14457 "</div>", "</div>", 14458 '<div class="{cls}-text {cls}-text-back">', 14459 "<div> </div>", "</div>", "</div>", "</div>"); 14460 this.el = a ? c.insertBefore(a, { 14461 cls : this.baseCls 14462 }, true) : c.append(d, { 14463 cls : this.baseCls 14464 }, true); 14465 if (this.id) { 14466 this.el.dom.id = this.id 14467 } 14468 var b = this.el.dom.firstChild; 14469 this.progressBar = Ext.get(b.firstChild); 14470 if (this.textEl) { 14471 this.textEl = Ext.get(this.textEl); 14472 delete this.textTopEl 14473 } else { 14474 this.textTopEl = Ext.get(this.progressBar.dom.firstChild); 14475 var e = Ext.get(b.childNodes[1]); 14476 this.textTopEl.setStyle("z-index", 99).addClass("x-hidden"); 14477 this.textEl = new Ext.CompositeElement([ 14478 this.textTopEl.dom.firstChild, e.dom.firstChild]); 14479 this.textEl.setWidth(b.offsetWidth) 14480 } 14481 this.progressBar.setHeight(b.offsetHeight) 14482 }, 14483 afterRender : function() { 14484 Ext.ProgressBar.superclass.afterRender.call(this); 14485 if (this.value) { 14486 this.updateProgress(this.value, this.text) 14487 } else { 14488 this.updateText(this.text) 14489 } 14490 }, 14491 updateProgress : function(c, d, b) { 14492 this.value = c || 0; 14493 if (d) { 14494 this.updateText(d) 14495 } 14496 if (this.rendered && !this.isDestroyed) { 14497 var a = Math.floor(c * this.el.dom.firstChild.offsetWidth);
14498 this.progressBar.setWidth(a, b === true 14499 || (b !== false && this.animate)); 14500 if (this.textTopEl) { 14501 this.textTopEl.removeClass("x-hidden").setWidth(a) 14502 } 14503 } 14504 this.fireEvent("update", this, c, d); 14505 return this 14506 }, 14507 wait : function(b) { 14508 if (!this.waitTimer) { 14509 var a = this; 14510 b = b || {}; 14511 this.updateText(b.text); 14512 this.waitTimer = Ext.TaskMgr.start({ 14513 run : function(c) { 14514 var d = b.increment || 10; 14515 c -= 1; 14516 this.updateProgress( 14517 ((((c + d) % d) + 1) * (100 / d)) 14518 * 0.01, null, b.animate) 14519 }, 14520 interval : b.interval || 1000, 14521 duration : b.duration, 14522 onStop : function() { 14523 if (b.fn) { 14524 b.fn.apply(b.scope || this) 14525 } 14526 this.reset() 14527 }, 14528 scope : a 14529 }) 14530 } 14531 return this 14532 }, 14533 isWaiting : function() { 14534 return this.waitTimer !== null 14535 }, 14536 updateText : function(a) { 14537 this.text = a || " "; 14538 if (this.rendered) { 14539 this.textEl.update(this.text) 14540 } 14541 return this 14542 }, 14543 syncProgressBar : function() { 14544 if (this.value) { 14545 this.updateProgress(this.value, this.text) 14546 } 14547 return this 14548 }, 14549 setSize : function(a, c) { 14550 Ext.ProgressBar.superclass.setSize.call(this, a, c); 14551 if (this.textTopEl) { 14552 var b = this.el.dom.firstChild; 14553 this.textEl.setSize(b.offsetWidth, b.offsetHeight) 14554 } 14555 this.syncProgressBar(); 14556 return this 14557 }, 14558 reset : function(a) { 14559 this.updateProgress(0); 14560 if (this.textTopEl) { 14561 this.textTopEl.addClass("x-hidden") 14562 } 14563 this.clearTimer(); 14564 if (a === true) { 14565 this.hide() 14566 } 14567 return this 14568 }, 14569 clearTimer : function() { 14570 if (this.waitTimer) { 14571 this.waitTimer.onStop = null; 14572 Ext.TaskMgr.stop(this.waitTimer); 14573 this.waitTimer = null 14574 } 14575 }, 14576 onDestroy : function() { 14577 this.clearTimer(); 14578 if (this.rendered) { 14579 if (this.textEl.isComposite) { 14580 this.textEl.clear() 14581 } 14582 Ext.destroyMembers(this, "textEl", "progressBar", 14583 "textTopEl") 14584 } 14585 Ext.ProgressBar.superclass.onDestroy.call(this) 14586 } 14587 }); 14588Ext.reg("progress", Ext.ProgressBar); 14589(function() { 14590 var a = Ext.EventManager; 14591 var b = Ext.lib.Dom; 14592 Ext.dd.DragDrop = function(e, c, d) { 14593 if (e) { 14594 this.init(e, c, d) 14595 } 14596 }; 14597 Ext.dd.DragDrop.prototype = { 14598 id : null, 14599 config : null, 14600 dragElId : null, 14601 handleElId : null, 14602 invalidHandleTypes : null, 14603 invalidHandleIds : null, 14604 invalidHandleClasses : null, 14605 startPageX : 0, 14606 startPageY : 0, 14607 groups : null, 14608 locked : false, 14609 lock : function() { 14610 this.locked = true 14611 }, 14612 moveOnly : false, 14613 unlock : function() { 14614 this.locked = false 14615 }, 14616 isTarget : true, 14617 padding : null, 14618 _domRef : null, 14619 __ygDragDrop : true, 14620 constrainX : false, 14621 constrainY : false, 14622 minX : 0, 14623 maxX : 0, 14624 minY : 0, 14625 maxY : 0, 14626 maintainOffset : false, 14627 xTicks : null, 14628 yTicks : null, 14629 primaryButtonOnly : true, 14630 available : false, 14631 hasOuterHandles : false, 14632 b4StartDrag : function(c, d) { 14633 }, 14634 startDrag : function(c, d) { 14635 }, 14636 b4Drag : function(c) { 14637 }, 14638 onDrag : function(c) { 14639 }, 14640 onDragEnter : function(c, d) { 14641 }, 14642 b4DragOver : function(c) { 14643 }, 14644 onDragOver : function(c, d) { 14645 }, 14646 b4DragOut : function(c) { 14647 }, 14648 onDragOut : function(c, d) { 14649 }, 14650 b4DragDrop : function(c) { 14651 }, 14652 onDragDrop : function(c, d) { 14653 }, 14654 onInvalidDrop : function(c) { 14655 }, 14656 b4EndDrag : function(c) { 14657 }, 14658 endDrag : function(c) { 14659 }, 14660 b4MouseDown : function(c) { 14661 }, 14662 onMouseDown : function(c) { 14663 }, 14664 onMouseUp : function(c) { 14665 }, 14666 onAvailable : function() { 14667 }, 14668 defaultPadding : { 14669 left : 0, 14670 right : 0, 14671 top : 0, 14672 bottom : 0 14673 }, 14674 constrainTo : function(j, h, o) { 14675 if (Ext.isNumber(h)) { 14676 h = { 14677 left : h, 14678 right : h, 14679 top : h, 14680 bottom : h 14681 } 14682 } 14683 h = h || this.defaultPadding; 14684 var l = Ext.get(this.getEl()).getBox(), d = Ext.get(j), n = d 14685 .getScroll(), k, e = d.dom; 14686 if (e == document.body) { 14687 k = { 14688 x : n.left, 14689 y : n.top, 14690 width : Ext.lib.Dom.getViewWidth(), 14691 height : Ext.lib.Dom.getViewHeight() 14692 } 14693 } else { 14694 var m = d.getXY(); 14695 k = { 14696 x : m[0], 14697 y : m[1], 14698 width : e.clientWidth, 14699 height : e.clientHeight 14700 } 14701 } 14702 var i = l.y - k.y, g = l.x - k.x; 14703 this.resetConstraints();
14704 this.setXConstraint(g - (h.left || 0), k.width - g - l.width 14705 - (h.right || 0), this.xTickSize); 14706 this.setYConstraint(i - (h.top || 0), k.height - i - l.height 14707 - (h.bottom || 0), this.yTickSize) 14708 }, 14709 getEl : function() { 14710 if (!this._domRef) { 14711 this._domRef = Ext.getDom(this.id) 14712 } 14713 return this._domRef 14714 }, 14715 getDragEl : function() { 14716 return Ext.getDom(this.dragElId) 14717 }, 14718 init : function(e, c, d) { 14719 this.initTarget(e, c, d); 14720 a.on(this.id, "mousedown", this.handleMouseDown, this) 14721 }, 14722 initTarget : function(e, c, d) { 14723 this.config = d || {}; 14724 this.DDM = Ext.dd.DDM; 14725 this.groups = {}; 14726 if (typeof e !== "string") { 14727 e = Ext.id(e) 14728 } 14729 this.id = e; 14730 this.addToGroup((c) ? c : "default"); 14731 this.handleElId = e; 14732 this.setDragElId(e); 14733 this.invalidHandleTypes = { 14734 A : "A" 14735 }; 14736 this.invalidHandleIds = {}; 14737 this.invalidHandleClasses = []; 14738 this.applyConfig(); 14739 this.handleOnAvailable() 14740 }, 14741 applyConfig : function() { 14742 this.padding = this.config.padding || [0, 0, 0, 0]; 14743 this.isTarget = (this.config.isTarget !== false); 14744 this.maintainOffset = (this.config.maintainOffset); 14745 this.primaryButtonOnly = (this.config.primaryButtonOnly !== false) 14746 }, 14747 handleOnAvailable : function() { 14748 this.available = true; 14749 this.resetConstraints(); 14750 this.onAvailable() 14751 }, 14752 setPadding : function(e, c, g, d) { 14753 if (!c && 0 !== c) { 14754 this.padding = [e, e, e, e] 14755 } else { 14756 if (!g && 0 !== g) { 14757 this.padding = [e, c, e, c] 14758 } else { 14759 this.padding = [e, c, g, d] 14760 } 14761 } 14762 }, 14763 setInitPosition : function(g, e) { 14764 var h = this.getEl(); 14765 if (!this.DDM.verifyEl(h)) { 14766 return 14767 } 14768 var d = g || 0; 14769 var c = e || 0; 14770 var i = b.getXY(h); 14771 this.initPageX = i[0] - d; 14772 this.initPageY = i[1] - c; 14773 this.lastPageX = i[0]; 14774 this.lastPageY = i[1]; 14775 this.setStartPosition(i) 14776 }, 14777 setStartPosition : function(d) { 14778 var c = d || b.getXY(this.getEl()); 14779 this.deltaSetXY = null; 14780 this.startPageX = c[0]; 14781 this.startPageY = c[1] 14782 }, 14783 addToGroup : function(c) { 14784 this.groups[c] = true; 14785 this.DDM.regDragDrop(this, c) 14786 }, 14787 removeFromGroup : function(c) { 14788 if (this.groups[c]) { 14789 delete this.groups[c] 14790 } 14791 this.DDM.removeDDFromGroup(this, c) 14792 }, 14793 setDragElId : function(c) { 14794 this.dragElId = c 14795 }, 14796 setHandleElId : function(c) { 14797 if (typeof c !== "string") { 14798 c = Ext.id(c) 14799 } 14800 this.handleElId = c; 14801 this.DDM.regHandle(this.id, c) 14802 }, 14803 setOuterHandleElId : function(c) { 14804 if (typeof c !== "string") { 14805 c = Ext.id(c) 14806 } 14807 a.on(c, "mousedown", this.handleMouseDown, this); 14808 this.setHandleElId(c); 14809 this.hasOuterHandles = true 14810 }, 14811 unreg : function() { 14812 a.un(this.id, "mousedown", this.handleMouseDown); 14813 this._domRef = null; 14814 this.DDM._remove(this) 14815 }, 14816 destroy : function() { 14817 this.unreg() 14818 }, 14819 isLocked : function() { 14820 return (this.DDM.isLocked() || this.locked) 14821 }, 14822 handleMouseDown : function(g, d) { 14823 if (this.primaryButtonOnly && g.button != 0) { 14824 return 14825 } 14826 if (this.isLocked()) { 14827 return 14828 } 14829 this.DDM.refreshCache(this.groups); 14830 var c = new Ext.lib.Point(Ext.lib.Event.getPageX(g), Ext.lib.Event 14831 .getPageY(g)); 14832 if (!this.hasOuterHandles && !this.DDM.isOverTarget(c, this)) { 14833 } else { 14834 if (this.clickValidator(g)) { 14835 this.setStartPosition(); 14836 this.b4MouseDown(g); 14837 this.onMouseDown(g); 14838 this.DDM.handleMouseDown(g, this); 14839 this.DDM.stopEvent(g) 14840 } else { 14841 } 14842 } 14843 }, 14844 clickValidator : function(d) { 14845 var c = d.getTarget(); 14846 return (this.isValidHandleChild(c) && (this.id == this.handleElId || this.DDM 14847 .handleWasClicked(c, this.id))) 14848 }, 14849 addInvalidHandleType : function(c) { 14850 var d = c.toUpperCase(); 14851 this.invalidHandleTypes[d] = d 14852 }, 14853 addInvalidHandleId : function(c) { 14854 if (typeof c !== "string") { 14855 c = Ext.id(c) 14856 } 14857 this.invalidHandleIds[c] = c 14858 }, 14859 addInvalidHandleClass : function(c) { 14860 this.invalidHandleClasses.push(c) 14861 }, 14862 removeInvalidHandleType : function(c) { 14863 var d = c.toUpperCase(); 14864 delete this.invalidHandleTypes[d] 14865 }, 14866 removeInvalidHandleId : function(c) { 14867 if (typeof c !== "string") { 14868 c = Ext.id(c) 14869 } 14870 delete this.invalidHandleIds[c] 14871 }, 14872 removeInvalidHandleClass : function(d) { 14873 for (var e = 0, c = this.invalidHandleClasses.length; e < c; ++e) { 14874 if (this.invalidHandleClasses[e] == d) { 14875 delete this.invalidHandleClasses[e] 14876 } 14877 } 14878 }, 14879 isValidHandleChild : function(h) { 14880 var g = true; 14881 var k; 14882 try { 14883 k = h.nodeName.toUpperCase() 14884 } catch (j) { 14885 k = h.nodeName 14886 } 14887 g = g && !this.invalidHandleTypes[k]; 14888 g = g && !this.invalidHandleIds[h.id]; 14889 for (var d = 0, c = this.invalidHandleClasses.length; g && d < c; ++d) { 14890 g = !Ext.fly(h).hasClass(this.invalidHandleClasses[d]) 14891 } 14892 return g 14893 }, 14894 setXTicks : function(g, c) { 14895 this.xTicks = []; 14896 this.xTickSize = c; 14897 var e = {}; 14898 for (var d = this.initPageX; d >= this.minX; d = d - c) { 14899 if (!e[d]) { 14900 this.xTicks[this.xTicks.length] = d; 14901 e[d] = true 14902 } 14903 } 14904 for (d = this.initPageX; d <= this.maxX; d = d + c) { 14905 if (!e[d]) { 14906 this.xTicks[this.xTicks.length] = d; 14907 e[d] = true 14908 } 14909 } 14910 this.xTicks.sort(this.DDM.numericSort) 14911 }, 14912 setYTicks : function(g, c) { 14913 this.yTicks = []; 14914 this.yTickSize = c; 14915 var e = {}; 14916 for (var d = this.initPageY; d >= this.minY; d = d - c) { 14917 if (!e[d]) { 14918 this.yTicks[this.yTicks.length] = d; 14919 e[d] = true 14920 } 14921 } 14922 for (d = this.initPageY; d <= this.maxY; d = d + c) { 14923 if (!e[d]) { 14924 this.yTicks[this.yTicks.length] = d; 14925 e[d] = true 14926 } 14927 } 14928 this.yTicks.sort(this.DDM.numericSort) 14929 }, 14930 setXConstraint : function(e, d, c) { 14931 this.leftConstraint = e; 14932 this.rightConstraint = d; 14933 this.minX = this.initPageX - e; 14934 this.maxX = this.initPageX + d; 14935 if (c) { 14936 this.setXTicks(this.initPageX, c) 14937 } 14938 this.constrainX = true 14939 }, 14940 clearConstraints : function() { 14941 this.constrainX = false; 14942 this.constrainY = false; 14943 this.clearTicks() 14944 }, 14945 clearTicks : function() { 14946 this.xTicks = null; 14947 this.yTicks = null; 14948 this.xTickSize = 0; 14949 this.yTickSize = 0 14950 }, 14951 setYConstraint : function(c, e, d) { 14952 this.topConstraint = c; 14953 this.bottomConstraint = e; 14954 this.minY = this.initPageY - c; 14955 this.maxY = this.initPageY + e; 14956 if (d) { 14957 this.setYTicks(this.initPageY, d) 14958 } 14959 this.constrainY = true 14960 }, 14961 resetConstraints : function() { 14962 if (this.initPageX || this.initPageX === 0) { 14963 var d = (this.maintainOffset) 14964 ? this.lastPageX - this.initPageX 14965 : 0; 14966 var c = (this.maintainOffset) 14967 ? this.lastPageY - this.initPageY 14968 : 0; 14969 this.setInitPosition(d, c) 14970 } else { 14971 this.setInitPosition() 14972 } 14973 if (this.constrainX) { 14974 this.setXConstraint(this.leftConstraint, this.rightConstraint, 14975 this.xTickSize) 14976 } 14977 if (this.constrainY) { 14978 this.setYConstraint(this.topConstraint, this.bottomConstraint, 14979 this.yTickSize) 14980 } 14981 }, 14982 getTick : function(k, g) { 14983 if (!g) { 14984 return k 14985 } else { 14986 if (g[0] >= k) { 14987 return g[0] 14988 } else { 14989 for (var d = 0, c = g.length; d < c; ++d) { 14990 var e = d + 1; 14991 if (g[e] && g[e] >= k) { 14992 var j = k - g[d]; 14993 var h = g[e] - k; 14994 return (h > j) ? g[d] : g[e] 14995 } 14996 } 14997 return g[g.length - 1] 14998 } 14999 } 15000 }, 15001 toString : function() { 15002 return ("DragDrop " + this.id) 15003 } 15004 } 15005})(); 15006if (!Ext.dd.DragDropMgr) { 15007 Ext.dd.DragDropMgr = function() { 15008 var a = Ext.EventManager; 15009 return { 15010 ids : {}, 15011 handleIds : {}, 15012 dragCurrent : null, 15013 dragOvers : {}, 15014 deltaX : 0, 15015 deltaY : 0, 15016 preventDefault : true, 15017 stopPropagation : true, 15018 initialized : false, 15019 locked : false, 15020 init : function() { 15021 this.initialized = true 15022 }, 15023 POINT : 0, 15024 INTERSECT : 1, 15025 mode : 0, 15026 _execOnAll : function(d, c) { 15027 for (var e in this.ids) { 15028 for (var b in this.ids[e]) { 15029 var g = this.ids[e][b]; 15030 if (!this.isTypeOfDD(g)) { 15031 continue 15032 } 15033 g[d].apply(g, c) 15034 } 15035 } 15036 }, 15037 _onLoad : function() { 15038 this.init(); 15039 a.on(document, "mouseup", this.handleMouseUp, this, true); 15040 a.on(document, "mousemove", this.handleMouseMove, this, true); 15041 a.on(window, "unload", this._onUnload, this, true); 15042 a.on(window, "resize", this._onResize, this, true) 15043 }, 15044 _onResize : function(b) { 15045 this._execOnAll("resetConstraints", []) 15046 }, 15047 lock : function() { 15048 this.locked = true 15049 }, 15050 unlock : function() { 15051 this.locked = false 15052 }, 15053 isLocked : function() { 15054 return this.locked 15055 }, 15056 locationCache : {}, 15057 useCache : true, 15058 clickPixelThresh : 3, 15059 clickTimeThresh : 350, 15060 dragThreshMet : false, 15061 clickTimeout : null, 15062 startX : 0, 15063 startY : 0, 15064 regDragDrop : function(c, b) { 15065 if (!this.initialized) { 15066 this.init() 15067 } 15068 if (!this.ids[b]) { 15069 this.ids[b] = {} 15070 } 15071 this.ids[b][c.id] = c 15072 }, 15073 removeDDFromGroup : function(d, b) { 15074 if (!this.ids[b]) { 15075 this.ids[b] = {} 15076 } 15077 var c = this.ids[b]; 15078 if (c && c[d.id]) { 15079 delete c[d.id] 15080 } 15081 }, 15082 _remove : function(c) { 15083 for (var b in c.groups) { 15084 if (b && this.ids[b] && this.ids[b][c.id]) { 15085 delete this.ids[b][c.id] 15086 } 15087 } 15088 delete this.handleIds[c.id] 15089 }, 15090 regHandle : function(c, b) { 15091 if (!this.handleIds[c]) { 15092 this.handleIds[c] = {} 15093 } 15094 this.handleIds[c][b] = b 15095 }, 15096 isDragDrop : function(b) { 15097 return (this.getDDById(b)) ? true : false 15098 }, 15099 getRelated : function(h, c) { 15100 var g = []; 15101 for (var e in h.groups) { 15102 for (var d in this.ids[e]) { 15103 var b = this.ids[e][d]; 15104 if (!this.isTypeOfDD(b)) { 15105 continue 15106 } 15107 if (!c || b.isTarget) { 15108 g[g.length] = b 15109 } 15110 } 15111 } 15112 return g 15113 }, 15114 isLegalTarget : function(g, e) { 15115 var c = this.getRelated(g, true); 15116 for (var d = 0, b = c.length; d < b; ++d) { 15117 if (c[d].id == e.id) { 15118 return true 15119 } 15120 } 15121 return false 15122 }, 15123 isTypeOfDD : function(b) { 15124 return (b && b.__ygDragDrop) 15125 }, 15126 isHandle : function(c, b) { 15127 return (this.handleIds[c] && this.handleIds[c][b]) 15128 }, 15129 getDDById : function(c) { 15130 for (var b in this.ids) { 15131 if (this.ids[b][c]) { 15132 return this.ids[b][c] 15133 } 15134 } 15135 return null 15136 }, 15137 handleMouseDown : function(d, c) { 15138 if (Ext.QuickTips) { 15139 Ext.QuickTips.ddDisable() 15140 } 15141 if (this.dragCurrent) { 15142 this.handleMouseUp(d) 15143 } 15144 this.currentTarget = d.getTarget(); 15145 this.dragCurrent = c; 15146 var b = c.getEl(); 15147 this.startX = d.getPageX(); 15148 this.startY = d.getPageY(); 15149 this.deltaX = this.startX - b.offsetLeft; 15150 this.deltaY = this.startY - b.offsetTop; 15151 this.dragThreshMet = false; 15152 this.clickTimeout = setTimeout(function() { 15153 var e = Ext.dd.DDM; 15154 e.startDrag(e.startX, e.startY) 15155 }, this.clickTimeThresh) 15156 }, 15157 startDrag : function(b, c) { 15158 clearTimeout(this.clickTimeout); 15159 if (this.dragCurrent) { 15160 this.dragCurrent.b4StartDrag(b, c); 15161 this.dragCurrent.startDrag(b, c) 15162 } 15163 this.dragThreshMet = true 15164 }, 15165 handleMouseUp : function(b) { 15166 if (Ext.QuickTips) { 15167 Ext.QuickTips.ddEnable() 15168 } 15169 if (!this.dragCurrent) { 15170 return 15171 } 15172 clearTimeout(this.clickTimeout); 15173 if (this.dragThreshMet) { 15174 this.fireEvents(b, true) 15175 } else { 15176 } 15177 this.stopDrag(b); 15178 this.stopEvent(b) 15179 }, 15180 stopEvent : function(b) { 15181 if (this.stopPropagation) { 15182 b.stopPropagation() 15183 } 15184 if (this.preventDefault) { 15185 b.preventDefault() 15186 } 15187 }, 15188 stopDrag : function(b) { 15189 if (this.dragCurrent) { 15190 if (this.dragThreshMet) { 15191 this.dragCurrent.b4EndDrag(b); 15192 this.dragCurrent.endDrag(b) 15193 } 15194 this.dragCurrent.onMouseUp(b) 15195 } 15196 this.dragCurrent = null; 15197 this.dragOvers = {} 15198 }, 15199 handleMouseMove : function(d) { 15200 if (!this.dragCurrent) { 15201 return true 15202 } 15203 if (Ext.isIE 15204 && (d.button !== 0 && d.button !== 1 && d.button !== 2)) { 15205 this.stopEvent(d); 15206 return this.handleMouseUp(d) 15207 } 15208 if (!this.dragThreshMet) { 15209 var c = Math.abs(this.startX - d.getPageX()); 15210 var b = Math.abs(this.startY - d.getPageY()); 15211 if (c > this.clickPixelThresh || b > this.clickPixelThresh) { 15212 this.startDrag(this.startX, this.startY) 15213 } 15214 } 15215 if (this.dragThreshMet) { 15216 this.dragCurrent.b4Drag(d); 15217 this.dragCurrent.onDrag(d); 15218 if (!this.dragCurrent.moveOnly) { 15219 this.fireEvents(d, false) 15220 } 15221 } 15222 this.stopEvent(d); 15223 return true 15224 }, 15225 fireEvents : function(n, o) { 15226 var q = this.dragCurrent; 15227 if (!q || q.isLocked()) { 15228 return 15229 } 15230 var r = n.getPoint(); 15231 var b = []; 15232 var g = []; 15233 var l = []; 15234 var j = []; 15235 var d = []; 15236 for (var h in this.dragOvers) {
15237 var c = this.dragOvers[h]; 15238 if (!this.isTypeOfDD(c)) { 15239 continue 15240 } 15241 if (!this.isOverTarget(r, c, this.mode)) { 15242 g.push(c) 15243 } 15244 b[h] = true; 15245 delete this.dragOvers[h] 15246 } 15247 for (var p in q.groups) { 15248 if ("string" != typeof p) { 15249 continue 15250 } 15251 for (h in this.ids[p]) { 15252 var k = this.ids[p][h]; 15253 if (!this.isTypeOfDD(k)) { 15254 continue 15255 } 15256 if (k.isTarget && !k.isLocked() 15257 && ((k != q) || (q.ignoreSelf === false))) { 15258 if (this.isOverTarget(r, k, this.mode)) { 15259 if (o) { 15260 j.push(k) 15261 } else { 15262 if (!b[k.id]) { 15263 d.push(k) 15264 } else { 15265 l.push(k) 15266 } 15267 this.dragOvers[k.id] = k 15268 } 15269 } 15270 } 15271 } 15272 } 15273 if (this.mode) { 15274 if (g.length) { 15275 q.b4DragOut(n, g); 15276 q.onDragOut(n, g) 15277 } 15278 if (d.length) { 15279 q.onDragEnter(n, d) 15280 } 15281 if (l.length) { 15282 q.b4DragOver(n, l); 15283 q.onDragOver(n, l) 15284 } 15285 if (j.length) { 15286 q.b4DragDrop(n, j); 15287 q.onDragDrop(n, j) 15288 } 15289 } else { 15290 var m = 0; 15291 for (h = 0, m = g.length; h < m; ++h) { 15292 q.b4DragOut(n, g[h].id); 15293 q.onDragOut(n, g[h].id) 15294 } 15295 for (h = 0, m = d.length; h < m; ++h) { 15296 q.onDragEnter(n, d[h].id) 15297 } 15298 for (h = 0, m = l.length; h < m; ++h) { 15299 q.b4DragOver(n, l[h].id); 15300 q.onDragOver(n, l[h].id) 15301 } 15302 for (h = 0, m = j.length; h < m; ++h) { 15303 q.b4DragDrop(n, j[h].id); 15304 q.onDragDrop(n, j[h].id) 15305 } 15306 } 15307 if (o && !j.length) { 15308 q.onInvalidDrop(n) 15309 } 15310 }, 15311 getBestMatch : function(d) { 15312 var g = null; 15313 var c = d.length; 15314 if (c == 1) { 15315 g = d[0] 15316 } else { 15317 for (var e = 0; e < c; ++e) { 15318 var b = d[e]; 15319 if (b.cursorIsOver) { 15320 g = b; 15321 break 15322 } else { 15323 if (!g || g.overlap.getArea() < b.overlap.getArea()) { 15324 g = b 15325 } 15326 } 15327 } 15328 } 15329 return g 15330 }, 15331 refreshCache : function(c) { 15332 for (var b in c) { 15333 if ("string" != typeof b) { 15334 continue 15335 } 15336 for (var d in this.ids[b]) { 15337 var e = this.ids[b][d]; 15338 if (this.isTypeOfDD(e)) { 15339 var g = this.getLocation(e); 15340 if (g) { 15341 this.locationCache[e.id] = g 15342 } else { 15343 delete this.locationCache[e.id] 15344 } 15345 } 15346 } 15347 } 15348 }, 15349 verifyEl : function(c) { 15350 if (c) { 15351 var b; 15352 if (Ext.isIE) { 15353 try { 15354 b = c.offsetParent 15355 } catch (d) { 15356 } 15357 } else { 15358 b = c.offsetParent 15359 } 15360 if (b) { 15361 return true 15362 } 15363 } 15364 return false 15365 }, 15366 getLocation : function(j) { 15367 if (!this.isTypeOfDD(j)) { 15368 return null 15369 } 15370 var h = j.getEl(), o, g, d, q, p, s, c, n, i, m; 15371 try { 15372 o = Ext.lib.Dom.getXY(h) 15373 } catch (k) { 15374 } 15375 if (!o) { 15376 return null 15377 } 15378 g = o[0]; 15379 d = g + h.offsetWidth; 15380 q = o[1]; 15381 p = q + h.offsetHeight; 15382 s = q - j.padding[0]; 15383 c = d + j.padding[1]; 15384 n = p + j.padding[2]; 15385 i = g - j.padding[3]; 15386 m = new Ext.lib.Region(s, c, n, i); 15387 h = Ext.get(h.parentNode); 15388 while (h && m) { 15389 if (h.isScrollable()) { 15390 m = m.intersect(h.getRegion()) 15391 } 15392 h = h.parent() 15393 } 15394 return m 15395 }, 15396 isOverTarget : function(k, b, d) { 15397 var g = this.locationCache[b.id]; 15398 if (!g || !this.useCache) { 15399 g = this.getLocation(b); 15400 this.locationCache[b.id] = g 15401 } 15402 if (!g) { 15403 return false 15404 } 15405 b.cursorIsOver = g.contains(k); 15406 var j = this.dragCurrent; 15407 if (!j || !j.getTargetCoord 15408 || (!d && !j.constrainX && !j.constrainY)) { 15409 return b.cursorIsOver 15410 } 15411 b.overlap = null; 15412 var h = j.getTargetCoord(k.x, k.y); 15413 var c = j.getDragEl(); 15414 var e = new Ext.lib.Region(h.y, h.x + c.offsetWidth, h.y 15415 + c.offsetHeight, h.x); 15416 var i = e.intersect(g); 15417 if (i) { 15418 b.overlap = i; 15419 return (d) ? true : b.cursorIsOver 15420 } else { 15421 return false 15422 } 15423 }, 15424 _onUnload : function(c, b) { 15425 a.removeListener(document, "mouseup", this.handleMouseUp, this); 15426 a.removeListener(document, "mousemove", this.handleMouseMove, 15427 this); 15428 a.removeListener(window, "resize", this._onResize, this); 15429 Ext.dd.DragDropMgr.unregAll() 15430 }, 15431 unregAll : function() { 15432 if (this.dragCurrent) {
15433 this.stopDrag(); 15434 this.dragCurrent = null 15435 } 15436 this._execOnAll("unreg", []); 15437 for (var b in this.elementCache) { 15438 delete this.elementCache[b] 15439 } 15440 this.elementCache = {}; 15441 this.ids = {} 15442 }, 15443 elementCache : {}, 15444 getElWrapper : function(c) { 15445 var b = this.elementCache[c]; 15446 if (!b || !b.el) { 15447 b = this.elementCache[c] = new this.ElementWrapper(Ext 15448 .getDom(c)) 15449 } 15450 return b 15451 }, 15452 getElement : function(b) { 15453 return Ext.getDom(b) 15454 }, 15455 getCss : function(c) { 15456 var b = Ext.getDom(c); 15457 return (b) ? b.style : null 15458 }, 15459 ElementWrapper : function(b) { 15460 this.el = b || null; 15461 this.id = this.el && b.id; 15462 this.css = this.el && b.style 15463 }, 15464 getPosX : function(b) { 15465 return Ext.lib.Dom.getX(b) 15466 }, 15467 getPosY : function(b) { 15468 return Ext.lib.Dom.getY(b) 15469 }, 15470 swapNode : function(d, b) { 15471 if (d.swapNode) { 15472 d.swapNode(b) 15473 } else { 15474 var e = b.parentNode; 15475 var c = b.nextSibling; 15476 if (c == d) { 15477 e.insertBefore(d, b) 15478 } else { 15479 if (b == d.nextSibling) { 15480 e.insertBefore(b, d) 15481 } else { 15482 d.parentNode.replaceChild(b, d); 15483 e.insertBefore(d, c) 15484 } 15485 } 15486 } 15487 }, 15488 getScroll : function() { 15489 var d, b, e = document.documentElement, c = document.body; 15490 if (e && (e.scrollTop || e.scrollLeft)) { 15491 d = e.scrollTop; 15492 b = e.scrollLeft 15493 } else { 15494 if (c) { 15495 d = c.scrollTop; 15496 b = c.scrollLeft 15497 } else { 15498 } 15499 } 15500 return { 15501 top : d, 15502 left : b 15503 } 15504 }, 15505 getStyle : function(c, b) { 15506 return Ext.fly(c).getStyle(b) 15507 }, 15508 getScrollTop : function() { 15509 return this.getScroll().top 15510 }, 15511 getScrollLeft : function() { 15512 return this.getScroll().left 15513 }, 15514 moveToEl : function(b, d) { 15515 var c = Ext.lib.Dom.getXY(d); 15516 Ext.lib.Dom.setXY(b, c) 15517 }, 15518 numericSort : function(d, c) { 15519 return (d - c) 15520 }, 15521 _timeoutCount : 0, 15522 _addListeners : function() { 15523 var b = Ext.dd.DDM; 15524 if (Ext.lib.Event && document) { 15525 b._onLoad() 15526 } else { 15527 if (b._timeoutCount > 2000) { 15528 } else { 15529 setTimeout(b._addListeners, 10); 15530 if (document && document.body) { 15531 b._timeoutCount += 1 15532 } 15533 } 15534 } 15535 }, 15536 handleWasClicked : function(b, d) { 15537 if (this.isHandle(d, b.id)) { 15538 return true 15539 } else { 15540 var c = b.parentNode; 15541 while (c) { 15542 if (this.isHandle(d, c.id)) { 15543 return true 15544 } else { 15545 c = c.parentNode 15546 } 15547 } 15548 } 15549 return false 15550 } 15551 } 15552 }(); 15553 Ext.dd.DDM = Ext.dd.DragDropMgr; 15554 Ext.dd.DDM._addListeners() 15555} 15556Ext.dd.DD = function(c, a, b) { 15557 if (c) { 15558 this.init(c, a, b) 15559 } 15560}; 15561Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, { 15562 scroll : true, 15563 autoOffset : function(c, b) { 15564 var a = c - this.startPageX; 15565 var d = b - this.startPageY; 15566 this.setDelta(a, d) 15567 }, 15568 setDelta : function(b, a) { 15569 this.deltaX = b; 15570 this.deltaY = a 15571 }, 15572 setDragElPos : function(c, b) { 15573 var a = this.getDragEl(); 15574 this.alignElWithMouse(a, c, b) 15575 }, 15576 alignElWithMouse : function(c, h, g) { 15577 var e = this.getTargetCoord(h, g); 15578 var b = c.dom ? c : Ext.fly(c, "_dd"); 15579 if (!this.deltaSetXY) { 15580 var i = [e.x, e.y]; 15581 b.setXY(i); 15582 var d = b.getLeft(true); 15583 var a = b.getTop(true); 15584 this.deltaSetXY = [d - e.x, a - e.y] 15585 } else { 15586 b.setLeftTop(e.x + this.deltaSetXY[0], e.y 15587 + this.deltaSetXY[1]) 15588 } 15589 this.cachePosition(e.x, e.y); 15590 this.autoScroll(e.x, e.y, c.offsetHeight, c.offsetWidth); 15591 return e 15592 }, 15593 cachePosition : function(b, a) { 15594 if (b) { 15595 this.lastPageX = b; 15596 this.lastPageY = a 15597 } else { 15598 var c = Ext.lib.Dom.getXY(this.getEl()); 15599 this.lastPageX = c[0]; 15600 this.lastPageY = c[1] 15601 } 15602 }, 15603 autoScroll : function(l, k, e, m) { 15604 if (this.scroll) { 15605 var n = Ext.lib.Dom.getViewHeight(); 15606 var b = Ext.lib.Dom.getViewWidth(); 15607 var p = this.DDM.getScrollTop(); 15608 var d = this.DDM.getScrollLeft(); 15609 var j = e + k; 15610 var o = m + l; 15611 var i = (n + p - k - this.deltaY); 15612 var g = (b + d - l - this.deltaX); 15613 var c = 40; 15614 var a = (document.all) ? 80 : 30; 15615 if (j > n && i < c) { 15616 window.scrollTo(d, p + a) 15617 } 15618 if (k < p && p > 0 && k - p < c) { 15619 window.scrollTo(d, p - a) 15620 } 15621 if (o > b && g < c) { 15622 window.scrollTo(d + a, p) 15623 } 15624 if (l < d && d > 0 && l - d < c) { 15625 window.scrollTo(d - a, p) 15626 } 15627 } 15628 }, 15629 getTargetCoord : function(c, b) { 15630 var a = c - this.deltaX; 15631 var d = b - this.deltaY; 15632 if (this.constrainX) { 15633 if (a < this.minX) { 15634 a = this.minX 15635 } 15636 if (a > this.maxX) { 15637 a = this.maxX 15638 } 15639 } 15640 if (this.constrainY) { 15641 if (d < this.minY) { 15642 d = this.minY 15643 } 15644 if (d > this.maxY) { 15645 d = this.maxY 15646 } 15647 } 15648 a = this.getTick(a, this.xTicks); 15649 d = this.getTick(d, this.yTicks); 15650 return { 15651 x : a, 15652 y : d 15653 } 15654 }, 15655 applyConfig : function() { 15656 Ext.dd.DD.superclass.applyConfig.call(this); 15657 this.scroll = (this.config.scroll !== false) 15658 }, 15659 b4MouseDown : function(a) { 15660 this.autoOffset(a.getPageX(), a.getPageY()) 15661 }, 15662 b4Drag : function(a) { 15663 this.setDragElPos(a.getPageX(), a.getPageY()) 15664 }, 15665 toString : function() { 15666 return ("DD " + this.id) 15667 } 15668 }); 15669Ext.dd.DDProxy = function(c, a, b) { 15670 if (c) { 15671 this.init(c, a, b); 15672 this.initFrame() 15673 } 15674}; 15675Ext.dd.DDProxy.dragElId = "ygddfdiv"; 15676Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, { 15677 resizeFrame : true, 15678 centerFrame : false, 15679 createFrame : function() { 15680 var b = this; 15681 var a = document.body; 15682 if (!a || !a.firstChild) { 15683 setTimeout(function() { 15684 b.createFrame() 15685 }, 50); 15686 return 15687 } 15688 var d = this.getDragEl(); 15689 if (!d) { 15690 d = document.createElement("div"); 15691 d.id = this.dragElId; 15692 var c = d.style; 15693 c.position = "absolute"; 15694 c.visibility = "hidden"; 15695 c.cursor = "move"; 15696 c.border = "2px solid #aaa"; 15697 c.zIndex = 999; 15698 a.insertBefore(d, a.firstChild) 15699 } 15700 }, 15701 initFrame : function() { 15702 this.createFrame() 15703 }, 15704 applyConfig : function() { 15705 Ext.dd.DDProxy.superclass.applyConfig.call(this); 15706 this.resizeFrame = (this.config.resizeFrame !== false); 15707 this.centerFrame = (this.config.centerFrame); 15708 this.setDragElId(this.config.dragElId 15709 || Ext.dd.DDProxy.dragElId) 15710 }, 15711 showFrame : function(e, d) { 15712 var c = this.getEl(); 15713 var a = this.getDragEl(); 15714 var b = a.style; 15715 this._resizeProxy(); 15716 if (this.centerFrame) { 15717 this.setDelta(Math.round(parseInt(b.width, 10) / 2), Math 15718 .round(parseInt(b.height, 10) / 2)) 15719 } 15720 this.setDragElPos(e, d); 15721 Ext.fly(a).show() 15722 }, 15723 _resizeProxy : function() { 15724 if (this.resizeFrame) { 15725 var a = this.getEl(); 15726 Ext.fly(this.getDragEl()).setSize(a.offsetWidth, 15727 a.offsetHeight) 15728 } 15729 }, 15730 b4MouseDown : function(b) { 15731 var a = b.getPageX(); 15732 var c = b.getPageY(); 15733 this.autoOffset(a, c); 15734 this.setDragElPos(a, c) 15735 }, 15736 b4StartDrag : function(a, b) {
15737 this.showFrame(a, b) 15738 }, 15739 b4EndDrag : function(a) { 15740 Ext.fly(this.getDragEl()).hide() 15741 }, 15742 endDrag : function(c) { 15743 var b = this.getEl(); 15744 var a = this.getDragEl(); 15745 a.style.visibility = ""; 15746 this.beforeMove(); 15747 b.style.visibility = "hidden"; 15748 Ext.dd.DDM.moveToEl(b, a); 15749 a.style.visibility = "hidden"; 15750 b.style.visibility = ""; 15751 this.afterDrag() 15752 }, 15753 beforeMove : function() { 15754 }, 15755 afterDrag : function() { 15756 }, 15757 toString : function() { 15758 return ("DDProxy " + this.id) 15759 } 15760 }); 15761Ext.dd.DDTarget = function(c, a, b) { 15762 if (c) { 15763 this.initTarget(c, a, b) 15764 } 15765}; 15766Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, { 15767 getDragEl : Ext.emptyFn, 15768 isValidHandleChild : Ext.emptyFn, 15769 startDrag : Ext.emptyFn, 15770 endDrag : Ext.emptyFn, 15771 onDrag : Ext.emptyFn, 15772 onDragDrop : Ext.emptyFn, 15773 onDragEnter : Ext.emptyFn, 15774 onDragOut : Ext.emptyFn, 15775 onDragOver : Ext.emptyFn, 15776 onInvalidDrop : Ext.emptyFn, 15777 onMouseDown : Ext.emptyFn, 15778 onMouseUp : Ext.emptyFn, 15779 setXConstraint : Ext.emptyFn, 15780 setYConstraint : Ext.emptyFn, 15781 resetConstraints : Ext.emptyFn, 15782 clearConstraints : Ext.emptyFn, 15783 clearTicks : Ext.emptyFn, 15784 setInitPosition : Ext.emptyFn, 15785 setDragElId : Ext.emptyFn, 15786 setHandleElId : Ext.emptyFn, 15787 setOuterHandleElId : Ext.emptyFn, 15788 addInvalidHandleClass : Ext.emptyFn, 15789 addInvalidHandleId : Ext.emptyFn, 15790 addInvalidHandleType : Ext.emptyFn, 15791 removeInvalidHandleClass : Ext.emptyFn, 15792 removeInvalidHandleId : Ext.emptyFn, 15793 removeInvalidHandleType : Ext.emptyFn, 15794 toString : function() { 15795 return ("DDTarget " + this.id) 15796 } 15797 }); 15798Ext.dd.DragTracker = Ext.extend(Ext.util.Observable, { 15799 active : false, 15800 tolerance : 5, 15801 autoStart : false, 15802 constructor : function(a) { 15803 Ext.apply(this, a); 15804 this.addEvents("mousedown", "mouseup", "mousemove", 15805 "dragstart", "dragend", "drag"); 15806 this.dragRegion = new Ext.lib.Region(0, 0, 0, 0); 15807 if (this.el) { 15808 this.initEl(this.el) 15809 } 15810 Ext.dd.DragTracker.superclass.constructor.call(this, a) 15811 }, 15812 initEl : function(a) { 15813 this.el = Ext.get(a); 15814 a.on("mousedown", this.onMouseDown, this, this.delegate ? { 15815 delegate : this.delegate 15816 } : undefined) 15817 }, 15818 destroy : function() { 15819 this.el.un("mousedown", this.onMouseDown, this); 15820 delete this.el 15821 }, 15822 onMouseDown : function(b, a) { 15823 if (this.fireEvent("mousedown", this, b) !== false 15824 && this.onBeforeStart(b) !== false) { 15825 this.startXY = this.lastXY = b.getXY(); 15826 this.dragTarget = this.delegate ? a : this.el.dom; 15827 if (this.preventDefault !== false) { 15828 b.preventDefault() 15829 } 15830 Ext.getDoc().on({ 15831 scope : this, 15832 mouseup : this.onMouseUp, 15833 mousemove : this.onMouseMove, 15834 selectstart : this.stopSelect 15835 }); 15836 if (this.autoStart) { 15837 this.timer = this.triggerStart 15838 .defer( this.autoStart === true 15839 ? 1000 15840 : this.autoStart, this, [b]) 15841 } 15842 } 15843 }, 15844 onMouseMove : function(d, c) { 15845 if (this.active && Ext.isIE && !d.browserEvent.button) { 15846 d.preventDefault(); 15847 this.onMouseUp(d); 15848 return 15849 } 15850 d.preventDefault(); 15851 var b = d.getXY(), a = this.startXY; 15852 this.lastXY = b; 15853 if (!this.active) { 15854 if (Math.abs(a[0] - b[0]) > this.tolerance 15855 || Math.abs(a[1] - b[1]) > this.tolerance) { 15856 this.triggerStart(d) 15857 } else { 15858 return 15859 } 15860 } 15861 this.fireEvent("mousemove", this, d); 15862 this.onDrag(d); 15863 this.fireEvent("drag", this, d) 15864 }, 15865 onMouseUp : function(c) { 15866 var b = Ext.getDoc(), a = this.active; 15867 b.un("mousemove", this.onMouseMove, this); 15868 b.un("mouseup", this.onMouseUp, this); 15869 b.un("selectstart", this.stopSelect, this); 15870 c.preventDefault(); 15871 this.clearStart(); 15872 this.active = false; 15873 delete this.elRegion; 15874 this.fireEvent("mouseup", this, c); 15875 if (a) { 15876 this.onEnd(c); 15877 this.fireEvent("dragend", this, c) 15878 } 15879 }, 15880 triggerStart : function(a) { 15881 this.clearStart(); 15882 this.active = true; 15883 this.onStart(a); 15884 this.fireEvent("dragstart", this, a) 15885 }, 15886 clearStart : function() { 15887 if (this.timer) { 15888 clearTimeout(this.timer); 15889 delete this.timer 15890 } 15891 }, 15892 stopSelect : function(a) { 15893 a.stopEvent(); 15894 return false 15895 }, 15896 onBeforeStart : function(a) { 15897 }, 15898 onStart : function(a) { 15899 }, 15900 onDrag : function(a) { 15901 }, 15902 onEnd : function(a) { 15903 }, 15904 getDragTarget : function() { 15905 return this.dragTarget 15906 }, 15907 getDragCt : function() { 15908 return this.el 15909 }, 15910 getXY : function(a) { 15911 return a 15912 ? this.constrainModes[a].call(this, this.lastXY) 15913 : this.lastXY 15914 }, 15915 getOffset : function(c) { 15916 var b = this.getXY(c), a = this.startXY; 15917 return [a[0] - b[0], a[1] - b[1]] 15918 }, 15919 constrainModes : { 15920 point : function(b) { 15921 if (!this.elRegion) { 15922 this.elRegion = this.getDragCt().getRegion() 15923 } 15924 var a = this.dragRegion; 15925 a.left = b[0]; 15926 a.top = b[1]; 15927 a.right = b[0]; 15928 a.bottom = b[1]; 15929 a.constrainTo(this.elRegion); 15930 return [a.left, a.top] 15931 } 15932 } 15933 }); 15934Ext.dd.ScrollManager = function() { 15935 var c = Ext.dd.DragDropMgr; 15936 var e = {}; 15937 var b = null; 15938 var i = {}; 15939 var h = function(l) { 15940 b = null; 15941 a() 15942 }; 15943 var j = function() { 15944 if (c.dragCurrent) { 15945 c.refreshCache(c.dragCurrent.groups) 15946 } 15947 }; 15948 var d = function() { 15949 if (c.dragCurrent) { 15950 var l = Ext.dd.ScrollManager; 15951 var m = i.el.ddScrollConfig 15952 ? i.el.ddScrollConfig.increment 15953 : l.increment; 15954 if (!l.animate) { 15955 if (i.el.scroll(i.dir, m)) { 15956 j() 15957 } 15958 } else { 15959 i.el.scroll(i.dir, m, true, l.animDuration, j) 15960 } 15961 } 15962 }; 15963 var a = function() { 15964 if (i.id) { 15965 clearInterval(i.id) 15966 } 15967 i.id = 0; 15968 i.el = null; 15969 i.dir = "" 15970 }; 15971 var g = function(m, l) { 15972 a(); 15973 i.el = m; 15974 i.dir = l; 15975 var o = m.ddScrollConfig ? m.ddScrollConfig.ddGroup : undefined, n = (m.ddScrollConfig && m.ddScrollConfig.frequency) 15976 ? m.ddScrollConfig.frequency 15977 : Ext.dd.ScrollManager.frequency; 15978 if (o === undefined || c.dragCurrent.ddGroup == o) { 15979 i.id = setInterval(d, n) 15980 } 15981 }; 15982 var k = function(o, q) { 15983 if (q || !c.dragCurrent) { 15984 return 15985 } 15986 var s = Ext.dd.ScrollManager; 15987 if (!b || b != c.dragCurrent) { 15988 b = c.dragCurrent; 15989 s.refreshCache() 15990 } 15991 var t = Ext.lib.Event.getXY(o); 15992 var u = new Ext.lib.Point(t[0], t[1]); 15993 for (var m in e) { 15994 var n = e[m], l = n._region; 15995 var p = n.ddScrollConfig ? n.ddScrollConfig : s; 15996 if (l && l.contains(u) && n.isScrollable()) { 15997 if (l.bottom - u.y <= p.vthresh) { 15998 if (i.el != n) { 15999 g(n, "down") 16000 } 16001 return 16002 } else { 16003 if (l.right - u.x <= p.hthresh) { 16004 if (i.el != n) { 16005 g(n, "left") 16006 } 16007 return 16008 } else { 16009 if (u.y - l.top <= p.vthresh) { 16010 if (i.el != n) { 16011 g(n, "up") 16012 } 16013 return 16014 } else { 16015 if (u.x - l.left <= p.hthresh) { 16016 if (i.el != n) { 16017 g(n, "right") 16018 } 16019 return 16020 } 16021 } 16022 } 16023 } 16024 } 16025 } 16026 a() 16027 }; 16028 c.fireEvents = c.fireEvents.createSequence(k, c); 16029 c.stopDrag = c.stopDrag.createSequence(h, c); 16030 return { 16031 register : function(n) { 16032 if (Ext.isArray(n)) { 16033 for (var m = 0, l = n.length; m < l; m++) { 16034 this.register(n[m]) 16035 } 16036 } else { 16037 n = Ext.get(n); 16038 e[n.id] = n 16039 } 16040 }, 16041 unregister : function(n) { 16042 if (Ext.isArray(n)) { 16043 for (var m = 0, l = n.length; m < l; m++) { 16044 this.unregister(n[m]) 16045 } 16046 } else { 16047 n = Ext.get(n); 16048 delete e[n.id] 16049 } 16050 }, 16051 vthresh : 25, 16052 hthresh : 25, 16053 increment : 100, 16054 frequency : 500, 16055 animate : true, 16056 animDuration : 0.4, 16057 ddGroup : undefined, 16058 refreshCache : function() { 16059 for (var l in e) { 16060 if (typeof e[l] == "object") { 16061 e[l]._region = e[l].getRegion() 16062 } 16063 } 16064 } 16065 } 16066}(); 16067Ext.dd.Registry = function() { 16068 var d = {}; 16069 var b = {}; 16070 var a = 0; 16071 var c = function(g, e) { 16072 if (typeof g == "string") { 16073 return g 16074 }
16075 var h = g.id; 16076 if (!h && e !== false) { 16077 h = "extdd-" + (++a); 16078 g.id = h 16079 } 16080 return h 16081 }; 16082 return { 16083 register : function(j, k) { 16084 k = k || {}; 16085 if (typeof j == "string") { 16086 j = document.getElementById(j) 16087 } 16088 k.ddel = j; 16089 d[c(j)] = k; 16090 if (k.isHandle !== false) { 16091 b[k.ddel.id] = k 16092 } 16093 if (k.handles) { 16094 var h = k.handles; 16095 for (var g = 0, e = h.length; g < e; g++) { 16096 b[c(h[g])] = k 16097 } 16098 } 16099 }, 16100 unregister : function(j) { 16101 var l = c(j, false); 16102 var k = d[l]; 16103 if (k) { 16104 delete d[l]; 16105 if (k.handles) { 16106 var h = k.handles; 16107 for (var g = 0, e = h.length; g < e; g++) { 16108 delete b[c(h[g], false)] 16109 } 16110 } 16111 } 16112 }, 16113 getHandle : function(e) { 16114 if (typeof e != "string") { 16115 e = e.id 16116 } 16117 return b[e] 16118 }, 16119 getHandleFromEvent : function(h) { 16120 var g = Ext.lib.Event.getTarget(h); 16121 return g ? b[g.id] : null 16122 }, 16123 getTarget : function(e) { 16124 if (typeof e != "string") { 16125 e = e.id 16126 } 16127 return d[e] 16128 }, 16129 getTargetFromEvent : function(h) { 16130 var g = Ext.lib.Event.getTarget(h); 16131 return g ? d[g.id] || b[g.id] : null 16132 } 16133 } 16134}(); 16135Ext.dd.StatusProxy = function(a) { 16136 /* add : lilo : 2015.10.29 */ 16137 // ìµì ì ìí´ ìëì¼ë¡ ìì±ëë StatusProxyì dropNotAllowed, dropAllowed ìµì ì ì©í기 ìí´ ì»¤ì¤í°ë§ì´ì§ 16138 /*Ext.apply(this, a);*/ 16139 var config = {}; 16140 if(a && a.dropNotAllowed) { 16141 config.dropNotAllowed = a.dropNotAllowed; 16142 } 16143 if(a && a.dropAllowed) { 16144 config.dropAllowed = a.dropAllowed; 16145 } 16146 Ext.apply(this, config); 16147 // ì¬ê¸°ê¹ì§ 커ì¤í°ë§ì´ì§ 16148 16149 this.id = this.id || Ext.id(); 16150 this.el = new Ext.Layer({ 16151 dh : { 16152 id : this.id, 16153 tag : "div", 16154 cls : "x-dd-drag-proxy " + this.dropNotAllowed, 16155 children : [{ 16156 tag : "div", 16157 cls : "x-dd-drop-icon" 16158 }, { 16159 tag : "div", 16160 cls : "x-dd-drag-ghost" 16161 }] 16162 }, 16163 shadow : !a || a.shadow !== false 16164 }); 16165 this.ghost = Ext.get(this.el.dom.childNodes[1]); 16166 this.dropStatus = this.dropNotAllowed 16167}; 16168Ext.dd.StatusProxy.prototype = { 16169 dropAllowed : "x-dd-drop-ok", 16170 dropNotAllowed : "x-dd-drop-nodrop", 16171 setStatus : function(a) { 16172 a = a || this.dropNotAllowed; 16173 if (this.dropStatus != a) { 16174 this.el.replaceClass(this.dropStatus, a); 16175 this.dropStatus = a 16176 } 16177 }, 16178 reset : function(a) { 16179 this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed; 16180 this.dropStatus = this.dropNotAllowed; 16181 if (a) { 16182 this.ghost.update("") 16183 } 16184 }, 16185 update : function(a) { 16186 if (typeof a == "string") { 16187 this.ghost.update(a) 16188 } else { 16189 this.ghost.update(""); 16190 a.style.margin = "0"; 16191 this.ghost.dom.appendChild(a) 16192 } 16193 var b = this.ghost.dom.firstChild; 16194 if (b) { 16195 Ext.fly(b).setStyle("float", "none") 16196 } 16197 }, 16198 getEl : function() { 16199 return this.el 16200 }, 16201 getGhost : function() { 16202 return this.ghost 16203 }, 16204 hide : function(a) { 16205 this.el.hide(); 16206 if (a) { 16207 this.reset(true) 16208 } 16209 }, 16210 stop : function() { 16211 if (this.anim && this.anim.isAnimated && this.anim.isAnimated()) { 16212 this.anim.stop() 16213 } 16214 }, 16215 show : function() { 16216 this.el.show() 16217 }, 16218 sync : function() { 16219 this.el.sync() 16220 }, 16221 repair : function(b, c, a) { 16222 this.callback = c; 16223 this.scope = a; 16224 if (b && this.animRepair !== false) { 16225 this.el.addClass("x-dd-drag-repair"); 16226 this.el.hideUnders(true); 16227 this.anim = this.el.shift({ 16228 duration : this.repairDuration || 0.5, 16229 easing : "easeOut", 16230 xy : b, 16231 stopFx : true, 16232 callback : this.afterRepair, 16233 scope : this 16234 }) 16235 } else { 16236 this.afterRepair() 16237 } 16238 }, 16239 afterRepair : function() { 16240 this.hide(true); 16241 if (typeof this.callback == "function") { 16242 this.callback.call(this.scope || this) 16243 } 16244 this.callback = null; 16245 this.scope = null 16246 }, 16247 destroy : function() { 16248 Ext.destroy(this.ghost, this.el) 16249 } 16250}; 16251Ext.dd.DragSource = function(b, a) { 16252 this.el = Ext.get(b); 16253 if (!this.dragData) { 16254 this.dragData = {} 16255 } 16256 Ext.apply(this, a); 16257 if (!this.proxy) { 16258 /* add : lilo : 2015.10.29 */ 16259 // ìµì ì ìí´ ìëì¼ë¡ ìì±ëë StatusProxyì dropNotAllowed, dropAllowed ìµì ì ì©í기 ìí´ ì»¤ì¤í°ë§ì´ì§ 16260 /*this.proxy = new Ext.dd.StatusProxy()*/ 16261 this.proxy = new Ext.dd.StatusProxy(a) 16262 } 16263 Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, 16264 this.ddGroup || this.group, { 16265 dragElId : this.proxy.id, 16266 resizeFrame : false, 16267 isTarget : false, 16268 scroll : this.scroll === true 16269 }); 16270 this.dragging = false 16271}; 16272Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, { 16273 dropAllowed : "x-dd-drop-ok", 16274 dropNotAllowed : "x-dd-drop-nodrop", 16275 getDragData : function(a) { 16276 return this.dragData 16277 }, 16278 onDragEnter : function(c, d) { 16279 var b = Ext.dd.DragDropMgr.getDDById(d); 16280 this.cachedTarget = b; 16281 if (this.beforeDragEnter(b, c, d) !== false) { 16282 if (b.isNotifyTarget) { 16283 var a = b.notifyEnter(this, c, this.dragData); 16284 this.proxy.setStatus(a) 16285 } else { 16286 this.proxy.setStatus(this.dropAllowed) 16287 } 16288 if (this.afterDragEnter) { 16289 this.afterDragEnter(b, c, d) 16290 } 16291 } 16292 }, 16293 beforeDragEnter : function(b, a, c) { 16294 return true 16295 }, 16296 alignElWithMouse : function() { 16297 Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, 16298 arguments); 16299 this.proxy.sync() 16300 }, 16301 onDragOver : function(c, d) { 16302 var b = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(d); 16303 if (this.beforeDragOver(b, c, d) !== false) { 16304 if (b.isNotifyTarget) { 16305 var a = b.notifyOver(this, c, this.dragData); 16306 this.proxy.setStatus(a) 16307 } 16308 if (this.afterDragOver) { 16309 this.afterDragOver(b, c, d) 16310 } 16311 } 16312 }, 16313 beforeDragOver : function(b, a, c) { 16314 return true 16315 }, 16316 onDragOut : function(b, c) { 16317 var a = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(c); 16318 if (this.beforeDragOut(a, b, c) !== false) { 16319 if (a.isNotifyTarget) { 16320 a.notifyOut(this, b, this.dragData) 16321 } 16322 this.proxy.reset(); 16323 if (this.afterDragOut) { 16324 this.afterDragOut(a, b, c) 16325 } 16326 } 16327 this.cachedTarget = null 16328 }, 16329 beforeDragOut : function(b, a, c) { 16330 return true 16331 }, 16332 onDragDrop : function(b, c) { 16333 var a = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(c); 16334 if (this.beforeDragDrop(a, b, c) !== false) { 16335 if (a.isNotifyTarget) { 16336 if (a.notifyDrop(this, b, this.dragData)) { 16337 this.onValidDrop(a, b, c) 16338 } else { 16339 this.onInvalidDrop(a, b, c) 16340 } 16341 } else { 16342 this.onValidDrop(a, b, c) 16343 } 16344 if (this.afterDragDrop) { 16345 this.afterDragDrop(a, b, c) 16346 } 16347 } 16348 delete this.cachedTarget 16349 }, 16350 beforeDragDrop : function(b, a, c) { 16351 return true 16352 }, 16353 onValidDrop : function(b, a, c) { 16354 this.hideProxy(); 16355 if (this.afterValidDrop) { 16356 this.afterValidDrop(b, a, c) 16357 } 16358 }, 16359 getRepairXY : function(b, a) { 16360 return this.el.getXY() 16361 }, 16362 onInvalidDrop : function(b, a, c) { 16363 this.beforeInvalidDrop(b, a, c); 16364 if (this.cachedTarget) { 16365 if (this.cachedTarget.isNotifyTarget) { 16366 this.cachedTarget.notifyOut(this, a, this.dragData) 16367 } 16368 this.cacheTarget = null 16369 } 16370 this.proxy.repair(this.getRepairXY(a, this.dragData), 16371 this.afterRepair, this); 16372 if (this.afterInvalidDrop) { 16373 this.afterInvalidDrop(a, c) 16374 } 16375 }, 16376 afterRepair : function() { 16377 if (Ext.enableFx) { 16378 this.el.highlight(this.hlColor || "c3daf9") 16379 } 16380 this.dragging = false 16381 }, 16382 beforeInvalidDrop : function(b, a, c) { 16383 return true 16384 }, 16385 handleMouseDown : function(b) { 16386 if (this.dragging) { 16387 return 16388 } 16389 var a = this.getDragData(b); 16390 if (a && this.onBeforeDrag(a, b) !== false) { 16391 this.dragData = a; 16392 this.proxy.stop(); 16393 Ext.dd.DragSource.superclass.handleMouseDown.apply(this, 16394 arguments) 16395 } 16396 }, 16397 onBeforeDrag : function(a, b) { 16398 return true 16399 }, 16400 onStartDrag : Ext.emptyFn, 16401 startDrag : function(a, b) { 16402 this.proxy.reset(); 16403 this.dragging = true; 16404 this.proxy.update(""); 16405 this.onInitDrag(a, b); 16406 this.proxy.show() 16407 }, 16408 onInitDrag : function(a, c) { 16409 var b = this.el.dom.cloneNode(true); 16410 b.id = Ext.id(); 16411 this.proxy.update(b); 16412 this.onStartDrag(a, c); 16413 return true 16414 }, 16415 getProxy : function() { 16416 return this.proxy 16417 }, 16418 hideProxy : function() { 16419 this.proxy.hide(); 16420 this.proxy.reset(true); 16421 this.dragging = false 16422 }, 16423 triggerCacheRefresh : function() { 16424 Ext.dd.DDM.refreshCache(this.groups) 16425 }, 16426 b4EndDrag : function(a) { 16427 }, 16428 endDrag : function(a) { 16429 this.onEndDrag(this.dragData, a) 16430 }, 16431 onEndDrag : function(a, b) { 16432 }, 16433 autoOffset : function(a, b) { 16434 this.setDelta(-12, -20) 16435 }, 16436 destroy : function() { 16437 Ext.dd.DragSource.superclass.destroy.call(this); 16438 Ext.destroy(this.proxy) 16439 } 16440 }); 16441Ext.dd.DropTarget = Ext.extend(Ext.dd.DDTarget, { 16442 constructor : function(b, a) { 16443 this.el = Ext.get(b); 16444 Ext.apply(this, a); 16445 if (this.containerScroll) { 16446 Ext.dd.ScrollManager.register(this.el) 16447 } 16448 Ext.dd.DropTarget.superclass.constructor.call(this, 16449 this.el.dom, this.ddGroup || this.group, { 16450 isTarget : true 16451 }) 16452 }, 16453 dropAllowed : "x-dd-drop-ok", 16454 dropNotAllowed : "x-dd-drop-nodrop", 16455 isTarget : true, 16456 isNotifyTarget : true, 16457 notifyEnter : function(a, c, b) { 16458 if (this.overClass) { 16459 this.el.addClass(this.overClass) 16460 } 16461 return this.dropAllowed 16462 }, 16463 notifyOver : function(a, c, b) { 16464 return this.dropAllowed 16465 }, 16466 notifyOut : function(a, c, b) { 16467 if (this.overClass) { 16468 this.el.removeClass(this.overClass) 16469 } 16470 }, 16471 notifyDrop : function(a, c, b) { 16472 return false 16473 }, 16474 destroy : function() { 16475 Ext.dd.DropTarget.superclass.destroy.call(this); 16476 if (this.containerScroll) { 16477 Ext.dd.ScrollManager.unregister(this.el) 16478 } 16479 } 16480 }); 16481Ext.dd.DragZone = Ext.extend(Ext.dd.DragSource, { 16482 constructor : function(b, a) { 16483 Ext.dd.DragZone.superclass.constructor.call(this, b, a); 16484 if (this.containerScroll) { 16485 Ext.dd.ScrollManager.register(this.el) 16486 } 16487 }, 16488 getDragData : function(a) { 16489 return Ext.dd.Registry.getHandleFromEvent(a) 16490 }, 16491 onInitDrag : function(a, b) { 16492 this.proxy.update(this.dragData.ddel.cloneNode(true)); 16493 this.onStartDrag(a, b); 16494 return true 16495 }, 16496 afterRepair : function() { 16497 if (Ext.enableFx) { 16498 Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor 16499 || "c3daf9") 16500 } 16501 this.dragging = false 16502 }, 16503 getRepairXY : function(a) { 16504 return Ext.Element.fly(this.dragData.ddel).getXY() 16505 }, 16506 destroy : function() { 16507 Ext.dd.DragZone.superclass.destroy.call(this); 16508 if (this.containerScroll) { 16509 Ext.dd.ScrollManager.unregister(this.el) 16510 } 16511 } 16512 }); 16513Ext.dd.DropZone = function(b, a) { 16514 Ext.dd.DropZone.superclass.constructor.call(this, b, a) 16515}; 16516Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, { 16517 getTargetFromEvent : function(a) { 16518 return Ext.dd.Registry.getTargetFromEvent(a) 16519 }, 16520 onNodeEnter : function(d, a, c, b) { 16521 }, 16522 onNodeOver : function(d, a, c, b) { 16523 return this.dropAllowed 16524 }, 16525 onNodeOut : function(d, a, c, b) { 16526 }, 16527 onNodeDrop : function(d, a, c, b) { 16528 return false 16529 }, 16530 onContainerOver : function(a, c, b) { 16531 return this.dropNotAllowed 16532 }, 16533 onContainerDrop : function(a, c, b) { 16534 return false 16535 }, 16536 notifyEnter : function(a, c, b) { 16537 return this.dropNotAllowed 16538 }, 16539 notifyOver : function(a, c, b) { 16540 var d = this.getTargetFromEvent(c); 16541 if (!d) { 16542 if (this.lastOverNode) { 16543 this.onNodeOut(this.lastOverNode, a, c, b); 16544 this.lastOverNode = null 16545 } 16546 return this.onContainerOver(a, c, b) 16547 } 16548 if (this.lastOverNode != d) { 16549 if (this.lastOverNode) { 16550 this.onNodeOut(this.lastOverNode, a, c, b) 16551 } 16552 this.onNodeEnter(d, a, c, b); 16553 this.lastOverNode = d 16554 } 16555 return this.onNodeOver(d, a, c, b) 16556 }, 16557 notifyOut : function(a, c, b) { 16558 if (this.lastOverNode) { 16559 this.onNodeOut(this.lastOverNode, a, c, b); 16560 this.lastOverNode = null 16561 } 16562 }, 16563 notifyDrop : function(a, c, b) { 16564 if (this.lastOverNode) { 16565 this.onNodeOut(this.lastOverNode, a, c, b); 16566 this.lastOverNode = null 16567 } 16568 var d = this.getTargetFromEvent(c); 16569 return d ? this.onNodeDrop(d, a, c, b) : this.onContainerDrop( 16570 a, c, b) 16571 }, 16572 triggerCacheRefresh : function() { 16573 Ext.dd.DDM.refreshCache(this.groups) 16574 } 16575 }); 16576Ext.Element.addMethods({ 16577 initDD : function(c, b, d) { 16578 var a = new Ext.dd.DD(Ext.id(this.dom), c, b); 16579 return Ext.apply(a, d) 16580 }, 16581 initDDProxy : function(c, b, d) { 16582 var a = new Ext.dd.DDProxy(Ext.id(this.dom), c, b); 16583 return Ext.apply(a, d) 16584 }, 16585 initDDTarget : function(c, b, d) { 16586 var a = new Ext.dd.DDTarget(Ext.id(this.dom), c, b); 16587 return Ext.apply(a, d) 16588 } 16589 }); 16590Ext.data.Api = (function() { 16591 var a = {}; 16592 return { 16593 actions : { 16594 create : "create", 16595 read : "read", 16596 update : "update", 16597 destroy : "destroy" 16598 }, 16599 restActions : { 16600 create : "POST", 16601 read : "GET", 16602 update : "PUT", 16603 destroy : "DELETE" 16604 }, 16605 isAction : function(b) { 16606 return (Ext.data.Api.actions[b]) ? true : false 16607 }, 16608 getVerb : function(b) { 16609 if (a[b]) { 16610 return a[b] 16611 } 16612 for (var c in this.actions) { 16613 if (this.actions[c] === b) { 16614 a[b] = c; 16615 break 16616 } 16617 } 16618 return (a[b] !== undefined) ? a[b] : null 16619 }, 16620 isValid : function(b) { 16621 var e = []; 16622 var d = this.actions; 16623 for (var c in b) { 16624 if (!(c in d)) { 16625 e.push(c) 16626 } 16627 } 16628 return (!e.length) ? true : e 16629 }, 16630 hasUniqueUrl : function(c, g) { 16631 var b = (c.api[g]) ? c.api[g].url : null; 16632 var e = true; 16633 for (var d in c.api) { 16634 if ((e = (d === g) ? true : (c.api[d].url != b) ? true : false) === false) { 16635 break 16636 } 16637 } 16638 return e 16639 }, 16640 prepare : function(b) { 16641 if (!b.api) { 16642 b.api = {} 16643 } 16644 for (var d in this.actions) { 16645 var c = this.actions[d]; 16646 b.api[c] = b.api[c] || b.url || b.directFn; 16647 if (typeof(b.api[c]) == "string") { 16648 b.api[c] = { 16649 url : b.api[c], 16650 method : (b.restful === true) 16651 ? Ext.data.Api.restActions[c] 16652 : undefined 16653 } 16654 } 16655 } 16656 }, 16657 restify : function(b) { 16658 b.restful = true; 16659 for (var c in this.restActions) { 16660 b.api[this.actions[c]].method 16661 || (b.api[this.actions[c]].method = this.restActions[c]) 16662 } 16663 b.onWrite = b.onWrite.createInterceptor(function(i, j, g, e) { 16664 var d = j.reader; 16665 var h = new Ext.data.Response({ 16666 action : i, 16667 raw : g 16668 });
16669 switch (g.status) { 16670 case 200 : 16671 return true; 16672 break; 16673 case 201 : 16674 if (Ext.isEmpty(h.raw.responseText)) { 16675 h.success = true 16676 } else { 16677 return true 16678 } 16679 break; 16680 case 204 : 16681 h.success = true; 16682 h.data = null; 16683 break; 16684 default : 16685 return true; 16686 break 16687 } 16688 if (h.success === true) { 16689 this.fireEvent("write", this, i, h.data, h, e, 16690 j.request.arg) 16691 } else { 16692 this.fireEvent("exception", this, "remote", i, j, 16693 h, e) 16694 } 16695 j.request.callback.call(j.request.scope, h.data, h, 16696 h.success); 16697 return false 16698 }, b) 16699 } 16700 } 16701})(); 16702Ext.data.Response = function(b, a) { 16703 Ext.apply(this, b, { 16704 raw : a 16705 }) 16706}; 16707Ext.data.Response.prototype = { 16708 message : null, 16709 success : false, 16710 status : null, 16711 root : null, 16712 raw : null, 16713 getMessage : function() { 16714 return this.message 16715 }, 16716 getSuccess : function() { 16717 return this.success 16718 }, 16719 getStatus : function() { 16720 return this.status 16721 }, 16722 getRoot : function() { 16723 return this.root 16724 }, 16725 getRawResponse : function() { 16726 return this.raw 16727 } 16728}; 16729Ext.data.Api.Error = Ext.extend(Ext.Error, { 16730 constructor : function(b, a) { 16731 this.arg = a; 16732 Ext.Error.call(this, b) 16733 }, 16734 name : "Ext.data.Api" 16735 }); 16736Ext.apply(Ext.data.Api.Error.prototype, { 16737 lang : { 16738 "action-url-undefined" : "No fallback url defined for this action. When defining a DataProxy api, please be sure to define an url for each CRUD action in Ext.data.Api.actions or define a default url in addition to your api-configuration.", 16739 invalid : "received an invalid API-configuration. Please ensure your proxy API-configuration contains only the actions defined in Ext.data.Api.actions", 16740 "invalid-url" : "Invalid url. Please review your proxy configuration.", 16741 execute : 'Attempted to execute an unknown action. Valid API actions are defined in Ext.data.Api.actions"' 16742 } 16743}); 16744Ext.data.SortTypes = { 16745 none : function(a) { 16746 return a 16747 }, 16748 stripTagsRE : /<\/?[^>]+>/gi, 16749 asText : function(a) { 16750 return String(a).replace(this.stripTagsRE, "") 16751 }, 16752 asUCText : function(a) { 16753 return String(a).toUpperCase().replace(this.stripTagsRE, "") 16754 }, 16755 asUCString : function(a) { 16756 return String(a).toUpperCase() 16757 }, 16758 asDate : function(a) { 16759 if (!a) { 16760 return 0 16761 } 16762 if (Ext.isDate(a)) { 16763 return a.getTime() 16764 } 16765 return Date.parse(String(a)) 16766 }, 16767 asFloat : function(a) { 16768 var b = parseFloat(String(a).replace(/,/g, "")); 16769 return isNaN(b) ? 0 : b 16770 }, 16771 asInt : function(a) { 16772 var b = parseInt(String(a).replace(/,/g, ""), 10); 16773 return isNaN(b) ? 0 : b 16774 } 16775}; 16776Ext.data.Record = function(a, b) { 16777 this.id = (b || b === 0) ? b : Ext.data.Record.id(this); 16778 this.data = a || {} 16779}; 16780Ext.data.Record.create = function(e) { 16781 var c = Ext.extend(Ext.data.Record, {}); 16782 var d = c.prototype; 16783 d.fields = new Ext.util.MixedCollection(false, function(g) { 16784 return g.name 16785 }); 16786 for (var b = 0, a = e.length; b < a; b++) { 16787 d.fields.add(new Ext.data.Field(e[b])) 16788 } 16789 c.getField = function(g) { 16790 return d.fields.get(g) 16791 }; 16792 return c 16793}; 16794Ext.data.Record.PREFIX = "ext-record"; 16795Ext.data.Record.AUTO_ID = 1; 16796Ext.data.Record.EDIT = "edit"; 16797Ext.data.Record.REJECT = "reject"; 16798Ext.data.Record.COMMIT = "commit"; 16799Ext.data.Record.id = function(a) { 16800 a.phantom = true; 16801 return [Ext.data.Record.PREFIX, "-", Ext.data.Record.AUTO_ID++].join("") 16802}; 16803Ext.data.Record.prototype = { 16804 dirty : false, 16805 editing : false, 16806 error : null, 16807 modified : null, 16808 phantom : false, 16809 join : function(a) { 16810 this.store = a 16811 }, 16812 set : function(a, c) { 16813 var b = Ext.isPrimitive(c) ? String : Ext.encode; 16814 if (b(this.data[a]) == b(c)) { 16815 return 16816 } 16817 this.dirty = true; 16818 if (!this.modified) { 16819 this.modified = {} 16820 } 16821 if (this.modified[a] === undefined) { 16822 this.modified[a] = this.data[a] 16823 } 16824 this.data[a] = c; 16825 if (!this.editing) { 16826 this.afterEdit() 16827 } 16828 }, 16829 afterEdit : function() { 16830 if (this.store != undefined 16831 && typeof this.store.afterEdit == "function") { 16832 this.store.afterEdit(this) 16833 } 16834 },
16835 afterReject : function() { 16836 if (this.store) { 16837 this.store.afterReject(this) 16838 } 16839 }, 16840 afterCommit : function() { 16841 if (this.store) { 16842 this.store.afterCommit(this) 16843 } 16844 }, 16845 get : function(a) { 16846 return this.data[a] 16847 }, 16848 beginEdit : function() { 16849 this.editing = true; 16850 this.modified = this.modified || {} 16851 }, 16852 cancelEdit : function() { 16853 this.editing = false; 16854 delete this.modified 16855 }, 16856 endEdit : function() { 16857 this.editing = false; 16858 if (this.dirty) { 16859 this.afterEdit() 16860 } 16861 }, 16862 reject : function(b) { 16863 var a = this.modified; 16864 for (var c in a) { 16865 if (typeof a[c] != "function") { 16866 this.data[c] = a[c] 16867 } 16868 } 16869 this.dirty = false; 16870 delete this.modified; 16871 this.editing = false; 16872 if (b !== true) { 16873 this.afterReject() 16874 } 16875 }, 16876 commit : function(a) { 16877 this.dirty = false; 16878 delete this.modified; 16879 this.editing = false; 16880 if (a !== true) { 16881 this.afterCommit() 16882 } 16883 }, 16884 getChanges : function() { 16885 var a = this.modified, b = {}; 16886 for (var c in a) { 16887 if (a.hasOwnProperty(c)) { 16888 b[c] = this.data[c] 16889 } 16890 } 16891 return b 16892 }, 16893 hasError : function() { 16894 return this.error !== null 16895 }, 16896 clearError : function() { 16897 this.error = null 16898 }, 16899 copy : function(a) { 16900 return new this.constructor(Ext.apply({}, this.data), a || this.id) 16901 }, 16902 isModified : function(a) { 16903 return !!(this.modified && this.modified.hasOwnProperty(a)) 16904 }, 16905 isValid : function() { 16906 return this.fields.find(function(a) { 16907 return (a.allowBlank === false && Ext 16908 .isEmpty(this.data[a.name])) ? true : false 16909 }, this) ? false : true 16910 }, 16911 markDirty : function() { 16912 this.dirty = true; 16913 if (!this.modified) { 16914 this.modified = {} 16915 } 16916 this.fields.each(function(a) { 16917 this.modified[a.name] = this.data[a.name] 16918 }, this) 16919 } 16920}; 16921Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), { 16922 register : function() { 16923 for (var a = 0, b; (b = arguments[a]); a++) { 16924 this.add(b) 16925 } 16926 }, 16927 unregister : function() { 16928 for (var a = 0, b; (b = arguments[a]); a++) { 16929 this.remove(this.lookup(b)) 16930 } 16931 }, 16932 lookup : function(e) { 16933 if (Ext.isArray(e)) { 16934 var b = ["field1"], d = !Ext.isArray(e[0]); 16935 if (!d) { 16936 for (var c = 2, a = e[0].length; c <= a; ++c) { 16937 b.push("field" + c) 16938 } 16939 } 16940 return new Ext.data.ArrayStore({ 16941 fields : b, 16942 data : e, 16943 expandData : d, 16944 autoDestroy : true, 16945 autoCreated : true 16946 }) 16947 } 16948 return Ext.isObject(e) 16949 ? (e.events ? e : Ext.create(e, "store")) 16950 : this.get(e) 16951 }, 16952 getKey : function(a) { 16953 return a.storeId 16954 } 16955 }); 16956Ext.data.Store = Ext.extend(Ext.util.Observable, { 16957 writer : undefined, 16958 remoteSort : false, 16959 autoDestroy : false, 16960 pruneModifiedRecords : false, 16961 lastOptions : null, 16962 autoSave : true, 16963 batch : true, 16964 restful : false, 16965 paramNames : undefined, 16966 defaultParamNames : { 16967 start : "start", 16968 limit : "limit", 16969 sort : "sort", 16970 dir : "dir" 16971 }, 16972 isDestroyed : false, 16973 hasMultiSort : false, 16974 batchKey : "_ext_batch_", 16975 constructor : function(a) { 16976 this.data = new Ext.util.MixedCollection(false); 16977 this.data.getKey = function(b) { 16978 return b.id 16979 }; 16980 this.removed = []; 16981 if (a && a.data) { 16982 this.inlineData = a.data; 16983 delete a.data 16984 } 16985 Ext.apply(this, a); 16986 this.baseParams = Ext.isObject(this.baseParams) ? this.baseParams : {}; 16987 this.paramNames = Ext.applyIf(this.paramNames || {}, 16988 this.defaultParamNames); 16989 if ((this.url || this.api) && !this.proxy) { 16990 this.proxy = new Ext.data.HttpProxy({ 16991 url : this.url, 16992 api : this.api 16993 }) 16994 } 16995 if (this.restful === true && this.proxy) { 16996 this.batch = false; 16997 Ext.data.Api.restify(this.proxy) 16998 } 16999 if (this.reader) { 17000 if (!this.recordType) { 17001 this.recordType = this.reader.recordType 17002 } 17003 if (this.reader.onMetaChange) { 17004 this.reader.onMetaChange = this.reader.onMetaChange 17005 .createSequence(this.onMetaChange, this) 17006 } 17007 if (this.writer) { 17008 if (this.writer instanceof (Ext.data.DataWriter) === false) { 17009 this.writer = this.buildWriter(this.writer) 17010 } 17011 this.writer.meta = this.reader.meta; 17012 this.pruneModifiedRecords = true 17013 } 17014 } 17015 if (this.recordType) { 17016 this.fields = this.recordType.prototype.fields 17017 } 17018 this.modified = []; 17019 this.addEvents("datachanged", "metachange", "add", "remove", "update", 17020 "clear", "exception", "beforeload", "load", "loadexception", 17021 "beforewrite", "write", "beforesave", "save"); 17022 if (this.proxy) { 17023 this.relayEvents(this.proxy, ["loadexception", "exception"]) 17024 } 17025 if (this.writer) { 17026 this.on({ 17027 scope : this, 17028 add : this.createRecords, 17029 remove : this.destroyRecord, 17030 update : this.updateRecord, 17031 clear : this.onClear 17032 }) 17033 } 17034 this.sortToggle = {}; 17035 if (this.sortField) { 17036 this.setDefaultSort(this.sortField, this.sortDir) 17037 } else { 17038 if (this.sortInfo) { 17039 this.setDefaultSort(this.sortInfo.field, 17040 this.sortInfo.direction) 17041 } 17042 } 17043 Ext.data.Store.superclass.constructor.call(this);
17044 if (this.id) { 17045 this.storeId = this.id; 17046 delete this.id 17047 } 17048 if (this.storeId) { 17049 Ext.StoreMgr.register(this) 17050 } 17051 if (this.inlineData) { 17052 this.loadData(this.inlineData); 17053 delete this.inlineData 17054 } else { 17055 if (this.autoLoad) { 17056 this.load.defer(10, this, [typeof this.autoLoad == "object" 17057 ? this.autoLoad 17058 : undefined]) 17059 } 17060 } 17061 this.batchCounter = 0; 17062 this.batches = {} 17063 }, 17064 buildWriter : function(b) { 17065 var a = undefined, c = (b.format || "json").toLowerCase(); 17066 switch (c) { 17067 case "json" : 17068 a = Ext.data.JsonWriter; 17069 break; 17070 case "xml" : 17071 a = Ext.data.XmlWriter; 17072 break; 17073 default : 17074 a = Ext.data.JsonWriter 17075 } 17076 return new a(b) 17077 }, 17078 destroy : function() { 17079 if (!this.isDestroyed) { 17080 if (this.storeId) { 17081 Ext.StoreMgr.unregister(this) 17082 } 17083 this.clearData(); 17084 this.data = null; 17085 Ext.destroy(this.proxy); 17086 this.reader = this.writer = null; 17087 this.purgeListeners(); 17088 this.isDestroyed = true 17089 } 17090 }, 17091 add : function(c) { 17092 var e, a, b, d; 17093 c = [].concat(c); 17094 if (c.length < 1) { 17095 return 17096 } 17097 for (e = 0, a = c.length; e < a; e++) { 17098 b = c[e]; 17099 b.join(this); 17100 if (b.dirty || b.phantom) { 17101 this.modified.push(b) 17102 } 17103 } 17104 d = this.data.length; 17105 this.data.addAll(c); 17106 if (this.snapshot) { 17107 this.snapshot.addAll(c) 17108 } 17109 this.fireEvent("add", this, c, d) 17110 }, 17111 addSorted : function(a) { 17112 var b = this.findInsertIndex(a); 17113 this.insert(b, a) 17114 }, 17115 doUpdate : function(a) { 17116 var b = a.id; 17117 this.getById(b).join(null); 17118 this.data.replace(b, a); 17119 if (this.snapshot) { 17120 this.snapshot.replace(b, a) 17121 } 17122 a.join(this); 17123 this.fireEvent("update", this, a, Ext.data.Record.COMMIT) 17124 }, 17125 remove : function(a) { 17126 if (Ext.isArray(a)) { 17127 Ext.each(a, function(c) { 17128 this.remove(c) 17129 }, this); 17130 return 17131 } 17132 var b = this.data.indexOf(a); 17133 if (b > -1) { 17134 a.join(null); 17135 this.data.removeAt(b) 17136 } 17137 if (this.pruneModifiedRecords) { 17138 this.modified.remove(a) 17139 } 17140 if (this.snapshot) { 17141 this.snapshot.remove(a) 17142 } 17143 if (b > -1) { 17144 this.fireEvent("remove", this, a, b) 17145 } 17146 }, 17147 removeAt : function(a) { 17148 this.remove(this.getAt(a)) 17149 }, 17150 removeAll : function(b) { 17151 var a = []; 17152 this.each(function(c) { 17153 a.push(c) 17154 }); 17155 this.clearData(); 17156 if (this.snapshot) { 17157 this.snapshot.clear() 17158 } 17159 if (this.pruneModifiedRecords) { 17160 this.modified = [] 17161 } 17162 if (b !== true) { 17163 this.fireEvent("clear", this, a) 17164 } 17165 }, 17166 onClear : function(b, a) { 17167 Ext.each(a, function(d, c) { 17168 this.destroyRecord(this, d, c) 17169 }, this) 17170 }, 17171 insert : function(d, c) { 17172 var e, a, b; 17173 c = [].concat(c); 17174 for (e = 0, a = c.length; e < a; e++) { 17175 b = c[e]; 17176 this.data.insert(d + e, b); 17177 b.join(this); 17178 if (b.dirty || b.phantom) { 17179 this.modified.push(b) 17180 } 17181 } 17182 if (this.snapshot) { 17183 this.snapshot.addAll(c) 17184 } 17185 this.fireEvent("add", this, c, d) 17186 }, 17187 indexOf : function(a) { 17188 return this.data.indexOf(a) 17189 }, 17190 indexOfId : function(a) { 17191 return this.data.indexOfKey(a) 17192 }, 17193 getById : function(a) { 17194 return (this.snapshot || this.data).key(a) 17195 }, 17196 getAt : function(a) { 17197 return this.data.itemAt(a) 17198 }, 17199 getRange : function(b, a) { 17200 return this.data.getRange(b, a) 17201 }, 17202 storeOptions : function(a) { 17203 a = Ext.apply({}, a); 17204 delete a.callback; 17205 delete a.scope; 17206 this.lastOptions = a 17207 }, 17208 clearData : function() { 17209 this.data.each(function(a) { 17210 a.join(null) 17211 }); 17212 this.data.clear() 17213 }, 17214 load : function(b) { 17215 b = Ext.apply({}, b); 17216 this.storeOptions(b); 17217 if (this.sortInfo && this.remoteSort) { 17218 var a = this.paramNames; 17219 b.params = Ext.apply({}, b.params); 17220 b.params[a.sort] = this.sortInfo.field; 17221 b.params[a.dir] = this.sortInfo.direction 17222 } 17223 try { 17224 return this.execute("read", null, b) 17225 } catch (c) { 17226 this.handleException(c); 17227 return false 17228 } 17229 }, 17230 updateRecord : function(b, a, c) { 17231 if (c == Ext.data.Record.EDIT && this.autoSave === true 17232 && (!a.phantom || (a.phantom && a.isValid()))) { 17233 this.save() 17234 } 17235 }, 17236 createRecords : function(c, b, e) { 17237 var d = this.modified, h = b.length, a, g; 17238 for (g = 0; g < h; g++) { 17239 a = b[g]; 17240 if (a.phantom && a.isValid()) { 17241 a.markDirty(); 17242 if (d.indexOf(a) == -1) { 17243 d.push(a) 17244 } 17245 } 17246 } 17247 if (this.autoSave === true) { 17248 this.save() 17249 } 17250 }, 17251 destroyRecord : function(b, a, c) { 17252 if (this.modified.indexOf(a) != -1) { 17253 this.modified.remove(a) 17254 } 17255 if (!a.phantom) { 17256 this.removed.push(a); 17257 a.lastIndex = c; 17258 if (this.autoSave === true) { 17259 this.save() 17260 } 17261 } 17262 }, 17263 execute : function(e, a, c, b) { 17264 if (!Ext.data.Api.isAction(e)) { 17265 throw new Ext.data.Api.Error("execute", e) 17266 } 17267 c = Ext.applyIf(c || {}, { 17268 params : {} 17269 }); 17270 if (b !== undefined) { 17271 this.addToBatch(b) 17272 } 17273 var d = true; 17274 if (e === "read") { 17275 d = this.fireEvent("beforeload", this, c); 17276 Ext.applyIf(c.params, this.baseParams) 17277 } else { 17278 if (this.writer.listful === true && this.restful !== true) { 17279 a = (Ext.isArray(a)) ? a : [a] 17280 } else { 17281 if (Ext.isArray(a) && a.length == 1) { 17282 a = a.shift() 17283 } 17284 } 17285 if ((d = this.fireEvent("beforewrite", this, e, a, c)) !== false) { 17286 this.writer.apply(c.params, this.baseParams, e, a) 17287 } 17288 } 17289 if (d !== false) { 17290 if (this.writer && this.proxy.url && !this.proxy.restful 17291 && !Ext.data.Api.hasUniqueUrl(this.proxy, e)) { 17292 c.params.xaction = e 17293 } 17294 this.proxy.request(Ext.data.Api.actions[e], a, c.params, 17295 this.reader, this.createCallback(e, a, b), this, c) 17296 } 17297 return d 17298 }, 17299 save : function() { 17300 if (!this.writer) {
17301 throw new Ext.data.Store.Error("writer-undefined") 17302 } 17303 var h = [], j, k, e, c = {}, d; 17304 if (this.removed.length) { 17305 h.push(["destroy", this.removed]) 17306 } 17307 var b = [].concat(this.getModifiedRecords()); 17308 if (b.length) { 17309 var g = []; 17310 for (d = b.length - 1; d >= 0; d--) { 17311 if (b[d].phantom === true) { 17312 var a = b.splice(d, 1).shift(); 17313 if (a.isValid()) { 17314 g.push(a) 17315 } 17316 } else { 17317 if (!b[d].isValid()) { 17318 b.splice(d, 1) 17319 } 17320 } 17321 } 17322 if (g.length) { 17323 h.push(["create", g]) 17324 } 17325 if (b.length) { 17326 h.push(["update", b]) 17327 } 17328 } 17329 j = h.length; 17330 if (j) { 17331 e = ++this.batchCounter; 17332 for (d = 0; d < j; ++d) { 17333 k = h[d]; 17334 c[k[0]] = k[1] 17335 } 17336 if (this.fireEvent("beforesave", this, c) !== false) { 17337 for (d = 0; d < j; ++d) { 17338 k = h[d]; 17339 this.doTransaction(k[0], k[1], e) 17340 } 17341 return e 17342 } 17343 } 17344 return -1 17345 }, 17346 doTransaction : function(e, b, c) { 17347 function g(h) { 17348 try { 17349 this.execute(e, h, undefined, c) 17350 } catch (i) { 17351 this.handleException(i) 17352 } 17353 } 17354 if (this.batch === false) { 17355 for (var d = 0, a = b.length; d < a; d++) { 17356 g.call(this, b[d]) 17357 } 17358 } else { 17359 g.call(this, b) 17360 } 17361 }, 17362 addToBatch : function(c) { 17363 var a = this.batches, d = this.batchKey + c, e = a[d]; 17364 if (!e) { 17365 a[d] = e = { 17366 id : c, 17367 count : 0, 17368 data : {} 17369 } 17370 } 17371 ++e.count 17372 }, 17373 removeFromBatch : function(d, h, g) { 17374 var c = this.batches, e = this.batchKey + d, i = c[e], a; 17375 if (i) { 17376 a = i.data[h] || []; 17377 i.data[h] = a.concat(g); 17378 if (i.count === 1) { 17379 g = i.data; 17380 delete c[e]; 17381 this.fireEvent("save", this, d, g) 17382 } else { 17383 --i.count 17384 } 17385 } 17386 }, 17387 createCallback : function(c, a, b) { 17388 var d = Ext.data.Api.actions; 17389 return (c == "read") ? this.loadRecords : function(g, e, h) { 17390 this["on" + Ext.util.Format.capitalize(c) + "Records"](h, a, [] 17391 .concat(g)); 17392 if (h === true) { 17393 this.fireEvent("write", this, c, g, e, a) 17394 } 17395 this.removeFromBatch(b, c, g) 17396 } 17397 }, 17398 clearModified : function(a) { 17399 if (Ext.isArray(a)) { 17400 for (var b = a.length - 1; b >= 0; b--) { 17401 this.modified.splice(this.modified.indexOf(a[b]), 1) 17402 } 17403 } else { 17404 this.modified.splice(this.modified.indexOf(a), 1) 17405 } 17406 }, 17407 reMap : function(b) { 17408 if (Ext.isArray(b)) { 17409 for (var d = 0, a = b.length; d < a; d++) { 17410 this.reMap(b[d]) 17411 } 17412 } else { 17413 delete this.data.map[b._phid]; 17414 this.data.map[b.id] = b; 17415 var c = this.data.keys.indexOf(b._phid); 17416 this.data.keys.splice(c, 1, b.id); 17417 delete b._phid 17418 } 17419 }, 17420 onCreateRecords : function(d, a, b) { 17421 if (d === true) { 17422 try { 17423 this.reader.realize(a, b) 17424 } catch (c) { 17425 this.handleException(c); 17426 if (Ext.isArray(a)) { 17427 this.onCreateRecords(d, a, b) 17428 } 17429 } 17430 } 17431 }, 17432 onUpdateRecords : function(d, a, b) { 17433 if (d === true) { 17434 try { 17435 this.reader.update(a, b) 17436 } catch (c) { 17437 this.handleException(c); 17438 if (Ext.isArray(a)) { 17439 this.onUpdateRecords(d, a, b) 17440 } 17441 } 17442 } 17443 }, 17444 onDestroyRecords : function(e, b, d) { 17445 b = (b instanceof Ext.data.Record) ? [b] : [].concat(b); 17446 for (var c = 0, a = b.length; c < a; c++) { 17447 this.removed.splice(this.removed.indexOf(b[c]), 1) 17448 } 17449 if (e === false) { 17450 for (c = b.length - 1; c >= 0; c--) { 17451 this.insert(b[c].lastIndex, b[c]) 17452 } 17453 } 17454 }, 17455 handleException : function(a) { 17456 Ext.handleError(a) 17457 }, 17458 reload : function(a) { 17459 this.load(Ext.applyIf(a || {}, this.lastOptions)) 17460 }, 17461 loadRecords : function(b, l, h) { 17462 var e, g; 17463 if (this.isDestroyed === true) { 17464 return 17465 } 17466 if (!b || h === false) { 17467 if (h !== false) { 17468 this.fireEvent("load", this, [], l) 17469 } 17470 if (l.callback) { 17471 l.callback.call(l.scope || this, [], l, false, b) 17472 } 17473 return 17474 } 17475 var a = b.records, j = b.totalRecords || a.length; 17476 if (!l || l.add !== true) { 17477 if (this.pruneModifiedRecords) { 17478 this.modified = [] 17479 } 17480 for (e = 0, g = a.length; e < g; e++) { 17481 a[e].join(this) 17482 } 17483 if (this.snapshot) { 17484 this.data = this.snapshot; 17485 delete this.snapshot 17486 } 17487 this.clearData();
17488 this.data.addAll(a); 17489 this.totalLength = j; 17490 this.applySort(); 17491 this.fireEvent("datachanged", this) 17492 } else { 17493 var k = [], d, c = 0; 17494 for (e = 0, g = a.length; e < g; ++e) { 17495 d = a[e]; 17496 if (this.indexOfId(d.id) > -1) { 17497 this.doUpdate(d) 17498 } else { 17499 k.push(d); 17500 ++c 17501 } 17502 } 17503 this.totalLength = Math.max(j, this.data.length + c); 17504 this.add(k) 17505 } 17506 this.fireEvent("load", this, a, l); 17507 if (l.callback) { 17508 l.callback.call(l.scope || this, a, l, true) 17509 } 17510 }, 17511 loadData : function(c, a) { 17512 var b = this.reader.readRecords(c); 17513 this.loadRecords(b, { 17514 add : a 17515 }, true) 17516 }, 17517 getCount : function() { 17518 return this.data.length || 0 17519 }, 17520 getTotalCount : function() { 17521 return this.totalLength || 0 17522 }, 17523 getSortState : function() { 17524 return this.sortInfo 17525 }, 17526 applySort : function() { 17527 if ((this.sortInfo || this.multiSortInfo) && !this.remoteSort) { 17528 this.sortData() 17529 } 17530 }, 17531 sortData : function() { 17532 var a = this.hasMultiSort ? this.multiSortInfo : this.sortInfo, k = a.direction 17533 || "ASC", h = a.sorters, c = []; 17534 if (!this.hasMultiSort) { 17535 h = [{ 17536 direction : k, 17537 field : a.field 17538 }] 17539 } 17540 for (var d = 0, b = h.length; d < b; d++) { 17541 c.push(this.createSortFunction(h[d].field, h[d].direction)) 17542 } 17543 if (c.length == 0) { 17544 return 17545 } 17546 var g = k.toUpperCase() == "DESC" ? -1 : 1; 17547 var e = function(n, m) { 17548 var l = c[0].call(this, n, m); 17549 if (c.length > 1) { 17550 for (var p = 1, o = c.length; p < o; p++) { 17551 l = l || c[p].call(this, n, m) 17552 } 17553 } 17554 return g * l 17555 }; 17556 this.data.sort(k, e); 17557 if (this.snapshot && this.snapshot != this.data) { 17558 this.snapshot.sort(k, e) 17559 } 17560 }, 17561 createSortFunction : function(c, b) { 17562 b = b || "ASC"; 17563 var a = b.toUpperCase() == "DESC" ? -1 : 1; 17564 var d = this.fields.get(c).sortType; 17565 return function(g, e) { 17566 var i = d(g.data[c]), h = d(e.data[c]); 17567 return a * (i > h ? 1 : (i < h ? -1 : 0)) 17568 } 17569 }, 17570 setDefaultSort : function(b, a) { 17571 a = a ? a.toUpperCase() : "ASC"; 17572 this.sortInfo = { 17573 field : b, 17574 direction : a 17575 }; 17576 this.sortToggle[b] = a 17577 }, 17578 sort : function(b, a) { 17579 if (Ext.isArray(arguments[0])) { 17580 return this.multiSort.call(this, b, a) 17581 } else { 17582 return this.singleSort(b, a) 17583 } 17584 }, 17585 singleSort : function(g, c) { 17586 var e = this.fields.get(g); 17587 if (!e) { 17588 return false 17589 } 17590 var b = e.name, a = this.sortInfo || null, d = this.sortToggle 17591 ? this.sortToggle[b] 17592 : null; 17593 if (!c) { 17594 if (a && a.field == b) { 17595 c = (this.sortToggle[b] || "ASC").toggle("ASC", "DESC") 17596 } else { 17597 c = e.sortDir 17598 } 17599 } 17600 this.sortToggle[b] = c; 17601 this.sortInfo = { 17602 field : b, 17603 direction : c 17604 }; 17605 this.hasMultiSort = false; 17606 if (this.remoteSort) { 17607 if (!this.load(this.lastOptions)) { 17608 if (d) { 17609 this.sortToggle[b] = d 17610 } 17611 if (a) { 17612 this.sortInfo = a 17613 } 17614 } 17615 } else { 17616 this.applySort(); 17617 this.fireEvent("datachanged", this) 17618 } 17619 return true 17620 }, 17621 multiSort : function(b, a) { 17622 this.hasMultiSort = true; 17623 a = a || "ASC"; 17624 if (this.multiSortInfo && a == this.multiSortInfo.direction) { 17625 a = a.toggle("ASC", "DESC") 17626 } 17627 this.multiSortInfo = { 17628 sorters : b, 17629 direction : a 17630 }; 17631 if (this.remoteSort) { 17632 this.singleSort(b[0].field, b[0].direction) 17633 } else { 17634 this.applySort(); 17635 this.fireEvent("datachanged", this) 17636 } 17637 }, 17638 each : function(b, a) { 17639 this.data.each(b, a) 17640 }, 17641 getModifiedRecords : function() { 17642 return this.modified 17643 }, 17644 sum : function(e, g, a) { 17645 var c = this.data.items, b = 0; 17646 g = g || 0; 17647 a = (a || a === 0) ? a : c.length - 1; 17648 for (var d = g; d <= a; d++) { 17649 b += (c[d].data[e] || 0) 17650 } 17651 return b 17652 }, 17653 createFilterFn : function(d, c, e, a, b) { 17654 if (Ext.isEmpty(c, false)) { 17655 return false 17656 } 17657 c = this.data.createValueMatcher(c, e, a, b); 17658 return function(g) { 17659 return c.test(g.data[d]) 17660 } 17661 }, 17662 createMultipleFilterFn : function(a) { 17663 return function(b) { 17664 var k = true; 17665 for (var d = 0, c = a.length; d < c; d++) { 17666 var h = a[d], g = h.fn, e = h.scope; 17667 k = k && g.call(e, b) 17668 } 17669 return k 17670 } 17671 }, 17672 filter : function(n, m, h, k, e) { 17673 var l; 17674 if (Ext.isObject(n)) {
17675 n = [n] 17676 } 17677 if (Ext.isArray(n)) { 17678 var b = []; 17679 for (var g = 0, d = n.length; g < d; g++) { 17680 var a = n[g], c = a.fn, o = a.scope || this; 17681 if (!Ext.isFunction(c)) { 17682 c = this.createFilterFn(a.property, a.value, a.anyMatch, 17683 a.caseSensitive, a.exactMatch) 17684 } 17685 b.push({ 17686 fn : c, 17687 scope : o 17688 }) 17689 } 17690 l = this.createMultipleFilterFn(b) 17691 } else { 17692 l = this.createFilterFn(n, m, h, k, e) 17693 } 17694 return l ? this.filterBy(l) : this.clearFilter() 17695 }, 17696 filterBy : function(b, a) { 17697 this.snapshot = this.snapshot || this.data; 17698 this.data = this.queryBy(b, a || this); 17699 this.fireEvent("datachanged", this) 17700 }, 17701 clearFilter : function(a) { 17702 if (this.isFiltered()) { 17703 this.data = this.snapshot; 17704 delete this.snapshot; 17705 if (a !== true) { 17706 this.fireEvent("datachanged", this) 17707 } 17708 } 17709 }, 17710 isFiltered : function() { 17711 return !!this.snapshot && this.snapshot != this.data 17712 }, 17713 query : function(d, c, e, a) { 17714 var b = this.createFilterFn(d, c, e, a); 17715 return b ? this.queryBy(b) : this.data.clone() 17716 }, 17717 queryBy : function(b, a) { 17718 var c = this.snapshot || this.data; 17719 return c.filterBy(b, a || this) 17720 }, 17721 find : function(d, c, g, e, a) { 17722 var b = this.createFilterFn(d, c, e, a); 17723 return b ? this.data.findIndexBy(b, null, g) : -1 17724 }, 17725 findExact : function(b, a, c) { 17726 return this.data.findIndexBy(function(d) { 17727 return d.get(b) === a 17728 }, this, c) 17729 }, 17730 findBy : function(b, a, c) { 17731 return this.data.findIndexBy(b, a, c) 17732 }, 17733 collect : function(j, k, b) { 17734 var h = (b === true && this.snapshot) 17735 ? this.snapshot.items 17736 : this.data.items; 17737 var m, n, a = [], c = {}; 17738 for (var e = 0, g = h.length; e < g; e++) { 17739 m = h[e].data[j]; 17740 n = String(m); 17741 if ((k || !Ext.isEmpty(m)) && !c[n]) { 17742 c[n] = true; 17743 a[a.length] = m 17744 } 17745 } 17746 return a 17747 }, 17748 afterEdit : function(a) { 17749 if (this.modified.indexOf(a) == -1) { 17750 this.modified.push(a) 17751 } 17752 this.fireEvent("update", this, a, Ext.data.Record.EDIT) 17753 }, 17754 afterReject : function(a) { 17755 this.modified.remove(a); 17756 this.fireEvent("update", this, a, Ext.data.Record.REJECT) 17757 }, 17758 afterCommit : function(a) { 17759 this.modified.remove(a); 17760 this.fireEvent("update", this, a, Ext.data.Record.COMMIT) 17761 }, 17762 commitChanges : function() { 17763 var a = this.modified.slice(0), c = a.length, b; 17764 for (b = 0; b < c; b++) { 17765 a[b].commit() 17766 } 17767 this.modified = []; 17768 this.removed = [] 17769 }, 17770 rejectChanges : function() { 17771 var a = this.modified.slice(0), e = this.removed.slice(0).reverse(), c = a.length, d = e.length, b; 17772 for (b = 0; b < c; b++) { 17773 a[b].reject() 17774 } 17775 for (b = 0; b < d; b++) { 17776 this.insert(e[b].lastIndex || 0, e[b]); 17777 e[b].reject() 17778 } 17779 this.modified = []; 17780 this.removed = [] 17781 }, 17782 onMetaChange : function(a) { 17783 this.recordType = this.reader.recordType; 17784 this.fields = this.recordType.prototype.fields; 17785 delete this.snapshot; 17786 if (this.reader.meta.sortInfo) { 17787 this.sortInfo = this.reader.meta.sortInfo 17788 } else { 17789 if (this.sortInfo && !this.fields.get(this.sortInfo.field)) { 17790 delete this.sortInfo 17791 } 17792 } 17793 if (this.writer) { 17794 this.writer.meta = this.reader.meta 17795 } 17796 this.modified = []; 17797 this.fireEvent("metachange", this, this.reader.meta) 17798 }, 17799 findInsertIndex : function(a) { 17800 this.suspendEvents(); 17801 var c = this.data.clone(); 17802 this.data.add(a); 17803 this.applySort(); 17804 var b = this.data.indexOf(a); 17805 this.data = c; 17806 this.resumeEvents(); 17807 return b 17808 }, 17809 setBaseParam : function(a, b) { 17810 this.baseParams = this.baseParams || {}; 17811 this.baseParams[a] = b 17812 } 17813}); 17814Ext.reg("store", Ext.data.Store); 17815Ext.data.Store.Error = Ext.extend(Ext.Error, { 17816 name : "Ext.data.Store" 17817 }); 17818Ext.apply(Ext.data.Store.Error.prototype, { 17819 lang : { 17820 "writer-undefined" : "Attempted to execute a write-action without a DataWriter installed." 17821 } 17822}); 17823Ext.data.Field = Ext.extend(Object, { 17824 constructor : function(b) { 17825 if (Ext.isString(b)) { 17826 b = { 17827 name : b 17828 } 17829 } 17830 Ext.apply(this, b); 17831 var d = Ext.data.Types, a = this.sortType, c;
17832 if (this.type) { 17833 if (Ext.isString(this.type)) { 17834 this.type = Ext.data.Types[this.type.toUpperCase()] 17835 || d.AUTO 17836 } 17837 } else { 17838 this.type = d.AUTO 17839 } 17840 if (Ext.isString(a)) { 17841 this.sortType = Ext.data.SortTypes[a] 17842 } else { 17843 if (Ext.isEmpty(a)) { 17844 this.sortType = this.type.sortType 17845 } 17846 } 17847 if (!this.convert) { 17848 this.convert = this.type.convert 17849 } 17850 }, 17851 dateFormat : null, 17852 useNull : false, 17853 defaultValue : "", 17854 mapping : null, 17855 sortType : null, 17856 sortDir : "ASC", 17857 allowBlank : true 17858 }); 17859Ext.data.DataReader = function(a, b) { 17860 this.meta = a; 17861 this.recordType = Ext.isArray(b) ? Ext.data.Record.create(b) : b; 17862 if (this.recordType) { 17863 this.buildExtractors() 17864 } 17865}; 17866Ext.data.DataReader.prototype = { 17867 getTotal : Ext.emptyFn, 17868 getRoot : Ext.emptyFn, 17869 getMessage : Ext.emptyFn, 17870 getSuccess : Ext.emptyFn, 17871 getId : Ext.emptyFn, 17872 buildExtractors : Ext.emptyFn, 17873 extractValues : Ext.emptyFn, 17874 realize : function(a, c) { 17875 if (Ext.isArray(a)) { 17876 for (var b = a.length - 1; b >= 0; b--) { 17877 if (Ext.isArray(c)) { 17878 this 17879 .realize(a.splice(b, 1).shift(), c.splice(b, 1) 17880 .shift()) 17881 } else { 17882 this.realize(a.splice(b, 1).shift(), c) 17883 } 17884 } 17885 } else { 17886 if (Ext.isArray(c) && c.length == 1) { 17887 c = c.shift() 17888 } 17889 if (!this.isData(c)) { 17890 throw new Ext.data.DataReader.Error("realize", a) 17891 } 17892 a.phantom = false; 17893 a._phid = a.id; 17894 a.id = this.getId(c); 17895 a.data = c; 17896 a.commit(); 17897 a.store.reMap(a) 17898 } 17899 }, 17900 update : function(a, c) { 17901 if (Ext.isArray(a)) { 17902 for (var b = a.length - 1; b >= 0; b--) { 17903 if (Ext.isArray(c)) { 17904 this.update(a.splice(b, 1).shift(), c.splice(b, 1).shift()) 17905 } else { 17906 this.update(a.splice(b, 1).shift(), c) 17907 } 17908 } 17909 } else { 17910 if (Ext.isArray(c) && c.length == 1) { 17911 c = c.shift() 17912 } 17913 if (this.isData(c)) { 17914 a.data = Ext.apply(a.data, c) 17915 } 17916 a.commit() 17917 } 17918 }, 17919 extractData : function(k, a) { 17920 var j = (this instanceof Ext.data.JsonReader) ? "json" : "node"; 17921 var c = []; 17922 if (this.isData(k) && !(this instanceof Ext.data.XmlReader)) { 17923 k = [k] 17924 } 17925 var h = this.recordType.prototype.fields, o = h.items, m = h.length, c = []; 17926 if (a === true) { 17927 var l = this.recordType; 17928 for (var e = 0; e < k.length; e++) { 17929 var b = k[e]; 17930 var g = new l(this.extractValues(b, o, m), this.getId(b)); 17931 g[j] = b; 17932 c.push(g) 17933 } 17934 } else { 17935 for (var e = 0; e < k.length; e++) { 17936 var d = this.extractValues(k[e], o, m); 17937 d[this.meta.idProperty] = this.getId(k[e]); 17938 c.push(d) 17939 } 17940 } 17941 return c 17942 }, 17943 isData : function(a) { 17944 return (a && Ext.isObject(a) && !Ext.isEmpty(this.getId(a))) 17945 ? true 17946 : false 17947 }, 17948 onMetaChange : function(a) { 17949 delete this.ef; 17950 this.meta = a; 17951 this.recordType = Ext.data.Record.create(a.fields); 17952 this.buildExtractors() 17953 } 17954}; 17955Ext.data.DataReader.Error = Ext.extend(Ext.Error, { 17956 constructor : function(b, a) { 17957 this.arg = a; 17958 Ext.Error.call(this, b) 17959 }, 17960 name : "Ext.data.DataReader" 17961 }); 17962Ext.apply(Ext.data.DataReader.Error.prototype, { 17963 lang : { 17964 update : "#update received invalid data from server. Please see docs for DataReader#update and review your DataReader configuration.", 17965 realize : "#realize was called with invalid remote-data. Please see the docs for DataReader#realize and review your DataReader configuration.", 17966 "invalid-response" : "#readResponse received an invalid response from the server." 17967 } 17968}); 17969Ext.data.DataWriter = function(a) { 17970 Ext.apply(this, a) 17971}; 17972Ext.data.DataWriter.prototype = { 17973 writeAllFields : false, 17974 listful : false, 17975 apply : function(e, g, d, a) { 17976 var c = [], b = d + "Record"; 17977 if (Ext.isArray(a)) { 17978 Ext.each(a, function(h) { 17979 c.push(this[b](h)) 17980 }, this) 17981 } else { 17982 if (a instanceof Ext.data.Record) { 17983 c = this[b](a) 17984 } 17985 } 17986 this.render(e, g, c) 17987 }, 17988 render : Ext.emptyFn, 17989 updateRecord : Ext.emptyFn, 17990 createRecord : Ext.emptyFn, 17991 destroyRecord : Ext.emptyFn, 17992 toHash : function(g, c) { 17993 var e = g.fields.map, d = {}, b = (this.writeAllFields === false && g.phantom === false) 17994 ? g.getChanges() 17995 : g.data, a; 17996 Ext.iterate(b, function(i, h) { 17997 if ((a = e[i])) { 17998 d[a.mapping ? a.mapping : a.name] = h 17999 } 18000 }); 18001 if (g.phantom) { 18002 if (g.fields.containsKey(this.meta.idProperty) 18003 && Ext.isEmpty(g.data[this.meta.idProperty])) { 18004 delete d[this.meta.idProperty] 18005 } 18006 } else { 18007 d[this.meta.idProperty] = g.id 18008 } 18009 return d 18010 }, 18011 toArray : function(b) { 18012 var a = []; 18013 Ext.iterate(b, function(d, c) { 18014 a.push({ 18015 name : d, 18016 value : c 18017 }) 18018 }, this); 18019 return a 18020 } 18021}; 18022Ext.data.DataProxy = function(a) { 18023 a = a || {}; 18024 this.api = a.api; 18025 this.url = a.url; 18026 this.restful = a.restful; 18027 this.listeners = a.listeners; 18028 this.prettyUrls = a.prettyUrls; 18029 this.addEvents("exception", "beforeload", "load", "loadexception", 18030 "beforewrite", "write"); 18031 Ext.data.DataProxy.superclass.constructor.call(this); 18032 try { 18033 Ext.data.Api.prepare(this) 18034 } catch (b) { 18035 if (b instanceof Ext.data.Api.Error) { 18036 b.toConsole() 18037 } 18038 } 18039 Ext.data.DataProxy.relayEvents(this, ["beforewrite", "write", "exception"]) 18040}; 18041Ext.extend(Ext.data.DataProxy, Ext.util.Observable, { 18042 restful : false, 18043 setApi : function() { 18044 if (arguments.length == 1) { 18045 var a = Ext.data.Api.isValid(arguments[0]); 18046 if (a === true) { 18047 this.api = arguments[0] 18048 } else { 18049 throw new Ext.data.Api.Error("invalid", a) 18050 } 18051 } else { 18052 if (arguments.length == 2) { 18053 if (!Ext.data.Api.isAction(arguments[0])) { 18054 throw new Ext.data.Api.Error("invalid", 18055 arguments[0]) 18056 } 18057 this.api[arguments[0]] = arguments[1] 18058 } 18059 } 18060 Ext.data.Api.prepare(this) 18061 }, 18062 isApiAction : function(a) {
18063 return (this.api[a]) ? true : false 18064 }, 18065 request : function(e, b, g, a, h, d, c) { 18066 if (!this.api[e] && !this.load) { 18067 throw new Ext.data.DataProxy.Error("action-undefined", e) 18068 } 18069 g = g || {}; 18070 if ((e === Ext.data.Api.actions.read) ? this.fireEvent( 18071 "beforeload", this, g) : this.fireEvent("beforewrite", 18072 this, e, b, g) !== false) { 18073 this.doRequest.apply(this, arguments) 18074 } else { 18075 h.call(d || this, null, c, false) 18076 } 18077 }, 18078 load : null, 18079 doRequest : function(e, b, g, a, h, d, c) { 18080 this.load(g, a, h, d, c) 18081 }, 18082 onRead : Ext.emptyFn, 18083 onWrite : Ext.emptyFn, 18084 buildUrl : function(d, b) { 18085 b = b || null; 18086 var c = (this.conn && this.conn.url) 18087 ? this.conn.url 18088 : (this.api[d]) ? this.api[d].url : this.url; 18089 if (!c) { 18090 throw new Ext.data.Api.Error("invalid-url", d) 18091 } 18092 var e = null; 18093 var a = c.match(/(.*)(\.json|\.xml|\.html)$/); 18094 if (a) { 18095 e = a[2]; 18096 c = a[1] 18097 } 18098 if ((this.restful === true || this.prettyUrls === true) 18099 && b instanceof Ext.data.Record && !b.phantom) { 18100 c += "/" + b.id 18101 } 18102 return (e === null) ? c : c + e 18103 }, 18104 destroy : function() { 18105 this.purgeListeners() 18106 } 18107 }); 18108Ext.apply(Ext.data.DataProxy, Ext.util.Observable.prototype); 18109Ext.util.Observable.call(Ext.data.DataProxy); 18110Ext.data.DataProxy.Error = Ext.extend(Ext.Error, { 18111 constructor : function(b, a) { 18112 this.arg = a; 18113 Ext.Error.call(this, b) 18114 }, 18115 name : "Ext.data.DataProxy" 18116 }); 18117Ext.apply(Ext.data.DataProxy.Error.prototype, { 18118 lang : { 18119 "action-undefined" : "DataProxy attempted to execute an API-action but found an undefined url / function. Please review your Proxy url/api-configuration.", 18120 "api-invalid" : "Recieved an invalid API-configuration. Please ensure your proxy API-configuration contains only the actions from Ext.data.Api.actions." 18121 } 18122}); 18123Ext.data.Request = function(a) { 18124 Ext.apply(this, a) 18125}; 18126Ext.data.Request.prototype = { 18127 action : undefined, 18128 rs : undefined, 18129 params : undefined, 18130 callback : Ext.emptyFn, 18131 scope : undefined, 18132 reader : undefined 18133}; 18134Ext.data.Response = function(a) { 18135 Ext.apply(this, a) 18136}; 18137Ext.data.Response.prototype = { 18138 action : undefined, 18139 success : undefined, 18140 message : undefined, 18141 data : undefined, 18142 raw : undefined, 18143 records : undefined 18144}; 18145Ext.data.ScriptTagProxy = function(a) { 18146 Ext.apply(this, a); 18147 Ext.data.ScriptTagProxy.superclass.constructor.call(this, a); 18148 this.head = document.getElementsByTagName("head")[0] 18149}; 18150Ext.data.ScriptTagProxy.TRANS_ID = 1000; 18151Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, { 18152 timeout : 300000, 18153 callbackParam : "callback", 18154 nocache : true, 18155 doRequest : function(e, g, d, h, j, k, l) { 18156 var c = Ext.urlEncode(Ext.apply(d, this.extraParams)); 18157 var b = this.buildUrl(e, g); 18158 if (!b) { 18159 throw new Ext.data.Api.Error("invalid-url", b) 18160 } 18161 b = Ext.urlAppend(b, c); 18162 if (this.nocache) { 18163 b = Ext.urlAppend(b, "_dc=" + (new Date().getTime())) 18164 } 18165 var a = ++Ext.data.ScriptTagProxy.TRANS_ID; 18166 var m = { 18167 id : a, 18168 action : e, 18169 cb : "stcCallback" + a, 18170 scriptId : "stcScript" + a, 18171 params : d, 18172 arg : l, 18173 url : b, 18174 callback : j, 18175 scope : k, 18176 reader : h 18177 }; 18178 window[m.cb] = this.createCallback(e, g, m); 18179 b += String.format("&{0}={1}", this.callbackParam, m.cb); 18180 if (this.autoAbort !== false) { 18181 this.abort() 18182 } 18183 m.timeoutId = this.handleFailure.defer(this.timeout, this, [m]); 18184 var i = document.createElement("script"); 18185 i.setAttribute("src", b); 18186 i.setAttribute("type", "text/javascript"); 18187 i.setAttribute("id", m.scriptId); 18188 this.head.appendChild(i); 18189 this.trans = m 18190 }, 18191 createCallback : function(d, b, c) { 18192 var a = this; 18193 return function(e) { 18194 a.trans = false; 18195 a.destroyTrans(c, true); 18196 if (d === Ext.data.Api.actions.read) { 18197 a.onRead.call(a, d, c, e) 18198 } else { 18199 a.onWrite.call(a, d, c, e, b) 18200 } 18201 } 18202 }, 18203 onRead : function(d, c, b) { 18204 var a; 18205 try { 18206 a = c.reader.readRecords(b) 18207 } catch (g) { 18208 this.fireEvent("loadexception", this, c, b, g); 18209 this.fireEvent("exception", this, "response", d, c, b, g); 18210 c.callback.call(c.scope || window, null, c.arg, false); 18211 return 18212 } 18213 if (a.success === false) { 18214 this.fireEvent("loadexception", this, c, b); 18215 this.fireEvent("exception", this, "remote", d, c, b, null) 18216 } else { 18217 this.fireEvent("load", this, b, c.arg) 18218 } 18219 c.callback.call(c.scope || window, a, c.arg, a.success) 18220 }, 18221 onWrite : function(h, g, c, b) { 18222 var a = g.reader; 18223 try { 18224 var d = a.readResponse(h, c) 18225 } catch (i) { 18226 this.fireEvent("exception", this, "response", h, g, d, i); 18227 g.callback.call(g.scope || window, null, d, false); 18228 return 18229 } 18230 if (!d.success === true) { 18231 this.fireEvent("exception", this, "remote", h, g, d, b); 18232 g.callback.call(g.scope || window, null, d, false); 18233 return 18234 } 18235 this.fireEvent("write", this, h, d.data, d, b, g.arg); 18236 g.callback.call(g.scope || window, d.data, d, true) 18237 }, 18238 isLoading : function() { 18239 return this.trans ? true : false 18240 }, 18241 abort : function() { 18242 if (this.isLoading()) { 18243 this.destroyTrans(this.trans) 18244 } 18245 }, 18246 destroyTrans : function(b, a) { 18247 this.head.removeChild(document.getElementById(b.scriptId)); 18248 clearTimeout(b.timeoutId); 18249 if (a) { 18250 window[b.cb] = undefined; 18251 try { 18252 delete window[b.cb] 18253 } catch (c) { 18254 } 18255 } else { 18256 window[b.cb] = function() { 18257 window[b.cb] = undefined; 18258 try { 18259 delete window[b.cb] 18260 } catch (d) { 18261 } 18262 } 18263 } 18264 }, 18265 handleFailure : function(a) { 18266 this.trans = false; 18267 this.destroyTrans(a, false); 18268 if (a.action === Ext.data.Api.actions.read) { 18269 this.fireEvent("loadexception", this, null, a.arg) 18270 } 18271 this.fireEvent("exception", this, "response", a.action, { 18272 response : null, 18273 options : a.arg 18274 });
18275 a.callback.call(a.scope || window, null, a.arg, false) 18276 }, 18277 destroy : function() { 18278 this.abort(); 18279 Ext.data.ScriptTagProxy.superclass.destroy.call(this) 18280 } 18281 }); 18282Ext.data.HttpProxy = function(a) { 18283 Ext.data.HttpProxy.superclass.constructor.call(this, a); 18284 this.conn = a; 18285 this.conn.url = null; 18286 this.useAjax = !a || !a.events; 18287 var c = Ext.data.Api.actions; 18288 this.activeRequest = {}; 18289 for (var b in c) { 18290 this.activeRequest[c[b]] = undefined 18291 } 18292}; 18293Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, { 18294 getConnection : function() { 18295 return this.useAjax ? Ext.Ajax : this.conn 18296 }, 18297 setUrl : function(a, b) { 18298 this.conn.url = a; 18299 if (b === true) { 18300 this.url = a; 18301 this.api = null; 18302 Ext.data.Api.prepare(this) 18303 } 18304 }, 18305 doRequest : function(g, d, i, c, b, e, a) { 18306 var h = { 18307 method : (this.api[g]) ? this.api[g]["method"] : undefined, 18308 request : { 18309 callback : b, 18310 scope : e, 18311 arg : a 18312 }, 18313 reader : c, 18314 callback : this.createCallback(g, d), 18315 scope : this 18316 }; 18317 if (i.jsonData) { 18318 h.jsonData = i.jsonData 18319 } else { 18320 if (i.xmlData) { 18321 h.xmlData = i.xmlData 18322 } else { 18323 h.params = i || {} 18324 } 18325 } 18326 this.conn.url = this.buildUrl(g, d); 18327 if (this.useAjax) { 18328 Ext.applyIf(h, this.conn); 18329 if (this.activeRequest[g]) { 18330 } 18331 this.activeRequest[g] = Ext.Ajax.request(h) 18332 } else { 18333 this.conn.request(h) 18334 } 18335 this.conn.url = null 18336 }, 18337 createCallback : function(b, a) { 18338 return function(e, d, c) { 18339 this.activeRequest[b] = undefined; 18340 if (!d) { 18341 if (b === Ext.data.Api.actions.read) { 18342 this.fireEvent("loadexception", this, e, c) 18343 } 18344 this.fireEvent("exception", this, "response", b, e, c); 18345 e.request.callback.call(e.request.scope, null, 18346 e.request.arg, false); 18347 return 18348 } 18349 if (b === Ext.data.Api.actions.read) { 18350 this.onRead(b, e, c) 18351 } else { 18352 this.onWrite(b, e, c, a) 18353 } 18354 } 18355 }, 18356 onRead : function(d, h, b) { 18357 var a; 18358 try { 18359 a = h.reader.read(b) 18360 } catch (g) { 18361 /* 18362 * ë©ì¼ 리ì¤í¸ì í¹ì문ìê° ììê²½ì° 18363 * 리ì¤í¸ê° ìë³´ì´ë ê²½ì°ê° ìì. 18364 * ë©ì¼ ì 목 CharCodeë¡ í¹ì문ì ì ê±° 18365 */ 18366 try { 18367 var charCodeCheck = function(val) { 18368 var c, code = []; 18369 for (i = val.length; i >= 0; i--) { 18370 c = val.charCodeAt(i); 18371 /* 18372 * ì ê±°í í¹ì문ì를 ë£ëë¤. 18373 */ 18374 if (c <= 0 || c == 8232) { 18375 code.push(i); 18376 } 18377 } 18378 18379 /* 18380 * í¹ì문ì ì ê±° 18381 */ 18382 if (code.length > 0) { 18383 for (i = 0; i < code.length; i++) { 18384 val = val.substring(0, code[i]) 18385 + val.substring(code[i] + 1); 18386 } 18387 } 18388 return val; 18389 } 18390 18391 var v = charCodeCheck(b.responseText); 18392 b.responseText = v; 18393 a = h.reader.read(b) 18394 } catch (e) { 18395 this.fireEvent("loadexception", this, h, b, g); 18396 this.fireEvent("exception", this, "response", d, h, b, g); 18397 h.request.callback.call(h.request.scope, null, h.request.arg, false); 18398 return 18399 } 18400 } 18401 if (a.success === false) { 18402 this.fireEvent("loadexception", this, h, b); 18403 var c = h.reader.readResponse(d, b); 18404 this.fireEvent("exception", this, "remote", d, h, c, null) 18405 } else { 18406 this.fireEvent("load", this, h, h.request.arg) 18407 } 18408 h.request.callback.call(h.request.scope, a, h.request.arg, 18409 a.success) 18410 }, 18411 onWrite : function(g, i, c, b) { 18412 var a = i.reader; 18413 var d; 18414 try { 18415 d = a.readResponse(g, c) 18416 } catch (h) { 18417 this.fireEvent("exception", this, "response", g, i, c, h); 18418 i.request.callback.call(i.request.scope, null, 18419 i.request.arg, false); 18420 return 18421 } 18422 if (d.success === true) { 18423 this.fireEvent("write", this, g, d.data, d, b, 18424 i.request.arg) 18425 } else { 18426 this.fireEvent("exception", this, "remote", g, i, d, b) 18427 } 18428 i.request.callback.call(i.request.scope, d.data, d, d.success) 18429 }, 18430 destroy : function() { 18431 if (!this.useAjax) { 18432 this.conn.abort() 18433 } else { 18434 if (this.activeRequest) { 18435 var b = Ext.data.Api.actions; 18436 for (var a in b) { 18437 if (this.activeRequest[b[a]]) { 18438 Ext.Ajax.abort(this.activeRequest[b[a]]) 18439 } 18440 } 18441 } 18442 } 18443 Ext.data.HttpProxy.superclass.destroy.call(this) 18444 } 18445 }); 18446Ext.data.MemoryProxy = function(b) { 18447 var a = {}; 18448 a[Ext.data.Api.actions.read] = true; 18449 Ext.data.MemoryProxy.superclass.constructor.call(this, { 18450 api : a 18451 }); 18452 this.data = b 18453}; 18454Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, { 18455 doRequest : function(b, c, a, d, h, i, j) { 18456 a = a || {}; 18457 var k; 18458 try { 18459 k = d.readRecords(this.data) 18460 } catch (g) { 18461 this.fireEvent("loadexception", this, null, j, g); 18462 this 18463 .fireEvent("exception", this, "response", b, j, 18464 null, g); 18465 h.call(i, null, j, false); 18466 return 18467 } 18468 h.call(i, k, j, true) 18469 } 18470 }); 18471Ext.data.Types = new function() { 18472 var a = Ext.data.SortTypes; 18473 Ext.apply(this, {
18474 stripRe : /[\$,%]/g, 18475 AUTO : { 18476 convert : function(b) { 18477 return b 18478 }, 18479 sortType : a.none, 18480 type : "auto" 18481 }, 18482 STRING : { 18483 convert : function(b) { 18484 return (b === undefined || b === null) ? "" : String(b) 18485 }, 18486 sortType : a.asUCString, 18487 type : "string" 18488 }, 18489 INT : { 18490 convert : function(b) { 18491 return b !== undefined && b !== null && b !== "" 18492 ? parseInt(String(b).replace( 18493 Ext.data.Types.stripRe, ""), 10) 18494 : (this.useNull ? null : 0) 18495 }, 18496 sortType : a.none, 18497 type : "int" 18498 }, 18499 FLOAT : { 18500 convert : function(b) { 18501 return b !== undefined && b !== null && b !== "" 18502 ? parseFloat(String(b).replace( 18503 Ext.data.Types.stripRe, ""), 10) 18504 : (this.useNull ? null : 0) 18505 }, 18506 sortType : a.none, 18507 type : "float" 18508 }, 18509 BOOL : { 18510 convert : function(b) { 18511 return b === true || b === "true" || b == 1 18512 }, 18513 sortType : a.none, 18514 type : "bool" 18515 }, 18516 DATE : { 18517 convert : function(c) { 18518 var d = this.dateFormat; 18519 if (!c) { 18520 return null 18521 } 18522 if (Ext.isDate(c)) { 18523 return c 18524 } 18525 if (d) { 18526 if (d == "timestamp") { 18527 return new Date(c * 1000) 18528 } 18529 if (d == "time") { 18530 return new Date(parseInt(c, 10)) 18531 } 18532 return Date.parseDate(c, d) 18533 } 18534 var b = Date.parse(c); 18535 return b ? new Date(b) : null 18536 }, 18537 sortType : a.asDate, 18538 type : "date" 18539 } 18540 }); 18541 Ext.apply(this, { 18542 BOOLEAN : this.BOOL, 18543 INTEGER : this.INT, 18544 NUMBER : this.FLOAT 18545 }) 18546}; 18547Ext.data.JsonWriter = Ext.extend(Ext.data.DataWriter, { 18548 encode : true, 18549 encodeDelete : false, 18550 constructor : function(a) { 18551 Ext.data.JsonWriter.superclass.constructor.call(this, a) 18552 }, 18553 render : function(c, d, b) { 18554 if (this.encode === true) { 18555 Ext.apply(c, d); 18556 c[this.meta.root] = Ext.encode(b) 18557 } else { 18558 var a = Ext.apply({}, d); 18559 a[this.meta.root] = b; 18560 c.jsonData = a 18561 } 18562 }, 18563 createRecord : function(a) { 18564 return this.toHash(a) 18565 }, 18566 updateRecord : function(a) { 18567 return this.toHash(a) 18568 }, 18569 destroyRecord : function(b) { 18570 if (this.encodeDelete) { 18571 var a = {}; 18572 a[this.meta.idProperty] = b.id; 18573 return a 18574 } else { 18575 return b.id 18576 } 18577 } 18578 }); 18579Ext.data.JsonReader = function(a, b) { 18580 a = a || {}; 18581 Ext.applyIf(a, { 18582 idProperty : "id", 18583 successProperty : "success", 18584 totalProperty : "total" 18585 }); 18586 Ext.data.JsonReader.superclass.constructor.call(this, a, b || a.fields) 18587}; 18588Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, { 18589 read : function(a) { 18590 var b = a.responseText; 18591 var c = Ext.decode(b); 18592 if (!c) { 18593 throw { 18594 message : "JsonReader.read: Json object not found" 18595 } 18596 } 18597 return this.readRecords(c) 18598 }, 18599 readResponse : function(e, b) { 18600 var h = (b.responseText !== undefined) ? Ext.decode(b.responseText) : b; 18601 if (!h) { 18602 throw new Ext.data.JsonReader.Error("response") 18603 } 18604 var a = this.getRoot(h), g = this.getSuccess(h); 18605 if (g && e === Ext.data.Api.actions.create) { 18606 var d = Ext.isDefined(a); 18607 if (d && Ext.isEmpty(a)) { 18608 throw new Ext.data.JsonReader.Error("root-empty", 18609 this.meta.root) 18610 } else { 18611 if (!d) { 18612 throw new Ext.data.JsonReader.Error( 18613 "root-undefined-response", this.meta.root) 18614 } 18615 } 18616 } 18617 var c = new Ext.data.Response({ 18618 action : e, 18619 success : g, 18620 data : (a) ? this.extractData(a, false) : [], 18621 message : this.getMessage(h), 18622 raw : h 18623 }); 18624 if (Ext.isEmpty(c.success)) { 18625 throw new Ext.data.JsonReader.Error("successProperty-response", 18626 this.meta.successProperty) 18627 } 18628 return c 18629 }, 18630 readRecords : function(a) { 18631 this.jsonData = a; 18632 if (a.metaData) { 18633 this.onMetaChange(a.metaData) 18634 } 18635 var m = this.meta, h = this.recordType, b = h.prototype.fields, l = b.items, i = b.length, j; 18636 var g = this.getRoot(a), e = g.length, d = e, k = true; 18637 if (m.totalProperty) { 18638 j = parseInt(this.getTotal(a), 10); 18639 if (!isNaN(j)) { 18640 d = j 18641 } 18642 } 18643 if (m.successProperty) {
18644 j = this.getSuccess(a); 18645 if (j === false || j === "false") { 18646 k = false 18647 } 18648 } 18649 return { 18650 success : k, 18651 records : this.extractData(g, true), 18652 totalRecords : d 18653 } 18654 }, 18655 buildExtractors : function() { 18656 if (this.ef) { 18657 return 18658 } 18659 var l = this.meta, h = this.recordType, e = h.prototype.fields, k = e.items, j = e.length; 18660 if (l.totalProperty) { 18661 this.getTotal = this.createAccessor(l.totalProperty) 18662 } 18663 if (l.successProperty) { 18664 this.getSuccess = this.createAccessor(l.successProperty) 18665 } 18666 if (l.messageProperty) { 18667 this.getMessage = this.createAccessor(l.messageProperty) 18668 } 18669 this.getRoot = l.root ? this.createAccessor(l.root) : function(g) { 18670 return g 18671 }; 18672 if (l.id || l.idProperty) { 18673 var d = this.createAccessor(l.id || l.idProperty); 18674 this.getId = function(i) { 18675 var g = d(i); 18676 return (g === undefined || g === "") ? null : g 18677 } 18678 } else { 18679 this.getId = function() { 18680 return null 18681 } 18682 } 18683 var c = []; 18684 for (var b = 0; b < j; b++) { 18685 e = k[b]; 18686 var a = (e.mapping !== undefined && e.mapping !== null) 18687 ? e.mapping 18688 : e.name; 18689 c.push(this.createAccessor(a)) 18690 } 18691 this.ef = c 18692 }, 18693 simpleAccess : function(b, a) { 18694 return b[a] 18695 }, 18696 createAccessor : function() { 18697 var a = /[\[\.]/; 18698 return function(c) { 18699 if (Ext.isEmpty(c)) { 18700 return Ext.emptyFn 18701 } 18702 if (Ext.isFunction(c)) { 18703 return c 18704 } 18705 var b = String(c).search(a); 18706 if (b >= 0) { 18707 return new Function("obj", "return obj" + (b > 0 ? "." : "") 18708 + c) 18709 } 18710 return function(d) { 18711 return d[c] 18712 } 18713 } 18714 }(), 18715 extractValues : function(h, d, a) { 18716 var g, c = {}; 18717 for (var e = 0; e < a; e++) { 18718 g = d[e]; 18719 var b = this.ef[e](h); 18720 c[g.name] = g.convert((b !== undefined) ? b : g.defaultValue, h) 18721 } 18722 return c 18723 } 18724}); 18725Ext.data.JsonReader.Error = Ext.extend(Ext.Error, { 18726 constructor : function(b, a) { 18727 this.arg = a; 18728 Ext.Error.call(this, b) 18729 }, 18730 name : "Ext.data.JsonReader" 18731 }); 18732Ext.apply(Ext.data.JsonReader.Error.prototype, { 18733 lang : { 18734 response : "An error occurred while json-decoding your server response", 18735 "successProperty-response" : 'Could not locate your "successProperty" in your server response. Please review your JsonReader config to ensure the config-property "successProperty" matches the property in your server-response. See the JsonReader docs.', 18736 "root-undefined-config" : 'Your JsonReader was configured without a "root" property. Please review your JsonReader config and make sure to define the root property. See the JsonReader docs.', 18737 "idProperty-undefined" : 'Your JsonReader was configured without an "idProperty" Please review your JsonReader configuration and ensure the "idProperty" is set (e.g.: "id"). See the JsonReader docs.', 18738 "root-empty" : 'Data was expected to be returned by the server in the "root" property of the response. Please review your JsonReader configuration to ensure the "root" property matches that returned in the server-response. See JsonReader docs.' 18739 } 18740}); 18741Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, { 18742 readRecords : function(r) { 18743 this.arrayData = r; 18744 var l = this.meta, d = l ? Ext.num(l.idIndex, l.id) : null, b = this.recordType, q = b.prototype.fields, z = [], e = true, g; 18745 var u = this.getRoot(r); 18746 for (var y = 0, A = u.length; y < A; y++) { 18747 var t = u[y], a = {}, p = ((d || d === 0) && t[d] !== undefined 18748 && t[d] !== "" ? t[d] : null); 18749 for (var x = 0, m = q.length; x < m; x++) { 18750 var B = q.items[x], w = B.mapping !== undefined 18751 && B.mapping !== null ? B.mapping : x; 18752 g = t[w] !== undefined ? t[w] : B.defaultValue; 18753 g = B.convert(g, t); 18754 a[B.name] = g 18755 } 18756 var c = new b(a, p); 18757 c.json = t; 18758 z[z.length] = c 18759 } 18760 var h = z.length; 18761 if (l.totalProperty) { 18762 g = parseInt(this.getTotal(r), 10); 18763 if (!isNaN(g)) { 18764 h = g 18765 } 18766 } 18767 if (l.successProperty) { 18768 g = this.getSuccess(r);
18769 if (g === false || g === "false") { 18770 e = false 18771 } 18772 } 18773 return { 18774 success : e, 18775 records : z, 18776 totalRecords : h 18777 } 18778 } 18779}); 18780Ext.data.ArrayStore = Ext.extend(Ext.data.Store, { 18781 constructor : function(a) { 18782 Ext.data.ArrayStore.superclass.constructor.call(this, Ext 18783 .apply(a, { 18784 reader : new Ext.data.ArrayReader(a) 18785 })) 18786 }, 18787 loadData : function(e, b) { 18788 if (this.expandData === true) { 18789 var d = []; 18790 for (var c = 0, a = e.length; c < a; c++) { 18791 d[d.length] = [e[c]] 18792 } 18793 e = d 18794 } 18795 Ext.data.ArrayStore.superclass.loadData.call(this, e, b) 18796 } 18797 }); 18798Ext.reg("arraystore", Ext.data.ArrayStore); 18799Ext.data.SimpleStore = Ext.data.ArrayStore; 18800Ext.reg("simplestore", Ext.data.SimpleStore); 18801Ext.data.JsonStore = Ext.extend(Ext.data.Store, { 18802 constructor : function(a) { 18803 Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply( 18804 a, { 18805 reader : new Ext.data.JsonReader(a) 18806 })) 18807 } 18808 }); 18809Ext.reg("jsonstore", Ext.data.JsonStore); 18810Ext.data.XmlWriter = function(a) { 18811 Ext.data.XmlWriter.superclass.constructor.apply(this, arguments); 18812 this.tpl = (typeof(this.tpl) === "string") ? new Ext.XTemplate(this.tpl) 18813 .compile() : this.tpl.compile() 18814}; 18815Ext.extend(Ext.data.XmlWriter, Ext.data.DataWriter, { 18816 documentRoot : "xrequest", 18817 forceDocumentRoot : false, 18818 root : "records", 18819 xmlVersion : "1.0", 18820 xmlEncoding : "ISO-8859-15", 18821 tpl : '<tpl for="."><\u003fxml version="{version}" encoding="{encoding}"\u003f><tpl if="documentRoot"><{documentRoot}><tpl for="baseParams"><tpl for="."><{name}>{value}</{name}></tpl></tpl></tpl><tpl if="records.length>1"><{root}></tpl><tpl for="records"><{parent.record}><tpl for="."><{name}>{value}</{name}></tpl></{parent.record}></tpl><tpl if="records.length>1"></{root}></tpl><tpl if="documentRoot"></{documentRoot}></tpl></tpl>', 18822 render : function(b, c, a) { 18823 c = this.toArray(c); 18824 b.xmlData = this.tpl.applyTemplate({ 18825 version : this.xmlVersion, 18826 encoding : this.xmlEncoding, 18827 documentRoot : (c.length > 0 || this.forceDocumentRoot === true) 18828 ? this.documentRoot 18829 : false, 18830 record : this.meta.record, 18831 root : this.root, 18832 baseParams : c, 18833 records : (Ext.isArray(a[0])) ? a : [a] 18834 }) 18835 }, 18836 createRecord : function(a) { 18837 return this.toArray(this.toHash(a)) 18838 }, 18839 updateRecord : function(a) { 18840 return this.toArray(this.toHash(a)) 18841 }, 18842 destroyRecord : function(b) { 18843 var a = {}; 18844 a[this.meta.idProperty] = b.id; 18845 return this.toArray(a) 18846 } 18847}); 18848Ext.data.XmlReader = function(a, b) { 18849 a = a || {}; 18850 Ext.applyIf(a, { 18851 idProperty : a.idProperty || a.idPath || a.id, 18852 successProperty : a.successProperty || a.success 18853 }); 18854 Ext.data.XmlReader.superclass.constructor.call(this, a, b || a.fields) 18855}; 18856Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, { 18857 read : function(a) { 18858 var b = a.responseXML; 18859 if (!b) { 18860 throw { 18861 message : "XmlReader.read: XML Document not available" 18862 } 18863 } 18864 return this.readRecords(b) 18865 }, 18866 readRecords : function(d) { 18867 this.xmlData = d; 18868 var a = d.documentElement || d, c = Ext.DomQuery, g = 0, e = true; 18869 if (this.meta.totalProperty) { 18870 g = this.getTotal(a, 0) 18871 } 18872 if (this.meta.successProperty) { 18873 e = this.getSuccess(a) 18874 } 18875 var b = this.extractData(c.select(this.meta.record, a), true); 18876 return { 18877 success : e, 18878 records : b, 18879 totalRecords : g || b.length 18880 } 18881 }, 18882 readResponse : function(g, b) { 18883 var e = Ext.DomQuery, h = b.responseXML, a = h.documentElement || h; 18884 var c = new Ext.data.Response({ 18885 action : g, 18886 success : this.getSuccess(a), 18887 message : this.getMessage(a), 18888 data : this.extractData(e.select(this.meta.record, a) 18889 || e.select(this.meta.root, a), false), 18890 raw : h 18891 }); 18892 if (Ext.isEmpty(c.success)) { 18893 throw new Ext.data.DataReader.Error("successProperty-response", 18894 this.meta.successProperty) 18895 } 18896 if (g === Ext.data.Api.actions.create) { 18897 var d = Ext.isDefined(c.data); 18898 if (d && Ext.isEmpty(c.data)) { 18899 throw new Ext.data.JsonReader.Error("root-empty", 18900 this.meta.root) 18901 } else { 18902 if (!d) { 18903 throw new Ext.data.JsonReader.Error( 18904 "root-undefined-response", this.meta.root) 18905 } 18906 } 18907 } 18908 return c 18909 }, 18910 getSuccess : function() { 18911 return true 18912 }, 18913 buildExtractors : function() { 18914 if (this.ef) { 18915 return 18916 } 18917 var l = this.meta, h = this.recordType, e = h.prototype.fields, k = e.items, j = e.length; 18918 if (l.totalProperty) { 18919 this.getTotal = this.createAccessor(l.totalProperty) 18920 } 18921 if (l.successProperty) {
18922 this.getSuccess = this.createAccessor(l.successProperty) 18923 } 18924 if (l.messageProperty) { 18925 this.getMessage = this.createAccessor(l.messageProperty) 18926 } 18927 this.getRoot = function(g) { 18928 return (!Ext.isEmpty(g[this.meta.record])) 18929 ? g[this.meta.record] 18930 : g[this.meta.root] 18931 }; 18932 if (l.idPath || l.idProperty) { 18933 var d = this.createAccessor(l.idPath || l.idProperty); 18934 this.getId = function(g) { 18935 var i = d(g) || g.id; 18936 return (i === undefined || i === "") ? null : i 18937 } 18938 } else { 18939 this.getId = function() { 18940 return null 18941 } 18942 } 18943 var c = []; 18944 for (var b = 0; b < j; b++) { 18945 e = k[b]; 18946 var a = (e.mapping !== undefined && e.mapping !== null) 18947 ? e.mapping 18948 : e.name; 18949 c.push(this.createAccessor(a)) 18950 } 18951 this.ef = c 18952 }, 18953 createAccessor : function() { 18954 var a = Ext.DomQuery; 18955 return function(b) { 18956 if (Ext.isFunction(b)) { 18957 return b 18958 } 18959 switch (b) { 18960 case this.meta.totalProperty : 18961 return function(c, d) { 18962 return a.selectNumber(b, c, d) 18963 }; 18964 break; 18965 case this.meta.successProperty : 18966 return function(d, e) { 18967 var c = a.selectValue(b, d, true); 18968 var g = c !== false && c !== "false"; 18969 return g 18970 }; 18971 break; 18972 default : 18973 return function(c, d) { 18974 return a.selectValue(b, c, d) 18975 }; 18976 break 18977 } 18978 } 18979 }(), 18980 extractValues : function(h, d, a) { 18981 var g, c = {}; 18982 for (var e = 0; e < a; e++) { 18983 g = d[e]; 18984 var b = this.ef[e](h); 18985 c[g.name] = g.convert((b !== undefined) ? b : g.defaultValue, h) 18986 } 18987 return c 18988 } 18989}); 18990Ext.data.XmlStore = Ext.extend(Ext.data.Store, { 18991 constructor : function(a) { 18992 Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply( 18993 a, { 18994 reader : new Ext.data.XmlReader(a) 18995 })) 18996 } 18997 }); 18998Ext.reg("xmlstore", Ext.data.XmlStore); 18999Ext.data.GroupingStore = Ext.extend(Ext.data.Store, { 19000 constructor : function(d) { 19001 d = d || {}; 19002 this.hasMultiSort = true; 19003 this.multiSortInfo = this.multiSortInfo || { 19004 sorters : [] 19005 }; 19006 var e = this.multiSortInfo.sorters, c = d.groupField || this.groupField, b = d.sortInfo 19007 || this.sortInfo, a = d.groupDir || this.groupDir; 19008 if (c) { 19009 e.push({ 19010 field : c, 19011 direction : a 19012 }) 19013 } 19014 if (b) { 19015 e.push(b) 19016 } 19017 Ext.data.GroupingStore.superclass.constructor.call(this, d); 19018 this.addEvents("groupchange"); 19019 this.applyGroupField() 19020 }, 19021 remoteGroup : false, 19022 groupOnSort : false, 19023 groupDir : "ASC", 19024 clearGrouping : function() { 19025 this.groupField = false; 19026 if (this.remoteGroup) { 19027 if (this.baseParams) { 19028 delete this.baseParams.groupBy; 19029 delete this.baseParams.groupDir 19030 } 19031 var a = this.lastOptions; 19032 if (a && a.params) { 19033 delete a.params.groupBy; 19034 delete a.params.groupDir 19035 } 19036 this.reload() 19037 } else { 19038 this.sort(); 19039 this.fireEvent("datachanged", this) 19040 } 19041 }, 19042 groupBy : function(e, a, d) { 19043 d = d 19044 ? (String(d).toUpperCase() == "DESC" ? "DESC" : "ASC") 19045 : this.groupDir; 19046 if (this.groupField == e && this.groupDir == d && !a) { 19047 return 19048 } 19049 var c = this.multiSortInfo.sorters; 19050 if (c.length > 0 && c[0].field == this.groupField) { 19051 c.shift() 19052 } 19053 this.groupField = e; 19054 this.groupDir = d; 19055 this.applyGroupField(); 19056 var b = function() { 19057 this.fireEvent("groupchange", this, this.getGroupState()) 19058 }; 19059 if (this.groupOnSort) { 19060 this.sort(e, d); 19061 b.call(this); 19062 return 19063 } 19064 if (this.remoteGroup) { 19065 this.on("load", b, this, { 19066 single : true 19067 }); 19068 this.reload() 19069 } else { 19070 this.sort(c); 19071 b.call(this) 19072 } 19073 }, 19074 sort : function(h, c) { 19075 if (this.remoteSort) { 19076 return Ext.data.GroupingStore.superclass.sort.call(this, h, c) 19077 } 19078 var g = []; 19079 if (Ext.isArray(arguments[0])) { 19080 g = arguments[0] 19081 } else { 19082 if (h == undefined) { 19083 g = this.sortInfo ? [this.sortInfo] : [] 19084 } else { 19085 var e = this.fields.get(h); 19086 if (!e) { 19087 return false 19088 } 19089 var b = e.name, a = this.sortInfo || null, d = this.sortToggle 19090 ? this.sortToggle[b] 19091 : null; 19092 if (!c) { 19093 if (a && a.field == b) { 19094 c = (this.sortToggle[b] || "ASC").toggle("ASC", "DESC") 19095 } else { 19096 c = e.sortDir 19097 } 19098 } 19099 this.sortToggle[b] = c; 19100 this.sortInfo = { 19101 field : b, 19102 direction : c 19103 }; 19104 g = [this.sortInfo] 19105 } 19106 } 19107 if (this.groupField) { 19108 g.unshift({ 19109 direction : this.groupDir, 19110 field : this.groupField 19111 }) 19112 } 19113 return this.multiSort.call(this, g, c) 19114 }, 19115 applyGroupField : function() { 19116 if (this.remoteGroup) { 19117 if (!this.baseParams) { 19118 this.baseParams = {} 19119 } 19120 Ext.apply(this.baseParams, { 19121 groupBy : this.groupField, 19122 groupDir : this.groupDir 19123 });
19124 var a = this.lastOptions; 19125 if (a && a.params) { 19126 a.params.groupDir = this.groupDir; 19127 delete a.params.groupBy 19128 } 19129 } 19130 }, 19131 applyGrouping : function(a) { 19132 if (this.groupField !== false) { 19133 this.groupBy(this.groupField, true, this.groupDir); 19134 return true 19135 } else { 19136 if (a === true) { 19137 this.fireEvent("datachanged", this) 19138 } 19139 return false 19140 } 19141 }, 19142 getGroupState : function() { 19143 return this.groupOnSort && this.groupField !== false ? (this.sortInfo 19144 ? this.sortInfo.field 19145 : undefined) : this.groupField 19146 } 19147}); 19148Ext.reg("groupingstore", Ext.data.GroupingStore); 19149Ext.data.DirectProxy = function(a) { 19150 Ext.apply(this, a); 19151 if (typeof this.paramOrder == "string") { 19152 this.paramOrder = this.paramOrder.split(/[\s,|]/) 19153 } 19154 Ext.data.DirectProxy.superclass.constructor.call(this, a) 19155}; 19156Ext.extend(Ext.data.DirectProxy, Ext.data.DataProxy, { 19157 paramOrder : undefined, 19158 paramsAsHash : true, 19159 directFn : undefined, 19160 doRequest : function(b, c, a, e, k, l, n) { 19161 var j = [], h = this.api[b] || this.directFn; 19162 switch (b) { 19163 case Ext.data.Api.actions.create : 19164 j.push(a.jsonData); 19165 break; 19166 case Ext.data.Api.actions.read : 19167 if (h.directCfg.method.len > 0) { 19168 if (this.paramOrder) { 19169 for (var d = 0, g = this.paramOrder.length; d < g; d++) { 19170 j.push(a[this.paramOrder[d]]) 19171 } 19172 } else { 19173 if (this.paramsAsHash) { 19174 j.push(a) 19175 } 19176 } 19177 } 19178 break; 19179 case Ext.data.Api.actions.update : 19180 j.push(a.jsonData); 19181 break; 19182 case Ext.data.Api.actions.destroy : 19183 j.push(a.jsonData); 19184 break 19185 } 19186 var m = { 19187 params : a || {}, 19188 request : { 19189 callback : k, 19190 scope : l, 19191 arg : n 19192 }, 19193 reader : e 19194 }; 19195 j.push(this.createCallback(b, c, m), this); 19196 h.apply(window, j) 19197 }, 19198 createCallback : function(d, a, b) { 19199 var c = this; 19200 return function(e, g) { 19201 if (!g.status) { 19202 if (d === Ext.data.Api.actions.read) { 19203 c.fireEvent("loadexception", c, b, g, null) 19204 } 19205 c.fireEvent("exception", c, "remote", d, b, g, null); 19206 b.request.callback.call(b.request.scope, null, b.request.arg, 19207 false); 19208 return 19209 } 19210 if (d === Ext.data.Api.actions.read) { 19211 c.onRead(d, b, e, g) 19212 } else { 19213 c.onWrite(d, b, e, g, a) 19214 } 19215 } 19216 }, 19217 onRead : function(g, e, a, d) { 19218 var b; 19219 try { 19220 b = e.reader.readRecords(a) 19221 } catch (c) { 19222 this.fireEvent("loadexception", this, e, d, c); 19223 this.fireEvent("exception", this, "response", g, e, d, c); 19224 e.request.callback 19225 .call(e.request.scope, null, e.request.arg, false); 19226 return 19227 } 19228 this.fireEvent("load", this, d, e.request.arg); 19229 e.request.callback.call(e.request.scope, b, e.request.arg, true) 19230 }, 19231 onWrite : function(g, d, a, c, b) { 19232 var e = d.reader.extractData(d.reader.getRoot(a), false); 19233 var h = d.reader.getSuccess(a); 19234 h = (h !== false); 19235 if (h) { 19236 this.fireEvent("write", this, g, e, c, b, d.request.arg) 19237 } else { 19238 this.fireEvent("exception", this, "remote", g, d, a, b) 19239 } 19240 d.request.callback.call(d.request.scope, e, c, h) 19241 } 19242}); 19243Ext.data.DirectStore = Ext.extend(Ext.data.Store, { 19244 constructor : function(a) { 19245 var b = Ext.apply({}, { 19246 batchTransactions : false 19247 }, a); 19248 Ext.data.DirectStore.superclass.constructor.call(this, Ext.apply(b, { 19249 proxy : Ext.isDefined(b.proxy) 19250 ? b.proxy 19251 : new Ext.data.DirectProxy(Ext 19252 .copyTo({}, b, 19253 "paramOrder,paramsAsHash,directFn,api")), 19254 reader : (!Ext.isDefined(b.reader) && b.fields) 19255 ? new Ext.data.JsonReader( 19256 Ext 19257 .copyTo({}, b, 19258 "totalProperty,root,idProperty"), 19259 b.fields) 19260 : b.reader 19261 })) 19262 } 19263}); 19264Ext.reg("directstore", Ext.data.DirectStore); 19265Ext.Direct = Ext.extend(Ext.util.Observable, { 19266 exceptions : { 19267 TRANSPORT : "xhr", 19268 PARSE : "parse", 19269 LOGIN : "login", 19270 SERVER : "exception" 19271 }, 19272 constructor : function() { 19273 this.addEvents("event", "exception"); 19274 this.transactions = {}; 19275 this.providers = {} 19276 }, 19277 addProvider : function(e) { 19278 var c = arguments; 19279 if (c.length > 1) { 19280 for (var d = 0, b = c.length; d < b; d++) { 19281 this.addProvider(c[d]) 19282 } 19283 return 19284 } 19285 if (!e.events) { 19286 e = new Ext.Direct.PROVIDERS[e.type](e) 19287 } 19288 e.id = e.id || Ext.id(); 19289 this.providers[e.id] = e; 19290 e.on("data", this.onProviderData, this); 19291 e.on("exception", this.onProviderException, this); 19292 if (!e.isConnected()) { 19293 e.connect() 19294 } 19295 return e 19296 }, 19297 getProvider : function(a) { 19298 return this.providers[a] 19299 }, 19300 removeProvider : function(b) { 19301 var a = b.id ? b : this.providers[b]; 19302 a.un("data", this.onProviderData, this); 19303 a.un("exception", this.onProviderException, this); 19304 delete this.providers[a.id]; 19305 return a 19306 }, 19307 addTransaction : function(a) { 19308 this.transactions[a.tid] = a; 19309 return a 19310 }, 19311 removeTransaction : function(a) { 19312 delete this.transactions[a.tid || a]; 19313 return a 19314 }, 19315 getTransaction : function(a) { 19316 return this.transactions[a.tid || a] 19317 }, 19318 onProviderData : function(d, c) { 19319 if (Ext.isArray(c)) { 19320 for (var b = 0, a = c.length; b < a; b++) { 19321 this.onProviderData(d, c[b]) 19322 } 19323 return 19324 } 19325 if (c.name && c.name != "event" && c.name != "exception") { 19326 this.fireEvent(c.name, c) 19327 } else {
19328 if (c.type == "exception") { 19329 this.fireEvent("exception", c) 19330 } 19331 } 19332 this.fireEvent("event", c, d) 19333 }, 19334 createEvent : function(a, b) { 19335 return new Ext.Direct.eventTypes[a.type](Ext.apply(a, b)) 19336 } 19337 }); 19338Ext.Direct = new Ext.Direct(); 19339Ext.Direct.TID = 1; 19340Ext.Direct.PROVIDERS = {}; 19341Ext.Direct.Transaction = function(a) { 19342 Ext.apply(this, a); 19343 this.tid = ++Ext.Direct.TID; 19344 this.retryCount = 0 19345}; 19346Ext.Direct.Transaction.prototype = { 19347 send : function() { 19348 this.provider.queueTransaction(this) 19349 }, 19350 retry : function() { 19351 this.retryCount++; 19352 this.send() 19353 }, 19354 getProvider : function() { 19355 return this.provider 19356 } 19357}; 19358Ext.Direct.Event = function(a) { 19359 Ext.apply(this, a) 19360}; 19361Ext.Direct.Event.prototype = { 19362 status : true, 19363 getData : function() { 19364 return this.data 19365 } 19366}; 19367Ext.Direct.RemotingEvent = Ext.extend(Ext.Direct.Event, { 19368 type : "rpc", 19369 getTransaction : function() { 19370 return this.transaction || Ext.Direct.getTransaction(this.tid) 19371 } 19372 }); 19373Ext.Direct.ExceptionEvent = Ext.extend(Ext.Direct.RemotingEvent, { 19374 status : false, 19375 type : "exception" 19376 }); 19377Ext.Direct.eventTypes = { 19378 rpc : Ext.Direct.RemotingEvent, 19379 event : Ext.Direct.Event, 19380 exception : Ext.Direct.ExceptionEvent 19381}; 19382Ext.direct.Provider = Ext.extend(Ext.util.Observable, { 19383 priority : 1, 19384 constructor : function(a) { 19385 Ext.apply(this, a); 19386 this.addEvents("connect", "disconnect", "data", "exception"); 19387 Ext.direct.Provider.superclass.constructor.call(this, a) 19388 }, 19389 isConnected : function() { 19390 return false 19391 }, 19392 connect : Ext.emptyFn, 19393 disconnect : Ext.emptyFn 19394 }); 19395Ext.direct.JsonProvider = Ext.extend(Ext.direct.Provider, { 19396 parseResponse : function(a) { 19397 if (!Ext.isEmpty(a.responseText)) { 19398 if (typeof a.responseText == "object") { 19399 return a.responseText 19400 } 19401 return Ext.decode(a.responseText) 19402 } 19403 return null 19404 }, 19405 getEvents : function(j) { 19406 var g = null; 19407 try { 19408 g = this.parseResponse(j) 19409 } catch (h) { 19410 var d = new Ext.Direct.ExceptionEvent({ 19411 data : h, 19412 xhr : j, 19413 code : Ext.Direct.exceptions.PARSE, 19414 message : "Error parsing json response: \n\n " 19415 + g 19416 }); 19417 return [d] 19418 } 19419 var c = []; 19420 if (Ext.isArray(g)) { 19421 for (var b = 0, a = g.length; b < a; b++) { 19422 c.push(Ext.Direct.createEvent(g[b])) 19423 } 19424 } else { 19425 c.push(Ext.Direct.createEvent(g)) 19426 } 19427 return c 19428 } 19429 }); 19430Ext.direct.PollingProvider = Ext.extend(Ext.direct.JsonProvider, { 19431 priority : 3, 19432 interval : 3000, 19433 constructor : function(a) { 19434 Ext.direct.PollingProvider.superclass.constructor.call(this, a); 19435 this.addEvents("beforepoll", "poll") 19436 }, 19437 isConnected : function() { 19438 return !!this.pollTask 19439 }, 19440 connect : function() { 19441 if (this.url && !this.pollTask) { 19442 this.pollTask = Ext.TaskMgr.start({ 19443 run : function() { 19444 if (this.fireEvent("beforepoll", this) !== false) { 19445 if (typeof this.url == "function") { 19446 this.url(this.baseParams) 19447 } else { 19448 Ext.Ajax.request({ 19449 url : this.url, 19450 callback : this.onData, 19451 scope : this, 19452 params : this.baseParams 19453 }) 19454 } 19455 } 19456 }, 19457 interval : this.interval, 19458 scope : this 19459 }); 19460 this.fireEvent("connect", this) 19461 } else { 19462 if (!this.url) { 19463 throw "Error initializing PollingProvider, no url configured." 19464 } 19465 } 19466 }, 19467 disconnect : function() { 19468 if (this.pollTask) { 19469 Ext.TaskMgr.stop(this.pollTask); 19470 delete this.pollTask; 19471 this.fireEvent("disconnect", this) 19472 } 19473 }, 19474 onData : function(d, j, h) { 19475 if (j) { 19476 var c = this.getEvents(h); 19477 for (var b = 0, a = c.length; b < a; b++) { 19478 var g = c[b]; 19479 this.fireEvent("data", this, g) 19480 } 19481 } else { 19482 var g = new Ext.Direct.ExceptionEvent({ 19483 data : g, 19484 code : Ext.Direct.exceptions.TRANSPORT, 19485 message : "Unable to connect to the server.", 19486 xhr : h 19487 });
19488 this.fireEvent("data", this, g) 19489 } 19490 } 19491 }); 19492Ext.Direct.PROVIDERS.polling = Ext.direct.PollingProvider; 19493Ext.direct.RemotingProvider = Ext.extend(Ext.direct.JsonProvider, { 19494 enableBuffer : 10, 19495 maxRetries : 1, 19496 timeout : undefined, 19497 constructor : function(a) { 19498 Ext.direct.RemotingProvider.superclass.constructor.call(this, a); 19499 this.addEvents("beforecall", "call"); 19500 this.namespace = (Ext.isString(this.namespace)) ? Ext 19501 .ns(this.namespace) : this.namespace || window; 19502 this.transactions = {}; 19503 this.callBuffer = [] 19504 }, 19505 initAPI : function() { 19506 var h = this.actions; 19507 for (var j in h) { 19508 var d = this.namespace[j] || (this.namespace[j] = {}), e = h[j]; 19509 for (var g = 0, b = e.length; g < b; g++) { 19510 var a = e[g]; 19511 d[a.name] = this.createMethod(j, a) 19512 } 19513 } 19514 }, 19515 isConnected : function() { 19516 return !!this.connected 19517 }, 19518 connect : function() { 19519 if (this.url) { 19520 this.initAPI(); 19521 this.connected = true; 19522 this.fireEvent("connect", this) 19523 } else { 19524 if (!this.url) { 19525 throw "Error initializing RemotingProvider, no url configured." 19526 } 19527 } 19528 }, 19529 disconnect : function() { 19530 if (this.connected) { 19531 this.connected = false; 19532 this.fireEvent("disconnect", this) 19533 } 19534 }, 19535 onData : function(a, h, j) { 19536 if (h) { 19537 var k = this.getEvents(j); 19538 for (var b = 0, c = k.length; b < c; b++) { 19539 var d = k[b], l = this.getTransaction(d); 19540 this.fireEvent("data", this, d); 19541 if (l) { 19542 this.doCallback(l, d, true); 19543 Ext.Direct.removeTransaction(l) 19544 } 19545 } 19546 } else { 19547 var g = [].concat(a.ts); 19548 for (var b = 0, c = g.length; b < c; b++) { 19549 var l = this.getTransaction(g[b]); 19550 if (l && l.retryCount < this.maxRetries) { 19551 l.retry() 19552 } else { 19553 var d = new Ext.Direct.ExceptionEvent({ 19554 data : d, 19555 transaction : l, 19556 code : Ext.Direct.exceptions.TRANSPORT, 19557 message : "Unable to connect to the server.", 19558 xhr : j 19559 }); 19560 this.fireEvent("data", this, d); 19561 if (l) { 19562 this.doCallback(l, d, false); 19563 Ext.Direct.removeTransaction(l) 19564 } 19565 } 19566 } 19567 } 19568 }, 19569 getCallData : function(a) { 19570 return { 19571 action : a.action, 19572 method : a.method, 19573 data : a.data, 19574 type : "rpc", 19575 tid : a.tid 19576 } 19577 }, 19578 doSend : function(d) { 19579 var g = { 19580 url : this.url, 19581 callback : this.onData, 19582 scope : this, 19583 ts : d, 19584 timeout : this.timeout 19585 }, b; 19586 if (Ext.isArray(d)) { 19587 b = []; 19588 for (var c = 0, a = d.length; c < a; c++) { 19589 b.push(this.getCallData(d[c])) 19590 } 19591 } else { 19592 b = this.getCallData(d) 19593 } 19594 if (this.enableUrlEncode) { 19595 var e = {}; 19596 e[Ext.isString(this.enableUrlEncode) 19597 ? this.enableUrlEncode 19598 : "data"] = Ext.encode(b); 19599 g.params = e 19600 } else { 19601 g.jsonData = b 19602 } 19603 Ext.Ajax.request(g) 19604 }, 19605 combineAndSend : function() { 19606 var a = this.callBuffer.length; 19607 if (a > 0) { 19608 this.doSend(a == 1 ? this.callBuffer[0] : this.callBuffer); 19609 this.callBuffer = [] 19610 } 19611 }, 19612 queueTransaction : function(a) { 19613 if (a.form) { 19614 this.processForm(a); 19615 return 19616 } 19617 this.callBuffer.push(a); 19618 if (this.enableBuffer) { 19619 if (!this.callTask) { 19620 this.callTask = new Ext.util.DelayedTask(this.combineAndSend, 19621 this) 19622 } 19623 this.callTask.delay(Ext.isNumber(this.enableBuffer) 19624 ? this.enableBuffer 19625 : 10) 19626 } else { 19627 this.combineAndSend() 19628 } 19629 }, 19630 doCall : function(i, a, b) { 19631 var h = null, e = b[a.len], g = b[a.len + 1]; 19632 if (a.len !== 0) { 19633 h = b.slice(0, a.len) 19634 } 19635 var d = new Ext.Direct.Transaction({ 19636 provider : this, 19637 args : b, 19638 action : i, 19639 method : a.name, 19640 data : h, 19641 cb : g && Ext.isFunction(e) ? e.createDelegate(g) : e 19642 }); 19643 if (this.fireEvent("beforecall", this, d, a) !== false) { 19644 Ext.Direct.addTransaction(d); 19645 this.queueTransaction(d); 19646 this.fireEvent("call", this, d, a) 19647 } 19648 }, 19649 doForm : function(j, b, g, i, e) { 19650 var d = new Ext.Direct.Transaction({ 19651 provider : this, 19652 action : j, 19653 method : b.name, 19654 args : [g, i, e], 19655 cb : e && Ext.isFunction(i) ? i.createDelegate(e) : i, 19656 isForm : true 19657 }); 19658 if (this.fireEvent("beforecall", this, d, b) !== false) { 19659 Ext.Direct.addTransaction(d); 19660 var a = String(g.getAttribute("enctype")).toLowerCase() == "multipart/form-data", h = { 19661 extTID : d.tid, 19662 extAction : j, 19663 extMethod : b.name, 19664 extType : "rpc", 19665 extUpload : String(a) 19666 };
19667 Ext.apply(d, { 19668 form : Ext.getDom(g), 19669 isUpload : a, 19670 params : i && Ext.isObject(i.params) ? Ext.apply(h, 19671 i.params) : h 19672 }); 19673 this.fireEvent("call", this, d, b); 19674 this.processForm(d) 19675 } 19676 }, 19677 processForm : function(a) { 19678 Ext.Ajax.request({ 19679 url : this.url, 19680 params : a.params, 19681 callback : this.onData, 19682 scope : this, 19683 form : a.form, 19684 isUpload : a.isUpload, 19685 ts : a 19686 }) 19687 }, 19688 createMethod : function(d, a) { 19689 var b; 19690 if (!a.formHandler) { 19691 b = function() { 19692 this.doCall(d, a, Array.prototype.slice.call(arguments, 0)) 19693 }.createDelegate(this) 19694 } else { 19695 b = function(e, g, c) { 19696 this.doForm(d, a, e, g, c) 19697 }.createDelegate(this) 19698 } 19699 b.directCfg = { 19700 action : d, 19701 method : a 19702 }; 19703 return b 19704 }, 19705 getTransaction : function(a) { 19706 return a && a.tid ? Ext.Direct.getTransaction(a.tid) : null 19707 }, 19708 doCallback : function(c, g) { 19709 var d = g.status ? "success" : "failure"; 19710 if (c && c.cb) { 19711 var b = c.cb, a = Ext.isDefined(g.result) ? g.result : g.data; 19712 if (Ext.isFunction(b)) { 19713 b(a, g) 19714 } else { 19715 Ext.callback(b[d], b.scope, [a, g]); 19716 Ext.callback(b.callback, b.scope, [a, g]) 19717 } 19718 } 19719 } 19720}); 19721Ext.Direct.PROVIDERS.remoting = Ext.direct.RemotingProvider; 19722Ext.Resizable = Ext.extend(Ext.util.Observable, { 19723 constructor : function(d, e) { 19724 this.el = Ext.get(d); 19725 if (e && e.wrap) { 19726 e.resizeChild = this.el; 19727 this.el = this.el.wrap(typeof e.wrap == "object" ? e.wrap : { 19728 cls : "xresizable-wrap" 19729 }); 19730 this.el.id = this.el.dom.id = e.resizeChild.id + "-rzwrap"; 19731 this.el.setStyle("overflow", "hidden"); 19732 this.el.setPositioning(e.resizeChild.getPositioning()); 19733 e.resizeChild.clearPositioning(); 19734 if (!e.width || !e.height) { 19735 var g = e.resizeChild.getSize(); 19736 this.el.setSize(g.width, g.height) 19737 } 19738 if (e.pinned && !e.adjustments) { 19739 e.adjustments = "auto" 19740 } 19741 } 19742 this.proxy = this.el.createProxy({ 19743 tag : "div", 19744 cls : "x-resizable-proxy", 19745 id : this.el.id + "-rzproxy" 19746 }, Ext.getBody()); 19747 this.proxy.unselectable(); 19748 this.proxy.enableDisplayMode("block"); 19749 Ext.apply(this, e); 19750 if (this.pinned) { 19751 this.disableTrackOver = true; 19752 this.el.addClass("x-resizable-pinned") 19753 } 19754 var k = this.el.getStyle("position"); 19755 if (k != "absolute" && k != "fixed") { 19756 this.el.setStyle("position", "relative") 19757 } 19758 if (!this.handles) { 19759 this.handles = "s,e,se"; 19760 if (this.multiDirectional) { 19761 this.handles += ",n,w" 19762 } 19763 } 19764 if (this.handles == "all") { 19765 this.handles = "n s e w ne nw se sw" 19766 } 19767 var o = this.handles.split(/\s*?[,;]\s*?| /); 19768 var c = Ext.Resizable.positions; 19769 for (var j = 0, l = o.length; j < l; j++) { 19770 if (o[j] && c[o[j]]) { 19771 var n = c[o[j]]; 19772 this[n] = new Ext.Resizable.Handle(this, n, 19773 this.disableTrackOver, this.transparent, this.handleCls) 19774 } 19775 } 19776 this.corner = this.southeast; 19777 if (this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1) { 19778 this.updateBox = true 19779 } 19780 this.activeHandle = null; 19781 if (this.resizeChild) { 19782 if (typeof this.resizeChild == "boolean") { 19783 this.resizeChild = Ext.get(this.el.dom.firstChild, true) 19784 } else { 19785 this.resizeChild = Ext.get(this.resizeChild, true) 19786 } 19787 } 19788 if (this.adjustments == "auto") { 19789 var b = this.resizeChild; 19790 var m = this.west, h = this.east, a = this.north, o = this.south; 19791 if (b && (m || a)) { 19792 b.position("relative"); 19793 b.setLeft(m ? m.el.getWidth() : 0); 19794 b.setTop(a ? a.el.getHeight() : 0) 19795 } 19796 this.adjustments = [ 19797 (h ? -h.el.getWidth() : 0) + (m ? -m.el.getWidth() : 0), 19798 (a ? -a.el.getHeight() : 0) + (o ? -o.el.getHeight() : 0) 19799 - 1] 19800 } 19801 if (this.draggable) { 19802 this.dd = this.dynamic ? this.el.initDD(null) : this.el 19803 .initDDProxy(null, { 19804 dragElId : this.proxy.id 19805 }); 19806 this.dd.setHandleElId(this.resizeChild 19807 ? this.resizeChild.id 19808 : this.el.id); 19809 if (this.constrainTo) { 19810 this.dd.constrainTo(this.constrainTo) 19811 } 19812 } 19813 this.addEvents("beforeresize", "resize"); 19814 if (this.width !== null && this.height !== null) { 19815 this.resizeTo(this.width, this.height) 19816 } else { 19817 this.updateChildSize() 19818 } 19819 if (Ext.isIE) { 19820 this.el.dom.style.zoom = 1 19821 } 19822 Ext.Resizable.superclass.constructor.call(this) 19823 }, 19824 adjustments : [0, 0], 19825 animate : false, 19826 disableTrackOver : false, 19827 draggable : false, 19828 duration : 0.35, 19829 dynamic : false, 19830 easing : "easeOutStrong", 19831 enabled : true, 19832 handles : false, 19833 multiDirectional : false, 19834 height : null, 19835 width : null, 19836 heightIncrement : 0, 19837 widthIncrement : 0, 19838 minHeight : 5, 19839 minWidth : 5, 19840 maxHeight : 10000, 19841 maxWidth : 10000, 19842 minX : 0, 19843 minY : 0, 19844 pinned : false, 19845 preserveRatio : false, 19846 resizeChild : false, 19847 transparent : false, 19848 resizeTo : function(b, a) { 19849 this.el.setSize(b, a); 19850 this.updateChildSize(); 19851 this.fireEvent("resize", this, b, a, null) 19852 }, 19853 startSizing : function(c, b) { 19854 this.fireEvent("beforeresize", this, c); 19855 if (this.enabled) { 19856 if (!this.overlay) {
19857 this.overlay = this.el.createProxy({ 19858 tag : "div", 19859 cls : "x-resizable-overlay", 19860 html : " " 19861 }, Ext.getBody()); 19862 this.overlay.unselectable(); 19863 this.overlay.enableDisplayMode("block"); 19864 this.overlay.on({ 19865 scope : this, 19866 mousemove : this.onMouseMove, 19867 mouseup : this.onMouseUp 19868 }) 19869 } 19870 this.overlay.setStyle("cursor", b.el.getStyle("cursor")); 19871 this.resizing = true; 19872 this.startBox = this.el.getBox(); 19873 this.startPoint = c.getXY(); 19874 this.offsets = [ 19875 (this.startBox.x + this.startBox.width) 19876 - this.startPoint[0], 19877 (this.startBox.y + this.startBox.height) 19878 - this.startPoint[1]]; 19879 this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom 19880 .getViewHeight(true)); 19881 this.overlay.show(); 19882 if (this.constrainTo) { 19883 var a = Ext.get(this.constrainTo); 19884 this.resizeRegion = a.getRegion().adjust(a.getFrameWidth("t"), 19885 a.getFrameWidth("l"), -a.getFrameWidth("b"), 19886 -a.getFrameWidth("r")) 19887 } 19888 this.proxy.setStyle("visibility", "hidden"); 19889 this.proxy.show(); 19890 this.proxy.setBox(this.startBox); 19891 if (!this.dynamic) { 19892 this.proxy.setStyle("visibility", "visible") 19893 } 19894 } 19895 }, 19896 onMouseDown : function(a, b) { 19897 if (this.enabled) { 19898 b.stopEvent(); 19899 this.activeHandle = a; 19900 this.startSizing(b, a) 19901 } 19902 }, 19903 onMouseUp : function(b) { 19904 this.activeHandle = null; 19905 var a = this.resizeElement(); 19906 this.resizing = false; 19907 this.handleOut(); 19908 this.overlay.hide(); 19909 this.proxy.hide(); 19910 this.fireEvent("resize", this, a.width, a.height, b) 19911 }, 19912 updateChildSize : function() { 19913 if (this.resizeChild) { 19914 var d = this.el; 19915 var e = this.resizeChild; 19916 var c = this.adjustments; 19917 if (d.dom.offsetWidth) { 19918 var a = d.getSize(true); 19919 e.setSize(a.width + c[0], a.height + c[1]) 19920 } 19921 if (Ext.isIE) { 19922 setTimeout(function() { 19923 if (d.dom.offsetWidth) { 19924 var g = d.getSize(true); 19925 e.setSize(g.width + c[0], g.height + c[1]) 19926 } 19927 }, 10) 19928 } 19929 } 19930 }, 19931 snap : function(c, e, b) { 19932 if (!e || !c) { 19933 return c 19934 } 19935 var d = c; 19936 var a = c % e; 19937 if (a > 0) { 19938 if (a > (e / 2)) { 19939 d = c + (e - a) 19940 } else { 19941 d = c - a 19942 } 19943 } 19944 return Math.max(b, d) 19945 }, 19946 resizeElement : function() { 19947 var a = this.proxy.getBox(); 19948 if (this.updateBox) { 19949 this.el.setBox(a, false, this.animate, this.duration, null, 19950 this.easing) 19951 } else { 19952 this.el.setSize(a.width, a.height, this.animate, this.duration, 19953 null, this.easing) 19954 } 19955 this.updateChildSize(); 19956 if (!this.dynamic) { 19957 this.proxy.hide() 19958 } 19959 if (this.draggable && this.constrainTo) { 19960 this.dd.resetConstraints(); 19961 this.dd.constrainTo(this.constrainTo) 19962 } 19963 return a 19964 }, 19965 constrain : function(b, c, a, d) { 19966 if (b - c < a) { 19967 c = b - a 19968 } else { 19969 if (b - c > d) { 19970 c = b - d 19971 } 19972 } 19973 return c 19974 }, 19975 onMouseMove : function(z) { 19976 if (this.enabled && this.activeHandle) { 19977 try { 19978 if (this.resizeRegion 19979 && !this.resizeRegion.contains(z.getPoint())) { 19980 return 19981 } 19982 var t = this.curSize || this.startBox, l = this.startBox.x, k = this.startBox.y, c = l, b = k, m = t.width, u = t.height, d = m, o = u, n = this.minWidth, A = this.minHeight, s = this.maxWidth, D = this.maxHeight, i = this.widthIncrement, a = this.heightIncrement, B = z 19983 .getXY(), r = -(this.startPoint[0] - Math.max( 19984 this.minX, B[0])), p = -(this.startPoint[1] - Math.max( 19985 this.minY, B[1])), j = this.activeHandle.position, E, g; 19986 switch (j) { 19987 case "east" : 19988 m += r; 19989 m = Math.min(Math.max(n, m), s); 19990 break; 19991 case "south" : 19992 u += p; 19993 u = Math.min(Math.max(A, u), D); 19994 break; 19995 case "southeast" : 19996 m += r; 19997 u += p; 19998 m = Math.min(Math.max(n, m), s); 19999 u = Math.min(Math.max(A, u), D); 20000 break; 20001 case "north" : 20002 p = this.constrain(u, p, A, D); 20003 k += p; 20004 u -= p; 20005 break; 20006 case "west" : 20007 r = this.constrain(m, r, n, s); 20008 l += r; 20009 m -= r; 20010 break; 20011 case "northeast" : 20012 m += r; 20013 m = Math.min(Math.max(n, m), s); 20014 p = this.constrain(u, p, A, D); 20015 k += p; 20016 u -= p; 20017 break; 20018 case "northwest" : 20019 r = this.constrain(m, r, n, s); 20020 p = this.constrain(u, p, A, D); 20021 k += p; 20022 u -= p; 20023 l += r; 20024 m -= r; 20025 break; 20026 case "southwest" : 20027 r = this.constrain(m, r, n, s); 20028 u += p; 20029 u = Math.min(Math.max(A, u), D); 20030 l += r; 20031 m -= r; 20032 break 20033 } 20034 var q = this.snap(m, i, n); 20035 var C = this.snap(u, a, A); 20036 if (q != m || C != u) { 20037 switch (j) { 20038 case "northeast" : 20039 k -= C - u; 20040 break; 20041 case "north" : 20042 k -= C - u; 20043 break; 20044 case "southwest" : 20045 l -= q - m; 20046 break; 20047 case "west" : 20048 l -= q - m; 20049 break; 20050 case "northwest" : 20051 l -= q - m; 20052 k -= C - u; 20053 break 20054 } 20055 m = q; 20056 u = C 20057 } 20058 if (this.preserveRatio) { 20059 switch (j) { 20060 case "southeast" : 20061 case "east" : 20062 u = o * (m / d); 20063 u = Math.min(Math.max(A, u), D); 20064 m = d * (u / o); 20065 break; 20066 case "south" : 20067 m = d * (u / o); 20068 m = Math.min(Math.max(n, m), s); 20069 u = o * (m / d); 20070 break; 20071 case "northeast" : 20072 m = d * (u / o); 20073 m = Math.min(Math.max(n, m), s); 20074 u = o * (m / d); 20075 break; 20076 case "north" : 20077 E = m; 20078 m = d * (u / o); 20079 m = Math.min(Math.max(n, m), s); 20080 u = o * (m / d); 20081 l += (E - m) / 2; 20082 break; 20083 case "southwest" : 20084 u = o * (m / d); 20085 u = Math.min(Math.max(A, u), D); 20086 E = m; 20087 m = d * (u / o); 20088 l += E - m; 20089 break; 20090 case "west" : 20091 g = u; 20092 u = o * (m / d); 20093 u = Math.min(Math.max(A, u), D); 20094 k += (g - u) / 2; 20095 E = m; 20096 m = d * (u / o); 20097 l += E - m; 20098 break; 20099 case "northwest" : 20100 E = m; 20101 g = u; 20102 u = o * (m / d); 20103 u = Math.min(Math.max(A, u), D); 20104 m = d * (u / o); 20105 k += g - u; 20106 l += E - m; 20107 break 20108 } 20109 } 20110 this.proxy.setBounds(l, k, m, u); 20111 if (this.dynamic) { 20112 this.resizeElement() 20113 } 20114 } catch (v) { 20115 } 20116 } 20117 }, 20118 handleOver : function() { 20119 if (this.enabled) { 20120 this.el.addClass("x-resizable-over") 20121 } 20122 }, 20123 handleOut : function() { 20124 if (!this.resizing) { 20125 this.el.removeClass("x-resizable-over") 20126 } 20127 }, 20128 getEl : function() { 20129 return this.el 20130 }, 20131 getResizeChild : function() { 20132 return this.resizeChild 20133 }, 20134 destroy : function(b) { 20135 Ext.destroy(this.dd, this.overlay, this.proxy);
20136 this.overlay = null; 20137 this.proxy = null; 20138 var c = Ext.Resizable.positions; 20139 for (var a in c) { 20140 if (typeof c[a] != "function" && this[c[a]]) { 20141 this[c[a]].destroy() 20142 } 20143 } 20144 if (b) { 20145 this.el.update(""); 20146 Ext.destroy(this.el); 20147 this.el = null 20148 } 20149 this.purgeListeners() 20150 }, 20151 syncHandleHeight : function() { 20152 var a = this.el.getHeight(true); 20153 if (this.west) { 20154 this.west.el.setHeight(a) 20155 } 20156 if (this.east) { 20157 this.east.el.setHeight(a) 20158 } 20159 } 20160}); 20161Ext.Resizable.positions = { 20162 n : "north", 20163 s : "south", 20164 e : "east", 20165 w : "west", 20166 se : "southeast", 20167 sw : "southwest", 20168 nw : "northwest", 20169 ne : "northeast" 20170}; 20171Ext.Resizable.Handle = Ext.extend(Object, { 20172 constructor : function(d, g, c, e, a) { 20173 if (!this.tpl) { 20174 var b = Ext.DomHelper.createTemplate({ 20175 tag : "div", 20176 cls : "x-resizable-handle x-resizable-handle-{0}" 20177 }); 20178 b.compile(); 20179 Ext.Resizable.Handle.prototype.tpl = b 20180 } 20181 this.position = g; 20182 this.rz = d; 20183 this.el = this.tpl.append(d.el.dom, [this.position], true); 20184 this.el.unselectable(); 20185 if (e) { 20186 this.el.setOpacity(0) 20187 } 20188 if (!Ext.isEmpty(a)) { 20189 this.el.addClass(a) 20190 } 20191 this.el.on("mousedown", this.onMouseDown, this); 20192 if (!c) { 20193 this.el.on({ 20194 scope : this, 20195 mouseover : this.onMouseOver, 20196 mouseout : this.onMouseOut 20197 }) 20198 } 20199 }, 20200 afterResize : function(a) { 20201 }, 20202 onMouseDown : function(a) { 20203 this.rz.onMouseDown(this, a) 20204 }, 20205 onMouseOver : function(a) { 20206 this.rz.handleOver(this, a) 20207 }, 20208 onMouseOut : function(a) { 20209 this.rz.handleOut(this, a) 20210 }, 20211 destroy : function() { 20212 Ext.destroy(this.el); 20213 this.el = null 20214 } 20215 }); 20216Ext.Window = Ext.extend(Ext.Panel, { 20217 baseCls : "x-window", 20218 resizable : false, 20219 draggable : false, 20220 closable : true, 20221 closeAction : "close", 20222 constrain : false, 20223 constrainHeader : false, 20224 plain : false, 20225 minimizable : false, 20226 maximizable : false, 20227 minHeight : 100, 20228 minWidth : 200, 20229 expandOnShow : true, 20230 showAnimDuration : 0.25, 20231 hideAnimDuration : 0.25, 20232 collapsible : false, 20233 initHidden : undefined, 20234 hidden : true, 20235 elements : "header,body", 20236 frame : true, 20237 floating : true, 20238 initComponent : function() { 20239 this.initTools(); 20240 Ext.Window.superclass.initComponent.call(this); 20241 this.addEvents("resize", "maximize", "minimize", "restore"); 20242 if (Ext.isDefined(this.initHidden)) { 20243 this.hidden = this.initHidden 20244 } 20245 if (this.hidden === false) { 20246 this.hidden = true; 20247 this.show() 20248 } 20249 }, 20250 getState : function() { 20251 return Ext.apply(Ext.Window.superclass.getState.call(this) 20252 || {}, this.getBox(true)) 20253 }, 20254 onRender : function(b, a) { 20255 Ext.Window.superclass.onRender.call(this, b, a); 20256 if (this.plain) { 20257 this.el.addClass("x-window-plain") 20258 } 20259 this.focusEl = this.el.createChild({ 20260 tag : "a", 20261 href : "#", 20262 cls : "x-dlg-focus", 20263 tabIndex : "-1", 20264 html : " " 20265 }); 20266 this.focusEl.swallowEvent("click", true); 20267 this.proxy = this.el.createProxy("x-window-proxy"); 20268 this.proxy.enableDisplayMode("block"); 20269 if (this.modal) { 20270 this.mask = this.container.createChild({ 20271 cls : "ext-el-mask" 20272 }, this.el.dom); 20273 this.mask.enableDisplayMode("block"); 20274 this.mask.hide(); 20275 this.mon(this.mask, "click", this.focus, this) 20276 } 20277 if (this.maximizable) { 20278 this 20279 .mon(this.header, "dblclick", this.toggleMaximize, 20280 this) 20281 } 20282 }, 20283 initEvents : function() { 20284 Ext.Window.superclass.initEvents.call(this); 20285 if (this.animateTarget) { 20286 this.setAnimateTarget(this.animateTarget) 20287 } 20288 if (this.resizable) { 20289 this.resizer = new Ext.Resizable(this.el, { 20290 minWidth : this.minWidth, 20291 minHeight : this.minHeight, 20292 handles : this.resizeHandles || "all", 20293 pinned : true, 20294 resizeElement : this.resizerAction, 20295 handleCls : "x-window-handle" 20296 });
20297 this.resizer.window = this; 20298 this.mon(this.resizer, "beforeresize", this.beforeResize, 20299 this) 20300 } 20301 if (this.draggable) { 20302 this.header.addClass("x-window-draggable") 20303 } 20304 this.mon(this.el, "mousedown", this.toFront, this); 20305 this.manager = this.manager || Ext.WindowMgr; 20306 this.manager.register(this); 20307 if (this.maximized) { 20308 this.maximized = false; 20309 this.maximize() 20310 } 20311 if (this.closable) { 20312 var a = this.getKeyMap(); 20313 a.on(27, this.onEsc, this); 20314 a.disable() 20315 } 20316 }, 20317 initDraggable : function() { 20318 this.dd = new Ext.Window.DD(this) 20319 }, 20320 onEsc : function(a, b) { 20321 if (this.activeGhost) { 20322 this.unghost() 20323 } 20324 b.stopEvent(); 20325 this[this.closeAction]() 20326 }, 20327 beforeDestroy : function() { 20328 if (this.rendered) { 20329 this.hide(); 20330 this.clearAnchor(); 20331 Ext.destroy(this.focusEl, this.resizer, this.dd, 20332 this.proxy, this.mask) 20333 } 20334 Ext.Window.superclass.beforeDestroy.call(this) 20335 }, 20336 onDestroy : function() { 20337 if (this.manager) { 20338 this.manager.unregister(this) 20339 } 20340 Ext.Window.superclass.onDestroy.call(this) 20341 }, 20342 initTools : function() { 20343 if (this.minimizable) { 20344 this.addTool({ 20345 id : "minimize", 20346 handler : this.minimize 20347 .createDelegate(this, []) 20348 }) 20349 } 20350 if (this.maximizable) { 20351 this.addTool({ 20352 id : "maximize", 20353 handler : this.maximize 20354 .createDelegate(this, []) 20355 }); 20356 this.addTool({ 20357 id : "restore", 20358 handler : this.restore.createDelegate(this, []), 20359 hidden : true 20360 }) 20361 } 20362 if (this.closable) { 20363 this.addTool({ 20364 id : "close", 20365 handler : this[this.closeAction] 20366 .createDelegate(this, []) 20367 }) 20368 } 20369 }, 20370 resizerAction : function() { 20371 var a = this.proxy.getBox(); 20372 this.proxy.hide(); 20373 this.window.handleResize(a); 20374 return a 20375 }, 20376 beforeResize : function() { 20377 this.resizer.minHeight = Math.max(this.minHeight, this 20378 .getFrameHeight() 20379 + 40); 20380 this.resizer.minWidth = Math.max(this.minWidth, this 20381 .getFrameWidth() 20382 + 40); 20383 this.resizeBox = this.el.getBox() 20384 }, 20385 updateHandles : function() { 20386 if (Ext.isIE && this.resizer) { 20387 this.resizer.syncHandleHeight(); 20388 this.el.repaint() 20389 } 20390 }, 20391 handleResize : function(b) { 20392 var a = this.resizeBox; 20393 if (a.x != b.x || a.y != b.y) { 20394 this.updateBox(b) 20395 } else { 20396 this.setSize(b); 20397 if (Ext.isIE6 && Ext.isStrict) { 20398 this.doLayout() 20399 } 20400 } 20401 this.focus(); 20402 this.updateHandles(); 20403 this.saveState() 20404 }, 20405 focus : function() { 20406 var e = this.focusEl, a = this.defaultButton, c = typeof a, d, b; 20407 if (Ext.isDefined(a)) { 20408 if (Ext.isNumber(a) && this.fbar) { 20409 e = this.fbar.items.get(a) 20410 } else { 20411 if (Ext.isString(a)) { 20412 e = Ext.getCmp(a) 20413 } else { 20414 e = a 20415 } 20416 } 20417 d = e.getEl(); 20418 b = Ext.getDom(this.container); 20419 if (d && b) { 20420 if (b != document.body 20421 && !Ext.lib.Region.getRegion(b) 20422 .contains(Ext.lib.Region 20423 .getRegion(d.dom))) { 20424 return 20425 } 20426 } 20427 } 20428 e = e || this.focusEl; 20429 e.focus.defer(10, e) 20430 }, 20431 setAnimateTarget : function(a) { 20432 a = Ext.get(a); 20433 this.animateTarget = a 20434 }, 20435 beforeShow : function() { 20436 delete this.el.lastXY; 20437 delete this.el.lastLT; 20438 if (this.x === undefined || this.y === undefined) { 20439 var a = this.el.getAlignToXY(this.container, "c-c"); 20440 var b = this.el.translatePoints(a[0], a[1]); 20441 this.x = this.x === undefined ? b.left : this.x; 20442 this.y = this.y === undefined ? b.top : this.y 20443 } 20444 this.el.setLeftTop(this.x, this.y); 20445 if (this.expandOnShow) { 20446 this.expand(false) 20447 } 20448 if (this.modal) { 20449 Ext.getBody().addClass("x-body-masked"); 20450 this.mask.setSize(Ext.lib.Dom.getViewWidth(true), 20451 Ext.lib.Dom.getViewHeight(true)); 20452 this.mask.show() 20453 } 20454 }, 20455 show : function(c, a, b) { 20456 if (!this.rendered) { 20457 this.render(Ext.getBody()) 20458 } 20459 if (this.hidden === false) { 20460 this.toFront(); 20461 return this 20462 } 20463 if (this.fireEvent("beforeshow", this) === false) { 20464 return this 20465 } 20466 if (a) { 20467 this.on("show", a, b, { 20468 single : true 20469 }) 20470 } 20471 this.hidden = false; 20472 if (Ext.isDefined(c)) { 20473 this.setAnimateTarget(c) 20474 } 20475 this.beforeShow(); 20476 if (this.animateTarget) { 20477 this.animShow() 20478 } else { 20479 this.afterShow() 20480 } 20481 return this 20482 }, 20483 afterShow : function(b) { 20484 if (this.isDestroyed) { 20485 return false 20486 } 20487 this.proxy.hide(); 20488 this.el.setStyle("display", "block"); 20489 this.el.show(); 20490 if (this.maximized) { 20491 this.fitContainer() 20492 } 20493 if (Ext.isMac && Ext.isGecko2) { 20494 this.cascade(this.setAutoScroll) 20495 } 20496 if (this.monitorResize || this.modal || this.constrain 20497 || this.constrainHeader) { 20498 Ext.EventManager.onWindowResize(this.onWindowResize, this) 20499 } 20500 this.doConstrain(); 20501 this.doLayout(); 20502 if (this.keyMap) { 20503 this.keyMap.enable() 20504 } 20505 this.toFront(); 20506 this.updateHandles(); 20507 if (b && (Ext.isIE || Ext.isWebKit)) {
20508 var a = this.getSize(); 20509 this.onResize(a.width, a.height) 20510 } 20511 this.onShow(); 20512 this.fireEvent("show", this) 20513 }, 20514 animShow : function() { 20515 this.proxy.show(); 20516 this.proxy.setBox(this.animateTarget.getBox()); 20517 this.proxy.setOpacity(0); 20518 var a = this.getBox(); 20519 this.el.setStyle("display", "none"); 20520 this.proxy.shift(Ext.apply(a, { 20521 callback : this.afterShow.createDelegate(this, 20522 [true], false), 20523 scope : this, 20524 easing : "easeNone", 20525 duration : this.showAnimDuration, 20526 opacity : 0.5 20527 })) 20528 }, 20529 hide : function(c, a, b) { 20530 if (this.hidden || this.fireEvent("beforehide", this) === false) { 20531 return this 20532 } 20533 if (a) { 20534 this.on("hide", a, b, { 20535 single : true 20536 }) 20537 } 20538 this.hidden = true; 20539 if (c !== undefined) { 20540 this.setAnimateTarget(c) 20541 } 20542 if (this.modal) { 20543 this.mask.hide(); 20544 Ext.getBody().removeClass("x-body-masked") 20545 } 20546 if (this.animateTarget) { 20547 this.animHide() 20548 } else { 20549 this.el.hide(); 20550 this.afterHide() 20551 } 20552 return this 20553 }, 20554 afterHide : function() { 20555 this.proxy.hide(); 20556 if (this.monitorResize || this.modal || this.constrain 20557 || this.constrainHeader) { 20558 Ext.EventManager.removeResizeListener(this.onWindowResize, 20559 this) 20560 } 20561 if (this.keyMap) { 20562 this.keyMap.disable() 20563 } 20564 this.onHide(); 20565 this.fireEvent("hide", this) 20566 }, 20567 animHide : function() { 20568 this.proxy.setOpacity(0.5); 20569 this.proxy.show(); 20570 var a = this.getBox(false); 20571 this.proxy.setBox(a); 20572 this.el.hide(); 20573 this.proxy.shift(Ext.apply(this.animateTarget.getBox(), { 20574 callback : this.afterHide, 20575 scope : this, 20576 duration : this.hideAnimDuration, 20577 easing : "easeNone", 20578 opacity : 0 20579 })) 20580 }, 20581 onShow : Ext.emptyFn, 20582 onHide : Ext.emptyFn, 20583 onWindowResize : function() { 20584 if (this.maximized) { 20585 this.fitContainer() 20586 } 20587 if (this.modal) { 20588 this.mask.setSize("100%", "100%"); 20589 var a = this.mask.dom.offsetHeight; 20590 this.mask.setSize(Ext.lib.Dom.getViewWidth(true), 20591 Ext.lib.Dom.getViewHeight(true)) 20592 } 20593 this.doConstrain() 20594 }, 20595 doConstrain : function() { 20596 if (this.constrain || this.constrainHeader) { 20597 var b; 20598 if (this.constrain) { 20599 b = { 20600 right : this.el.shadowOffset, 20601 left : this.el.shadowOffset, 20602 bottom : this.el.shadowOffset 20603 } 20604 } else { 20605 var a = this.getSize(); 20606 b = { 20607 right : -(a.width - 100), 20608 bottom : -(a.height - 25 + this.el 20609 .getConstrainOffset()) 20610 } 20611 } 20612 var c = this.el.getConstrainToXY(this.container, true, b); 20613 if (c) { 20614 this.setPosition(c[0], c[1]) 20615 } 20616 } 20617 }, 20618 ghost : function(a) { 20619 var c = this.createGhost(a); 20620 var b = this.getBox(true); 20621 c.setLeftTop(b.x, b.y); 20622 c.setWidth(b.width); 20623 this.el.hide(); 20624 this.activeGhost = c; 20625 return c 20626 }, 20627 unghost : function(b, a) { 20628 if (!this.activeGhost) { 20629 return 20630 } 20631 if (b !== false) { 20632 this.el.show(); 20633 this.focus.defer(10, this); 20634 if (Ext.isMac && Ext.isGecko2) { 20635 this.cascade(this.setAutoScroll) 20636 } 20637 } 20638 if (a !== false) { 20639 this.setPosition(this.activeGhost.getLeft(true), 20640 this.activeGhost.getTop(true)) 20641 } 20642 this.activeGhost.hide(); 20643 this.activeGhost.remove(); 20644 delete this.activeGhost 20645 }, 20646 minimize : function() { 20647 this.fireEvent("minimize", this); 20648 return this 20649 }, 20650 close : function() { 20651 if (this.fireEvent("beforeclose", this) !== false) { 20652 if (this.hidden) { 20653 this.doClose() 20654 } else { 20655 this.hide(null, this.doClose, this) 20656 } 20657 } 20658 }, 20659 doClose : function() { 20660 this.fireEvent("close", this); 20661 this.destroy() 20662 }, 20663 maximize : function() { 20664 if (!this.maximized) { 20665 this.expand(false); 20666 this.restoreSize = this.getSize();
20667 this.restorePos = this.getPosition(true); 20668 if (this.maximizable) { 20669 this.tools.maximize.hide(); 20670 this.tools.restore.show() 20671 } 20672 this.maximized = true; 20673 this.el.disableShadow(); 20674 if (this.dd) { 20675 this.dd.lock() 20676 } 20677 if (this.collapsible) { 20678 this.tools.toggle.hide() 20679 } 20680 this.el.addClass("x-window-maximized"); 20681 this.container.addClass("x-window-maximized-ct"); 20682 this.setPosition(0, 0); 20683 this.fitContainer(); 20684 this.fireEvent("maximize", this) 20685 } 20686 return this 20687 }, 20688 restore : function() { 20689 if (this.maximized) { 20690 var a = this.tools; 20691 this.el.removeClass("x-window-maximized"); 20692 if (a.restore) { 20693 a.restore.hide() 20694 } 20695 if (a.maximize) { 20696 a.maximize.show() 20697 } 20698 this.setPosition(this.restorePos[0], this.restorePos[1]); 20699 this.setSize(this.restoreSize.width, 20700 this.restoreSize.height); 20701 delete this.restorePos; 20702 delete this.restoreSize; 20703 this.maximized = false; 20704 this.el.enableShadow(true); 20705 if (this.dd) { 20706 this.dd.unlock() 20707 } 20708 if (this.collapsible && a.toggle) { 20709 a.toggle.show() 20710 } 20711 this.container.removeClass("x-window-maximized-ct"); 20712 this.doConstrain(); 20713 this.fireEvent("restore", this) 20714 } 20715 return this 20716 }, 20717 toggleMaximize : function() { 20718 return this[this.maximized ? "restore" : "maximize"]() 20719 }, 20720 fitContainer : function() { 20721 var a = this.container.getViewSize(false); 20722 this.setSize(a.width, a.height) 20723 }, 20724 setZIndex : function(a) { 20725 if (this.modal) { 20726 this.mask.setStyle("z-index", a) 20727 } 20728 this.el.setZIndex(++a); 20729 a += 5; 20730 if (this.resizer) { 20731 this.resizer.proxy.setStyle("z-index", ++a) 20732 } 20733 this.lastZIndex = a 20734 }, 20735 alignTo : function(b, a, c) { 20736 var d = this.el.getAlignToXY(b, a, c); 20737 this.setPagePosition(d[0], d[1]); 20738 return this 20739 }, 20740 anchorTo : function(c, e, d, b) { 20741 this.clearAnchor(); 20742 this.anchorTarget = { 20743 el : c, 20744 alignment : e, 20745 offsets : d 20746 }; 20747 Ext.EventManager.onWindowResize(this.doAnchor, this); 20748 var a = typeof b; 20749 if (a != "undefined") { 20750 Ext.EventManager.on(window, "scroll", this.doAnchor, this, 20751 { 20752 buffer : a == "number" ? b : 50 20753 }) 20754 } 20755 return this.doAnchor() 20756 }, 20757 doAnchor : function() { 20758 var a = this.anchorTarget; 20759 this.alignTo(a.el, a.alignment, a.offsets); 20760 return this 20761 }, 20762 clearAnchor : function() { 20763 if (this.anchorTarget) { 20764 Ext.EventManager.removeResizeListener(this.doAnchor, this); 20765 Ext.EventManager.un(window, "scroll", this.doAnchor, this); 20766 delete this.anchorTarget 20767 } 20768 return this 20769 }, 20770 toFront : function(a) { 20771 if (this.manager.bringToFront(this)) { 20772 if (!a || !a.getTarget().focus) { 20773 this.focus() 20774 } 20775 } 20776 return this 20777 }, 20778 setActive : function(a) { 20779 if (a) { 20780 if (!this.maximized) { 20781 this.el.enableShadow(true) 20782 } 20783 this.fireEvent("activate", this) 20784 } else { 20785 this.el.disableShadow(); 20786 this.fireEvent("deactivate", this) 20787 } 20788 }, 20789 toBack : function() { 20790 this.manager.sendToBack(this); 20791 return this 20792 }, 20793 center : function() { 20794 var a = this.el.getAlignToXY(this.container, "c-c"); 20795 this.setPagePosition(a[0], a[1]); 20796 return this 20797 } 20798 }); 20799Ext.reg("window", Ext.Window); 20800Ext.Window.DD = Ext.extend(Ext.dd.DD, { 20801 constructor : function(a) { 20802 this.win = a; 20803 Ext.Window.DD.superclass.constructor.call(this, a.el.id, 20804 "WindowDD-" + a.id); 20805 this.setHandleElId(a.header.id); 20806 this.scroll = false 20807 }, 20808 moveOnly : true, 20809 headerOffsets : [100, 25], 20810 startDrag : function() { 20811 var a = this.win; 20812 this.proxy = a.ghost(a.initialConfig.cls); 20813 if (a.constrain !== false) { 20814 var c = a.el.shadowOffset; 20815 this.constrainTo(a.container, { 20816 right : c, 20817 left : c, 20818 bottom : c 20819 }) 20820 } else { 20821 if (a.constrainHeader !== false) { 20822 var b = this.proxy.getSize(); 20823 this.constrainTo(a.container, { 20824 right : -(b.width - this.headerOffsets[0]), 20825 bottom : -(b.height - this.headerOffsets[1]) 20826 }) 20827 } 20828 } 20829 }, 20830 b4Drag : Ext.emptyFn, 20831 onDrag : function(a) { 20832 this.alignElWithMouse(this.proxy, a.getPageX(), a.getPageY()) 20833 }, 20834 endDrag : function(a) { 20835 this.win.unghost(); 20836 this.win.saveState() 20837 } 20838 }); 20839Ext.WindowGroup = function() { 20840 var g = {}; 20841 var d = []; 20842 var e = null; 20843 var c = function(j, i) { 20844 return (!j._lastAccess || j._lastAccess < i._lastAccess) ? -1 : 1 20845 }; 20846 var h = function() { 20847 var l = d, j = l.length; 20848 if (j > 0) { 20849 l.sort(c); 20850 var k = l[0].manager.zseed; 20851 for (var m = 0; m < j; m++) { 20852 var n = l[m]; 20853 if (n && !n.hidden) { 20854 n.setZIndex(k + (m * 10)) 20855 } 20856 } 20857 } 20858 a() 20859 }; 20860 var b = function(i) { 20861 if (i != e) { 20862 if (e) { 20863 e.setActive(false) 20864 } 20865 e = i; 20866 if (i) { 20867 i.setActive(true) 20868 } 20869 } 20870 }; 20871 var a = function() { 20872 for (var j = d.length - 1; j >= 0; --j) { 20873 if (!d[j].hidden) { 20874 b(d[j]); 20875 return 20876 } 20877 } 20878 b(null) 20879 }; 20880 return { 20881 zseed : 9000, 20882 register : function(i) { 20883 if (i.manager) { 20884 i.manager.unregister(i) 20885 } 20886 i.manager = this; 20887 g[i.id] = i; 20888 d.push(i); 20889 i.on("hide", a) 20890 }, 20891 unregister : function(i) { 20892 delete i.manager; 20893 delete g[i.id]; 20894 i.un("hide", a); 20895 d.remove(i) 20896 }, 20897 get : function(i) { 20898 return typeof i == "object" ? i : g[i] 20899 }, 20900 bringToFront : function(i) { 20901 i = this.get(i); 20902 if (i != e) { 20903 i._lastAccess = new Date().getTime(); 20904 h(); 20905 return true 20906 } 20907 return false 20908 }, 20909 sendToBack : function(i) { 20910 i = this.get(i); 20911 i._lastAccess = -(new Date().getTime()); 20912 h(); 20913 return i 20914 }, 20915 hideAll : function() { 20916 for (var i in g) { 20917 if (g[i] && typeof g[i] != "function" && g[i].isVisible()) { 20918 g[i].hide() 20919 } 20920 } 20921 }, 20922 getActive : function() { 20923 return e 20924 }, 20925 getBy : function(l, k) { 20926 var m = []; 20927 for (var j = d.length - 1; j >= 0; --j) { 20928 var n = d[j]; 20929 if (l.call(k || n, n) !== false) { 20930 m.push(n) 20931 } 20932 } 20933 return m 20934 }, 20935 each : function(j, i) { 20936 for (var k in g) { 20937 if (g[k] && typeof g[k] != "function") { 20938 if (j.call(i || g[k], g[k]) === false) { 20939 return 20940 } 20941 } 20942 } 20943 } 20944 } 20945}; 20946Ext.WindowMgr = new Ext.WindowGroup(); 20947Ext.MessageBox = function() { 20948 var u, b, q, t, h, l, s, a, n, p, j, g, r, v, o, i = "", d = "", m = ["ok", 20949 "yes", "no", "cancel"]; 20950 var c = function(x) { 20951 r[x].blur(); 20952 if (u.isVisible()) { 20953 u.hide(); 20954 w(); 20955 Ext.callback(b.fn, b.scope || window, [x, v.dom.value, b], 1) 20956 } 20957 }; 20958 var w = function() { 20959 if (b && b.cls) { 20960 u.el.removeClass(b.cls) 20961 } 20962 n.reset() 20963 }; 20964 var e = function(z, x, y) { 20965 if (b && b.closable !== false) { 20966 u.hide(); 20967 w() 20968 } 20969 if (y) { 20970 y.stopEvent() 20971 } 20972 }; 20973 var k = function(x) { 20974 var z = 0, y; 20975 if (!x) { 20976 Ext.each(m, function(A) { 20977 r[A].hide() 20978 });
20979 return z 20980 } 20981 u.footer.dom.style.display = ""; 20982 Ext.iterate(r, function(A, B) { 20983 y = x[A]; 20984 if (y) { 20985 B.show(); 20986 B.setText(Ext.isString(y) 20987 ? y 20988 : Ext.MessageBox.buttonText[A]); 20989 z += B.getEl().getWidth() + 15 20990 } else { 20991 B.hide() 20992 } 20993 }); 20994 return z 20995 }; 20996 return { 20997 getDialog : function(x) { 20998 if (!u) { 20999 var z = []; 21000 r = {}; 21001 Ext.each(m, function(A) { 21002 z.push(r[A] = new Ext.Button({ 21003 text : this.buttonText[A], 21004// ctCls : A == 'ok' ? 'r3-xtoolbar-color-blue' : '', 21005 handler : c.createCallback(A), 21006 hideMode : "offsets" 21007 })) 21008 }, this); 21009 u = new Ext.Window({ 21010 autoCreate : true, 21011 title : x, 21012 resizable : false, 21013 constrain : true, 21014 constrainHeader : true, 21015 minimizable : false, 21016 maximizable : false, 21017 stateful : false, 21018 modal : true, 21019 shim : true, 21020 buttonAlign : "center", 21021 width : 400, 21022 height : 100, 21023 minHeight : 80, 21024 plain : true, 21025 footer : true, 21026 closable : true, 21027 bodyCssClass : 'ext-msg-window-body', 21028 close : function() { 21029 if (b && b.buttons && b.buttons.no && !b.buttons.cancel) { 21030 c("no") 21031 } else { 21032 c("cancel") 21033 } 21034 }, 21035 fbar : new Ext.Toolbar({ 21036 items : z, 21037 enableOverflow : false 21038 }) 21039 }); 21040 u.render(document.body); 21041 u.getEl().addClass("x-window-dlg"); 21042 q = u.mask; 21043 h = u.body.createChild({ 21044 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>' 21045 }); 21046 j = Ext.get(h.dom.firstChild); 21047 var y = h.dom.childNodes[1]; 21048 l = Ext.get(y.firstChild); 21049 s = Ext.get(y.childNodes[2].firstChild); 21050 s.enableDisplayMode(); 21051 s.addKeyListener([10, 13], function() { 21052 if (u.isVisible() && b && b.buttons) { 21053 if (b.buttons.ok) { 21054 c("ok") 21055 } else { 21056 if (b.buttons.yes) { 21057 c("yes") 21058 } 21059 } 21060 } 21061 }); 21062 a = Ext.get(y.childNodes[2].childNodes[1]); 21063 a.enableDisplayMode(); 21064 n = new Ext.ProgressBar({ 21065 renderTo : h 21066 }); 21067 h.createChild({ 21068 cls : "x-clear" 21069 }) 21070 } 21071 return u 21072 }, 21073 updateText : function(A) { 21074 if (!u.isVisible() && !b.width) { 21075 u.setSize(this.maxWidth, 100) 21076 } 21077 l.update(A ? A + " " : " "); 21078 var y = d != "" ? (j.getWidth() + j.getMargins("lr")) : 0, C = l 21079 .getWidth() 21080 + l.getMargins("lr"), z = u.getFrameWidth("lr"), B = u.body 21081 .getFrameWidth("lr"), x; 21082 x = Math.max(Math.min(b.width || y + C + z + B, b.maxWidth 21083 || this.maxWidth), Math.max(b.minWidth 21084 || this.minWidth, o || 0)); 21085 if (b.prompt === true) { 21086 v.setWidth(x - y - z - B) 21087 } 21088 if (b.progress === true || b.wait === true) { 21089 n.setSize(x - y - z - B) 21090 } 21091 if (Ext.isIE && x == o) { 21092 x += 4 21093 } 21094 l.update(A || " "); 21095 u.setSize(x, "auto").center(); 21096 return this 21097 }, 21098 updateProgress : function(y, x, z) { 21099 n.updateProgress(y, x); 21100 if (z) { 21101 this.updateText(z) 21102 } 21103 return this 21104 }, 21105 isVisible : function() { 21106 return u && u.isVisible() 21107 }, 21108 hide : function() { 21109 var x = u ? u.activeGhost : null; 21110 if (this.isVisible() || x) { 21111 u.hide(); 21112 w(); 21113 if (x) { 21114 u.unghost(false, false) 21115 } 21116 } 21117 return this 21118 }, 21119 show : function(A) { 21120 if (this.isVisible()) { 21121 this.hide() 21122 } 21123 b = A; 21124 var B = this.getDialog(b.title || " "); 21125 B.setTitle(b.title || " "); 21126 var x = (b.closable !== false && b.progress !== true && b.wait !== true); 21127 B.tools.close.setDisplayed(x); 21128 v = s; 21129 21130 b.prompt = b.prompt || (b.multiline ? true : false); 21131 if (b.prompt) { 21132 if (b.multiline) { 21133 s.hide(); 21134 a.show(); 21135 a.setHeight(Ext.isNumber(b.multiline) 21136 ? b.multiline 21137 : this.defaultTextHeight); 21138 v = a 21139 } else { 21140 s.show(); 21141 a.hide() 21142 } 21143 } else { 21144 s.hide(); 21145 a.hide() 21146 } 21147 v.dom.value = b.value || ""; 21148 if (b.prompt) { 21149 B.focusEl = v 21150 } else { 21151 var z = b.buttons; 21152 var y = null; 21153 if (z && z.ok) { 21154 y = r.ok 21155 } else { 21156 if (z && z.yes) { 21157 y = r.yes 21158 } 21159 } 21160 if (y) { 21161 B.focusEl = y 21162 } 21163 } 21164 if (Ext.isDefined(b.iconCls)) { 21165 B.setIconClass(b.iconCls) 21166 } 21167 this.setIcon(Ext.isDefined(b.icon) ? b.icon : i); 21168 o = k(b.buttons); 21169 n.setVisible(b.progress === true || b.wait === true); 21170 this.updateProgress(0, b.progressText); 21171 this.updateText(b.msg); 21172 if (b.cls) { 21173 B.el.addClass(b.cls) 21174 } 21175 B.proxyDrag = b.proxyDrag === true; 21176 B.modal = b.modal !== false; 21177 B.mask = b.modal !== false ? q : false; 21178 if (!B.isVisible()) { 21179 document.body.appendChild(u.el.dom); 21180 B.setAnimateTarget(b.animEl); 21181 B.on("show", function() { 21182 if (x === true) { 21183 B.keyMap.enable() 21184 } else { 21185 B.keyMap.disable() 21186 } 21187 }, this, { 21188 single : true 21189 });
21190 B.show(b.animEl) 21191 } 21192 if (b.wait === true) { 21193 n.wait(b.waitConfig) 21194 } 21195 return this 21196 }, 21197 setIcon : function(x) { 21198 if (!u) { 21199 i = x; 21200 return 21201 } 21202 i = undefined; 21203 if (x && x != "") { 21204 j.removeClass("x-hidden"); 21205 j.replaceClass(d, x); 21206 h.addClass("x-dlg-icon"); 21207 d = x 21208 } else { 21209 j.replaceClass(d, "x-hidden"); 21210 h.removeClass("x-dlg-icon"); 21211 d = "" 21212 } 21213 return this 21214 }, 21215 progress : function(z, y, x) { 21216 this.show({ 21217 title : z, 21218 msg : y, 21219 buttons : false, 21220 progress : true, 21221 closable : false, 21222 minWidth : this.minProgressWidth, 21223 progressText : x 21224 }); 21225 return this 21226 }, 21227 wait : function(z, y, x) { 21228 this.show({ 21229 title : y, 21230 msg : z, 21231 buttons : false, 21232 closable : false, 21233 wait : true, 21234 modal : true, 21235 minWidth : this.minProgressWidth, 21236 waitConfig : x 21237 }); 21238 return this 21239 }, 21240 alert : function(A, z, y, x) { 21241 this.show({ 21242 title : A, 21243 msg : z, 21244 buttons : this.OK, 21245 fn : y, 21246 scope : x, 21247 minWidth : this.minWidth 21248 }); 21249 return this 21250 }, 21251 confirm : function(A, z, y, x) { 21252 this.show({ 21253 title : A, 21254 msg : z, 21255 buttons : this.YESNO, 21256 fn : y, 21257 scope : x, 21258 icon : this.QUESTION, 21259 minWidth : this.minWidth 21260 }); 21261 return this 21262 }, 21263 prompt : function(C, B, z, y, x, A) { 21264 this.show({ 21265 title : C, 21266 msg : B, 21267 buttons : this.OKCANCEL, 21268 fn : z, 21269 minWidth : this.minPromptWidth, 21270 scope : y, 21271 prompt : true, 21272 multiline : x, 21273 value : A 21274 }); 21275 return this 21276 }, 21277 OK : { 21278 ok : true 21279 }, 21280 CANCEL : { 21281 cancel : true 21282 }, 21283 OKCANCEL : { 21284 ok : true, 21285 cancel : true 21286 }, 21287 YESNO : { 21288 yes : true, 21289 no : true 21290 }, 21291 YESNOCANCEL : { 21292 yes : true, 21293 no : true, 21294 cancel : true 21295 }, 21296 INFO : "ext-mb-info", 21297 WARNING : "ext-mb-warning", 21298 QUESTION : "ext-mb-question", 21299 ERROR : "ext-mb-error", 21300 defaultTextHeight : 75, 21301 maxWidth : 600, 21302 minWidth : 100, 21303 minProgressWidth : 250, 21304 minPromptWidth : 250, 21305 buttonText : { 21306 ok : "OK", 21307 cancel : "Cancel", 21308 yes : "Yes", 21309 no : "No" 21310 } 21311 } 21312}(); 21313Ext.Msg = Ext.MessageBox; 21314Ext.dd.PanelProxy = Ext.extend(Object, { 21315 constructor : function(a, b) { 21316 this.panel = a; 21317 this.id = this.panel.id + "-ddproxy"; 21318 Ext.apply(this, b) 21319 }, 21320 insertProxy : true, 21321 setStatus : Ext.emptyFn, 21322 reset : Ext.emptyFn, 21323 update : Ext.emptyFn, 21324 stop : Ext.emptyFn, 21325 sync : Ext.emptyFn, 21326 getEl : function() { 21327 return this.ghost 21328 }, 21329 getGhost : function() { 21330 return this.ghost 21331 }, 21332 getProxy : function() { 21333 return this.proxy 21334 }, 21335 hide : function() { 21336 if (this.ghost) { 21337 if (this.proxy) { 21338 this.proxy.remove(); 21339 delete this.proxy 21340 } 21341 this.panel.el.dom.style.display = ""; 21342 this.ghost.remove(); 21343 delete this.ghost 21344 } 21345 }, 21346 show : function() { 21347 if (!this.ghost) { 21348 this.ghost = this.panel.createGhost( 21349 this.panel.initialConfig.cls, undefined, Ext 21350 .getBody()); 21351 this.ghost.setXY(this.panel.el.getXY()); 21352 if (this.insertProxy) { 21353 this.proxy = this.panel.el.insertSibling({ 21354 cls : "x-panel-dd-spacer" 21355 });
21356 this.proxy.setSize(this.panel.getSize()) 21357 } 21358 this.panel.el.dom.style.display = "none" 21359 } 21360 }, 21361 repair : function(b, c, a) { 21362 this.hide(); 21363 if (typeof c == "function") { 21364 c.call(a || this) 21365 } 21366 }, 21367 moveProxy : function(a, b) { 21368 if (this.proxy) { 21369 a.insertBefore(this.proxy.dom, b) 21370 } 21371 } 21372 }); 21373Ext.Panel.DD = Ext.extend(Ext.dd.DragSource, { 21374 constructor : function(b, a) { 21375 this.panel = b; 21376 this.dragData = { 21377 panel : b 21378 }; 21379 this.proxy = new Ext.dd.PanelProxy(b, a); 21380 Ext.Panel.DD.superclass.constructor.call(this, b.el, a); 21381 var d = b.header, c = b.body; 21382 if (d) { 21383 this.setHandleElId(d.id); 21384 c = b.header 21385 } 21386 c.setStyle("cursor", "move"); 21387 this.scroll = false 21388 }, 21389 showFrame : Ext.emptyFn, 21390 startDrag : Ext.emptyFn, 21391 b4StartDrag : function(a, b) { 21392 this.proxy.show() 21393 }, 21394 b4MouseDown : function(b) { 21395 var a = b.getPageX(), c = b.getPageY(); 21396 this.autoOffset(a, c) 21397 }, 21398 onInitDrag : function(a, b) { 21399 this.onStartDrag(a, b); 21400 return true 21401 }, 21402 createFrame : Ext.emptyFn, 21403 getDragEl : function(a) { 21404 return this.proxy.ghost.dom 21405 }, 21406 endDrag : function(a) { 21407 this.proxy.hide(); 21408 this.panel.saveState() 21409 }, 21410 autoOffset : function(a, b) { 21411 a -= this.startPageX; 21412 b -= this.startPageY; 21413 this.setDelta(a, b) 21414 } 21415 }); 21416 21417Ext.DataView = Ext.extend(Ext.BoxComponent, { 21418 selectedClass : "x-view-selected", 21419 emptyText : "", 21420 deferEmptyText : true, 21421 trackOver : false, 21422 blockRefresh : false, 21423 last : false, 21424 initComponent : function() { 21425 Ext.DataView.superclass.initComponent.call(this); 21426 if (Ext.isString(this.tpl) || Ext.isArray(this.tpl)) { 21427 this.tpl = new Ext.XTemplate(this.tpl) 21428 } 21429 this.addEvents("beforeclick", "click", "mouseenter", 21430 "mouseleave", "containerclick", "dblclick", 21431 "contextmenu", "containercontextmenu", 21432 "selectionchange", "beforeselect"); 21433 this.store = Ext.StoreMgr.lookup(this.store); 21434 this.all = new Ext.CompositeElementLite(); 21435 this.selected = new Ext.CompositeElementLite() 21436 }, 21437 afterRender : function() { 21438 Ext.DataView.superclass.afterRender.call(this); 21439 this.mon(this.getTemplateTarget(), { 21440 click : this.onClick, 21441 dblclick : this.onDblClick, 21442 contextmenu : this.onContextMenu, 21443 scope : this 21444 }); 21445 if (this.overClass || this.trackOver) { 21446 this.mon(this.getTemplateTarget(), { 21447 mouseover : this.onMouseOver, 21448 mouseout : this.onMouseOut, 21449 scope : this 21450 }) 21451 } 21452 if (this.store) { 21453 this.bindStore(this.store, true) 21454 } 21455 }, 21456 refresh : function() { 21457 this.clearSelections(false, true); 21458 var b = this.getTemplateTarget(), a = this.store.getRange(); 21459 b.update(""); 21460 if (a.length < 1) { 21461 if (!this.deferEmptyText || this.hasSkippedEmptyText) { 21462 b.update(this.emptyText) 21463 } 21464 this.all.clear() 21465 } else { 21466 this.tpl.overwrite(b, this.collectData(a, 0)); 21467 this.all.fill(Ext.query(this.itemSelector, b.dom)); 21468 this.updateIndexes(0) 21469 } 21470 this.hasSkippedEmptyText = true 21471 }, 21472 getTemplateTarget : function() { 21473 return this.el 21474 }, 21475 prepareData : function(a) { 21476 return a 21477 }, 21478 collectData : function(b, e) { 21479 var d = [], c = 0, a = b.length; 21480 for (; c < a; c++) { 21481 d[d.length] = this.prepareData(b[c].data, e + c, b[c]) 21482 } 21483 return d 21484 }, 21485 bufferRender : function(a, b) { 21486 var c = document.createElement("div"); 21487 this.tpl.overwrite(c, this.collectData(a, b)); 21488 return Ext.query(this.itemSelector, c) 21489 }, 21490 onUpdate : function(g, a) { 21491 var b = this.store.indexOf(a); 21492 if (b > -1) { 21493 var e = this.isSelected(b), c = this.all.elements[b], d = this 21494 .bufferRender([a], b)[0]; 21495 this.all.replaceElement(b, d, true); 21496 if (e) { 21497 this.selected.replaceElement(c, d); 21498 this.all.item(b).addClass(this.selectedClass) 21499 } 21500 this.updateIndexes(b, b) 21501 } 21502 }, 21503 onAdd : function(g, d, e) { 21504 if (this.all.getCount() === 0) { 21505 this.refresh();
21506 return 21507 } 21508 var c = this.bufferRender(d, e), h, b = this.all.elements; 21509 if (e < this.all.getCount()) { 21510 h = this.all.item(e).insertSibling(c, "before", true); 21511 b.splice.apply(b, [e, 0].concat(c)) 21512 } else { 21513 h = this.all.last().insertSibling(c, "after", true); 21514 b.push.apply(b, c) 21515 } 21516 this.updateIndexes(e) 21517 }, 21518 onRemove : function(c, a, b) { 21519 this.deselect(b); 21520 this.all.removeElement(b, true); 21521 this.updateIndexes(b); 21522 if (this.store.getCount() === 0) { 21523 this.refresh() 21524 } 21525 }, 21526 refreshNode : function(a) { 21527 this.onUpdate(this.store, this.store.getAt(a)) 21528 }, 21529 updateIndexes : function(d, c) { 21530 var b = this.all.elements; 21531 d = d || 0; 21532 c = c || ((c === 0) ? 0 : (b.length - 1)); 21533 for (var a = d; a <= c; a++) { 21534 b[a].viewIndex = a 21535 } 21536 }, 21537 getStore : function() { 21538 return this.store 21539 }, 21540 bindStore : function(a, b) { 21541 if (!b && this.store) { 21542 if (a !== this.store && this.store.autoDestroy) { 21543 this.store.destroy() 21544 } else { 21545 this.store.un("beforeload", this.onBeforeLoad, this); 21546 this.store.un("datachanged", this.onDataChanged, this); 21547 this.store.un("add", this.onAdd, this); 21548 this.store.un("remove", this.onRemove, this); 21549 this.store.un("update", this.onUpdate, this); 21550 this.store.un("clear", this.refresh, this) 21551 } 21552 if (!a) { 21553 this.store = null 21554 } 21555 } 21556 if (a) { 21557 a = Ext.StoreMgr.lookup(a); 21558 a.on({ 21559 scope : this, 21560 beforeload : this.onBeforeLoad, 21561 datachanged : this.onDataChanged, 21562 add : this.onAdd, 21563 remove : this.onRemove, 21564 update : this.onUpdate, 21565 clear : this.refresh 21566 }) 21567 } 21568 this.store = a; 21569 if (a) { 21570 this.refresh() 21571 } 21572 }, 21573 onDataChanged : function() { 21574 if (this.blockRefresh !== true) { 21575 this.refresh.apply(this, arguments) 21576 } 21577 }, 21578 findItemFromChild : function(a) { 21579 return Ext.fly(a).findParent(this.itemSelector, 21580 this.getTemplateTarget()) 21581 }, 21582 onClick : function(c) { 21583 var b = c 21584 .getTarget(this.itemSelector, this.getTemplateTarget()), a; 21585 if (b) { 21586 a = this.indexOf(b); 21587 if (this.onItemClick(b, a, c) !== false) { 21588 this.fireEvent("click", this, a, b, c) 21589 } 21590 } else { 21591 if (this.fireEvent("containerclick", this, c) !== false) { 21592 this.onContainerClick(c) 21593 } 21594 } 21595 }, 21596 onContainerClick : function(a) { 21597 this.clearSelections() 21598 }, 21599 onContextMenu : function(b) { 21600 var a = b 21601 .getTarget(this.itemSelector, this.getTemplateTarget()); 21602 if (a) { 21603 this.fireEvent("contextmenu", this, this.indexOf(a), a, b) 21604 } else { 21605 this.fireEvent("containercontextmenu", this, b) 21606 } 21607 }, 21608 onDblClick : function(b) { 21609 var a = b 21610 .getTarget(this.itemSelector, this.getTemplateTarget()); 21611 if (a) { 21612 this.fireEvent("dblclick", this, this.indexOf(a), a, b) 21613 } 21614 }, 21615 onMouseOver : function(b) { 21616 var a = b 21617 .getTarget(this.itemSelector, this.getTemplateTarget()); 21618 if (a && a !== this.lastItem) { 21619 this.lastItem = a; 21620 Ext.fly(a).addClass(this.overClass); 21621 this.fireEvent("mouseenter", this, this.indexOf(a), a, b) 21622 } 21623 }, 21624 onMouseOut : function(a) { 21625 if (this.lastItem) { 21626 if (!a.within(this.lastItem, true, true)) { 21627 Ext.fly(this.lastItem).removeClass(this.overClass); 21628 this.fireEvent("mouseleave", this, this 21629 .indexOf(this.lastItem), this.lastItem, 21630 a); 21631 delete this.lastItem 21632 } 21633 } 21634 }, 21635 onItemClick : function(b, a, c) { 21636 if (this.fireEvent("beforeclick", this, a, b, c) === false) { 21637 return false 21638 } 21639 if (this.multiSelect) { 21640 this.doMultiSelection(b, a, c); 21641 c.preventDefault() 21642 } else { 21643 if (this.singleSelect) { 21644 this.doSingleSelection(b, a, c); 21645 c.preventDefault() 21646 } 21647 } 21648 return true 21649 }, 21650 doSingleSelection : function(b, a, c) { 21651 if (c.ctrlKey && this.isSelected(a)) { 21652 this.deselect(a) 21653 } else { 21654 this.select(a, false) 21655 } 21656 }, 21657 doMultiSelection : function(c, a, d) {
21658 if (d.shiftKey && this.last !== false) { 21659 var b = this.last; 21660 this.selectRange(b, a, d.ctrlKey); 21661 this.last = b 21662 } else { 21663 if ((d.ctrlKey || this.simpleSelect) && this.isSelected(a)) { 21664 this.deselect(a) 21665 } else { 21666 this.select(a, d.ctrlKey || d.shiftKey 21667 || this.simpleSelect) 21668 } 21669 } 21670 }, 21671 getSelectionCount : function() { 21672 return this.selected.getCount() 21673 }, 21674 getSelectedNodes : function() { 21675 return this.selected.elements 21676 }, 21677 getSelectedIndexes : function() { 21678 var b = [], d = this.selected.elements, c = 0, a = d.length; 21679 for (; c < a; c++) { 21680 b.push(d[c].viewIndex) 21681 } 21682 return b 21683 }, 21684 getSelectedRecords : function() { 21685 return this.getRecords(this.selected.elements) 21686 }, 21687 getRecords : function(c) { 21688 var b = [], d = 0, a = c.length; 21689 for (; d < a; d++) { 21690 b[b.length] = this.store.getAt(c[d].viewIndex) 21691 } 21692 return b 21693 }, 21694 getRecord : function(a) { 21695 return this.store.getAt(a.viewIndex) 21696 }, 21697 clearSelections : function(a, b) { 21698 if ((this.multiSelect || this.singleSelect) 21699 && this.selected.getCount() > 0) { 21700 if (!b) { 21701 this.selected.removeClass(this.selectedClass) 21702 } 21703 this.selected.clear(); 21704 this.last = false; 21705 if (!a) { 21706 this.fireEvent("selectionchange", this, 21707 this.selected.elements) 21708 } 21709 } 21710 }, 21711 isSelected : function(a) { 21712 return this.selected.contains(this.getNode(a)) 21713 }, 21714 deselect : function(a) { 21715 if (this.isSelected(a)) { 21716 a = this.getNode(a); 21717 this.selected.removeElement(a); 21718 if (this.last == a.viewIndex) { 21719 this.last = false 21720 } 21721 Ext.fly(a).removeClass(this.selectedClass); 21722 this.fireEvent("selectionchange", this, 21723 this.selected.elements) 21724 } 21725 }, 21726 select : function(d, g, b) { 21727 if (Ext.isArray(d)) { 21728 if (!g) { 21729 this.clearSelections(true) 21730 } 21731 for (var c = 0, a = d.length; c < a; c++) { 21732 this.select(d[c], true, true) 21733 } 21734 if (!b) { 21735 this.fireEvent("selectionchange", this, 21736 this.selected.elements) 21737 } 21738 } else { 21739 var e = this.getNode(d); 21740 if (!g) { 21741 this.clearSelections(true) 21742 } 21743 if (e && !this.isSelected(e)) { 21744 if (this.fireEvent("beforeselect", this, e, 21745 this.selected.elements) !== false) { 21746 Ext.fly(e).addClass(this.selectedClass); 21747 this.selected.add(e); 21748 this.last = e.viewIndex; 21749 if (!b) { 21750 this.fireEvent("selectionchange", this, 21751 this.selected.elements) 21752 } 21753 } 21754 } 21755 } 21756 }, 21757 selectRange : function(c, a, b) { 21758 if (!b) { 21759 this.clearSelections(true) 21760 } 21761 this.select(this.getNodes(c, a), true) 21762 }, 21763 getNode : function(b) { 21764 if (Ext.isString(b)) { 21765 return document.getElementById(b) 21766 } else { 21767 if (Ext.isNumber(b)) { 21768 return this.all.elements[b] 21769 } else { 21770 if (b instanceof Ext.data.Record) { 21771 var a = this.store.indexOf(b); 21772 return this.all.elements[a] 21773 } 21774 } 21775 } 21776 return b 21777 }, 21778 getNodes : function(e, a) { 21779 var d = this.all.elements, b = [], c; 21780 e = e || 0; 21781 a = !Ext.isDefined(a) ? Math.max(d.length - 1, 0) : a; 21782 if (e <= a) { 21783 for (c = e; c <= a && d[c]; c++) { 21784 b.push(d[c]) 21785 } 21786 } else { 21787 for (c = e; c >= a && d[c]; c--) { 21788 b.push(d[c]) 21789 } 21790 } 21791 return b 21792 }, 21793 indexOf : function(a) { 21794 a = this.getNode(a); 21795 if (Ext.isNumber(a.viewIndex)) { 21796 return a.viewIndex 21797 } 21798 return this.all.indexOf(a) 21799 }, 21800 onBeforeLoad : function() { 21801 if (this.loadingText) { 21802 this.clearSelections(false, true); 21803 this.getTemplateTarget() 21804 .update('<div class="loading-indicator">' 21805 + this.loadingText + "</div>"); 21806 this.all.clear() 21807 } 21808 }, 21809 onDestroy : function() { 21810 this.all.clear(); 21811 this.selected.clear(); 21812 Ext.DataView.superclass.onDestroy.call(this); 21813 this.bindStore(null) 21814 } 21815 }); 21816Ext.DataView.prototype.setStore = Ext.DataView.prototype.bindStore; 21817Ext.reg("dataview", Ext.DataView); 21818Ext.list.ListView = Ext.extend(Ext.DataView, { 21819 itemSelector : "dl", 21820 selectedClass : "x-list-selected", 21821 overClass : "x-list-over", 21822 scrollOffset : undefined, 21823 columnResize : true, 21824 columnSort : true, 21825 maxColumnWidth : Ext.isIE ? 99 : 100, 21826 initComponent : function() { 21827 if (this.columnResize) { 21828 this.colResizer = new Ext.list.ColumnResizer(this.colResizer); 21829 this.colResizer.init(this) 21830 } 21831 if (this.columnSort) { 21832 this.colSorter = new Ext.list.Sorter(this.columnSort); 21833 this.colSorter.init(this) 21834 } 21835 if (!this.internalTpl) { 21836 this.internalTpl = new Ext.XTemplate( 21837 '<div class="x-list-header"><div class="x-list-header-inner">', 21838 '<tpl for="columns">', 21839 '<div style="width:{[values.width*100]}%;text-align:{align};"><em unselectable="on" id="', 21840 this.id, '-xlhd-{#}">', "{header}", "</em></div>", 21841 "</tpl>", '<div class="x-clear"></div>', "</div></div>", 21842 '<div class="x-list-body"><div class="x-list-body-inner">', 21843 "</div></div>") 21844 } 21845 if (!this.tpl) { 21846 this.tpl = new Ext.XTemplate( 21847 '<tpl for="rows">', 21848 "<dl>", 21849 '<tpl for="parent.columns">', 21850 '<dt style="width:{[values.width*100]}%;text-align:{align};">', 21851 '<em unselectable="on"<tpl if="cls"> class="{cls}</tpl>">', 21852 "{[values.tpl.apply(parent)]}", "</em></dt>", "</tpl>", 21853 '<div class="x-clear"></div>', "</dl>", "</tpl>") 21854 }
21855 var l = this.columns, h = 0, k = 0, m = l.length, b = []; 21856 for (var g = 0; g < m; g++) { 21857 var n = l[g]; 21858 if (!n.isColumn) { 21859 n.xtype = n.xtype ? (/^lv/.test(n.xtype) ? n.xtype : "lv" 21860 + n.xtype) : "lvcolumn"; 21861 n = Ext.create(n) 21862 } 21863 if (n.width) { 21864 h += n.width * 100; 21865 if (h > this.maxColumnWidth) { 21866 n.width -= (h - this.maxColumnWidth) / 100 21867 } 21868 k++ 21869 } 21870 b.push(n) 21871 } 21872 l = this.columns = b; 21873 if (k < m) { 21874 var d = m - k; 21875 if (h < this.maxColumnWidth) { 21876 var a = ((this.maxColumnWidth - h) / d) / 100; 21877 for (var e = 0; e < m; e++) { 21878 var n = l[e]; 21879 if (!n.width) { 21880 n.width = a 21881 } 21882 } 21883 } 21884 } 21885 Ext.list.ListView.superclass.initComponent.call(this) 21886 }, 21887 onRender : function() { 21888 this.autoEl = { 21889 cls : "x-list-wrap" 21890 }; 21891 Ext.list.ListView.superclass.onRender.apply(this, arguments); 21892 this.internalTpl.overwrite(this.el, { 21893 columns : this.columns 21894 }); 21895 this.innerBody = Ext.get(this.el.dom.childNodes[1].firstChild); 21896 this.innerHd = Ext.get(this.el.dom.firstChild.firstChild); 21897 if (this.hideHeaders) { 21898 this.el.dom.firstChild.style.display = "none" 21899 } 21900 }, 21901 getTemplateTarget : function() { 21902 return this.innerBody 21903 }, 21904 collectData : function() { 21905 var a = Ext.list.ListView.superclass.collectData.apply(this, arguments); 21906 return { 21907 columns : this.columns, 21908 rows : a 21909 } 21910 }, 21911 verifyInternalSize : function() { 21912 if (this.lastSize) { 21913 this.onResize(this.lastSize.width, this.lastSize.height) 21914 } 21915 }, 21916 onResize : function(c, e) { 21917 var b = this.innerBody.dom, g = this.innerHd.dom, d = c 21918 - Ext.num(this.scrollOffset, Ext.getScrollBarWidth()) + "px", a; 21919 if (!b) { 21920 return 21921 } 21922 a = b.parentNode; 21923 if (Ext.isNumber(c)) { 21924 if (this.reserveScrollOffset 21925 || ((a.offsetWidth - a.clientWidth) > 10)) { 21926 b.style.width = d; 21927 g.style.width = d 21928 } else { 21929 b.style.width = c + "px"; 21930 g.style.width = c + "px"; 21931 setTimeout(function() { 21932 if ((a.offsetWidth - a.clientWidth) > 10) { 21933 b.style.width = d; 21934 g.style.width = d 21935 } 21936 }, 10) 21937 } 21938 } 21939 if (Ext.isNumber(e)) { 21940 a.style.height = Math.max(0, e - g.parentNode.offsetHeight) + "px" 21941 } 21942 }, 21943 updateIndexes : function() { 21944 Ext.list.ListView.superclass.updateIndexes.apply(this, arguments); 21945 this.verifyInternalSize() 21946 }, 21947 findHeaderIndex : function(g) { 21948 g = g.dom || g; 21949 var a = g.parentNode, d = a.parentNode.childNodes, b = 0, e; 21950 for (; e = d[b]; b++) { 21951 if (e == a) { 21952 return b 21953 } 21954 } 21955 return -1 21956 }, 21957 setHdWidths : function() { 21958 var d = this.innerHd.dom.getElementsByTagName("div"), c = 0, b = this.columns, a = b.length; 21959 for (; c < a; c++) { 21960 d[c].style.width = (b[c].width * 100) + "%" 21961 } 21962 } 21963}); 21964Ext.reg("listview", Ext.list.ListView); 21965Ext.ListView = Ext.list.ListView; 21966Ext.list.Column = Ext.extend(Object, { 21967 isColumn : true, 21968 align : "left", 21969 header : "", 21970 width : null, 21971 cls : "", 21972 constructor : function(a) { 21973 if (!a.tpl) { 21974 a.tpl = new Ext.XTemplate("{" + a.dataIndex + "}") 21975 } else { 21976 if (Ext.isString(a.tpl)) { 21977 a.tpl = new Ext.XTemplate(a.tpl) 21978 } 21979 } 21980 Ext.apply(this, a) 21981 } 21982 }); 21983Ext.reg("lvcolumn", Ext.list.Column); 21984Ext.list.NumberColumn = Ext.extend(Ext.list.Column, { 21985 format : "0,000.00", 21986 constructor : function(a) { 21987 a.tpl = a.tpl 21988 || new Ext.XTemplate("{" + a.dataIndex + ':number("' 21989 + (a.format || this.format) + '")}'); 21990 Ext.list.NumberColumn.superclass.constructor.call(this, a) 21991 } 21992 }); 21993Ext.reg("lvnumbercolumn", Ext.list.NumberColumn); 21994Ext.list.DateColumn = Ext.extend(Ext.list.Column, { 21995 format : "m/d/Y", 21996 constructor : function(a) { 21997 a.tpl = a.tpl 21998 || new Ext.XTemplate("{" + a.dataIndex + ':date("' 21999 + (a.format || this.format) + '")}'); 22000 Ext.list.DateColumn.superclass.constructor.call(this, a) 22001 } 22002 }); 22003Ext.reg("lvdatecolumn", Ext.list.DateColumn); 22004Ext.list.BooleanColumn = Ext.extend(Ext.list.Column, { 22005 trueText : "true", 22006 falseText : "false", 22007 undefinedText : " ", 22008 constructor : function(e) { 22009 e.tpl = e.tpl || new Ext.XTemplate("{" + e.dataIndex + ":this.format}"); 22010 var b = this.trueText, d = this.falseText, a = this.undefinedText; 22011 e.tpl.format = function(c) { 22012 if (c === undefined) { 22013 return a 22014 }
22015 if (!c || c === "false") { 22016 return d 22017 } 22018 return b 22019 }; 22020 Ext.list.DateColumn.superclass.constructor.call(this, e) 22021 } 22022}); 22023Ext.reg("lvbooleancolumn", Ext.list.BooleanColumn); 22024Ext.list.ColumnResizer = Ext.extend(Ext.util.Observable, { 22025 minPct : 0.05, 22026 constructor : function(a) { 22027 Ext.apply(this, a); 22028 Ext.list.ColumnResizer.superclass.constructor.call(this) 22029 }, 22030 init : function(a) { 22031 this.view = a; 22032 a.on("render", this.initEvents, this) 22033 }, 22034 initEvents : function(a) { 22035 a.mon(a.innerHd, "mousemove", this.handleHdMove, this); 22036 this.tracker = new Ext.dd.DragTracker({ 22037 onBeforeStart : this.onBeforeStart.createDelegate(this), 22038 onStart : this.onStart.createDelegate(this), 22039 onDrag : this.onDrag.createDelegate(this), 22040 onEnd : this.onEnd.createDelegate(this), 22041 tolerance : 3, 22042 autoStart : 300 22043 }); 22044 this.tracker.initEl(a.innerHd); 22045 a.on("beforedestroy", this.tracker.destroy, this.tracker) 22046 }, 22047 handleHdMove : function(i, d) { 22048 var c = 5, b = i.getPageX(), j = i.getTarget("em", 3, true); 22049 if (j) { 22050 var h = j.getRegion(), g = j.dom.style, a = j.dom.parentNode; 22051 if (b - h.left <= c && a != a.parentNode.firstChild) { 22052 this.activeHd = Ext.get(a.previousSibling.firstChild); 22053 g.cursor = Ext.isWebKit ? "e-resize" : "col-resize" 22054 } else { 22055 if (h.right - b <= c 22056 && a != a.parentNode.lastChild.previousSibling) { 22057 this.activeHd = j; 22058 g.cursor = Ext.isWebKit ? "w-resize" : "col-resize" 22059 } else { 22060 delete this.activeHd; 22061 g.cursor = "" 22062 } 22063 } 22064 } 22065 }, 22066 onBeforeStart : function(a) { 22067 this.dragHd = this.activeHd; 22068 return !!this.dragHd 22069 }, 22070 onStart : function(g) { 22071 var d = this, b = d.view, c = d.dragHd, a = d.tracker.getXY()[0]; 22072 d.proxy = b.el.createChild({ 22073 cls : "x-list-resizer" 22074 }); 22075 d.dragX = c.getX(); 22076 d.headerIndex = b.findHeaderIndex(c); 22077 d.headersDisabled = b.disableHeaders; 22078 b.disableHeaders = true; 22079 d.proxy.setHeight(b.el.getHeight()); 22080 d.proxy.setX(d.dragX); 22081 d.proxy.setWidth(a - d.dragX); 22082 this.setBoundaries() 22083 }, 22084 setBoundaries : function(j) { 22085 var k = this.view, h = this.headerIndex, c = k.innerHd.getWidth(), j = k.innerHd 22086 .getX(), b = Math.ceil(c * this.minPct), l = c - b, e = k.columns.length, d = k.innerHd 22087 .select("em", true), g = b + j, a = l + j, i; 22088 if (e == 2) { 22089 this.minX = g; 22090 this.maxX = a 22091 } else { 22092 i = d.item(h + 2); 22093 this.minX = d.item(h).getX() + b; 22094 this.maxX = i ? i.getX() - b : a; 22095 if (h == 0) { 22096 this.minX = g 22097 } else { 22098 if (h == e - 2) { 22099 this.maxX = a 22100 } 22101 } 22102 } 22103 }, 22104 onDrag : function(c) { 22105 var b = this, a = b.tracker.getXY()[0].constrain(b.minX, b.maxX); 22106 b.proxy.setWidth(a - this.dragX) 22107 }, 22108 onEnd : function(i) { 22109 var g = this.proxy.getWidth(), h = this.headerIndex, l = this.view, c = l.columns, b = l.innerHd 22110 .getWidth(), k = Math.ceil(g * l.maxColumnWidth / b) / 100, d = this.headersDisabled, m = c[h], j = c[h 22111 + 1], a = m.width + j.width; 22112 this.proxy.remove(); 22113 m.width = k; 22114 j.width = a - k; 22115 delete this.dragHd; 22116 l.setHdWidths(); 22117 l.refresh(); 22118 setTimeout(function() { 22119 l.disableHeaders = d 22120 }, 100) 22121 } 22122}); 22123Ext.ListView.ColumnResizer = Ext.list.ColumnResizer; 22124Ext.list.Sorter = Ext.extend(Ext.util.Observable, { 22125 sortClasses : ["sort-asc", "sort-desc"], 22126 constructor : function(a) { 22127 Ext.apply(this, a); 22128 Ext.list.Sorter.superclass.constructor.call(this) 22129 }, 22130 init : function(a) { 22131 this.view = a; 22132 a.on("render", this.initEvents, this) 22133 }, 22134 initEvents : function(a) { 22135 a.mon(a.innerHd, "click", this.onHdClick, this); 22136 a.innerHd.setStyle("cursor", "pointer"); 22137 a.mon(a.store, "datachanged", this.updateSortState, this); 22138 this.updateSortState.defer(10, this, [a.store]) 22139 }, 22140 updateSortState : function(c) { 22141 var g = c.getSortState(); 22142 if (!g) { 22143 return 22144 } 22145 this.sortState = g; 22146 var e = this.view.columns, h = -1; 22147 for (var d = 0, a = e.length; d < a; d++) { 22148 if (e[d].dataIndex == g.field) { 22149 h = d; 22150 break 22151 } 22152 } 22153 if (h != -1) { 22154 var b = g.direction; 22155 this.updateSortIcon(h, b) 22156 } 22157 }, 22158 updateSortIcon : function(b, a) { 22159 var d = this.sortClasses; 22160 var c = this.view.innerHd.select("em").removeClass(d); 22161 c.item(b).addClass(d[a == "DESC" ? 1 : 0]) 22162 }, 22163 onHdClick : function(c) { 22164 var b = c.getTarget("em", 3); 22165 if (b && !this.view.disableHeaders) { 22166 var a = this.view.findHeaderIndex(b); 22167 this.view.store.sort(this.view.columns[a].dataIndex) 22168 } 22169 } 22170 }); 22171Ext.ListView.Sorter = Ext.list.Sorter; 22172Ext.TabPanel = Ext.extend(Ext.Panel, { 22173 deferredRender : true, 22174 tabWidth : 120, 22175 minTabWidth : 30, 22176 resizeTabs : false, 22177 enableTabScroll : false, 22178 scrollIncrement : 0, 22179 scrollRepeatInterval : 400, 22180 scrollDuration : 0.35, 22181 animScroll : true, 22182 tabPosition : "top", 22183 baseCls : "x-tab-panel", 22184 autoTabs : false, 22185 autoTabSelector : "div.x-tab", 22186 activeTab : undefined, 22187 tabMargin : 2, 22188 plain : false, 22189 wheelIncrement : 20, 22190 idDelimiter : "__", 22191 itemCls : "x-tab-item", 22192 elements : "body", 22193 headerAsText : false, 22194 frame : false, 22195 hideBorders : true, 22196 searchPanel : null, 22197 headerBannerEl : null, 22198 initComponent : function() { 22199 this.frame = false; 22200 Ext.TabPanel.superclass.initComponent.call(this); 22201 this.addEvents("beforetabchange", "tabchange", "contextmenu"); 22202 this.setLayout(new Ext.layout.CardLayout(Ext.apply({
22203 layoutOnCardChange : this.layoutOnTabChange, 22204 deferredRender : this.deferredRender 22205 }, this.layoutConfig))); 22206 if (this.tabPosition == "top") { 22207 this.elements += ",header"; 22208 this.stripTarget = "header" 22209 } else { 22210 this.elements += ",footer"; 22211 this.stripTarget = "footer" 22212 } 22213 if (!this.stack) { 22214 this.stack = Ext.TabPanel.AccessStack() 22215 } 22216 this.initItems() 22217 }, 22218 onRender : function(c, a) { 22219 Ext.TabPanel.superclass.onRender.call(this, c, a); 22220 if (this.plain) { 22221 var g = this.tabPosition == "top" ? "header" : "footer"; 22222 this[g].addClass("x-tab-panel-" + g + "-plain") 22223 } 22224 var b = this[this.stripTarget], tb, tb_el, p; 22225 22226 if (this.headerBannerEl) { 22227 tb = b.createChild({ 22228 cls : "x-tab-banner-wrapper" 22229 }); 22230 if (tb) { 22231 tb_el = document.getElementById(this.headerBannerEl); 22232 if (tb_el) { 22233 tb.dom.innerHTML = tb_el.innerHTML; 22234 } 22235 } 22236 } 22237 22238 if (this.searchPanel) { 22239 b.setStyle('position', 'relative'); 22240 var searchPanel = b.createChild({ 22241 cls : "x-tab-search-wrapper" 22242 }); 22243 22244 this.searchPanel.render(searchPanel); 22245 } 22246 22247 this.stripWrap = b.createChild({ 22248 cls : "x-tab-strip-wrap", 22249 cn : { 22250 tag : "ul", 22251 cls : "x-tab-strip x-tab-strip-" + this.tabPosition 22252 } 22253 }); 22254 22255 var e = (this.tabPosition == "bottom" ? this.stripWrap : null); 22256 b.createChild({ 22257 cls : "x-tab-strip-spacer" 22258 }, e); 22259 this.strip = new Ext.Element(this.stripWrap.dom.firstChild); 22260 this.edge = this.strip.createChild({ 22261 tag : "li", 22262 cls : "x-tab-edge", 22263 cn : [{ 22264 tag : "span", 22265 cls : "x-tab-strip-text", 22266 cn : " " 22267 }] 22268 }); 22269 this.strip.createChild({ 22270 cls : "x-clear" 22271 }); 22272 this.body.addClass("x-tab-panel-body-" + this.tabPosition); 22273 if (!this.itemTpl) { 22274 var d = new Ext.Template( 22275 '<li class="{cls}" id="{id}"><a class="x-tab-strip-close"></a>', 22276 '<a class="x-tab-right" href="#"><em class="x-tab-left">', 22277 '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}" {tabIndex}>{text}</span></span>', 22278 '</em></a>', 22279 '<div class="r3-tabitem-active-bottom"><div class="r3-tabitem-active-bottom-line"></div></div>', 22280 '</li>'); 22281 d.disableFormats = true; 22282 d.compile(); 22283 Ext.TabPanel.prototype.itemTpl = d 22284 } 22285 22286 this.items.each(this.initTab, this) 22287 }, 22288 afterRender : function() { 22289 Ext.TabPanel.superclass.afterRender.call(this); 22290 if (this.autoTabs) { 22291 this.readTabs(false) 22292 } 22293 if (this.activeTab !== undefined) { 22294 var a = Ext.isObject(this.activeTab) ? this.activeTab : this.items 22295 .get(this.activeTab); 22296 delete this.activeTab; 22297 this.setActiveTab(a) 22298 } 22299 }, 22300 initEvents : function() { 22301 Ext.TabPanel.superclass.initEvents.call(this); 22302 this.mon(this.strip, { 22303 scope : this, 22304 mousedown : this.onStripMouseDown, 22305 contextmenu : this.onStripContextMenu 22306 }); 22307 if (this.enableTabScroll) { 22308 this.mon(this.strip, "mousewheel", this.onWheel, this) 22309 } 22310 }, 22311 findTargets : function(c) { 22312 var b = null, a = c.getTarget("li:not(.x-tab-edge)", this.strip); 22313 if (a) { 22314 b = this.getComponent(a.id.split(this.idDelimiter)[1]); 22315 if (b.disabled) { 22316 return { 22317 close : null, 22318 item : null, 22319 el : null 22320 } 22321 } 22322 } 22323 return { 22324 close : c.getTarget(".x-tab-strip-close", this.strip), 22325 item : b, 22326 el : a 22327 } 22328 }, 22329 onStripEnter : function(b) { 22330 b.button = 0; 22331 this.onStripMouseDown(b); 22332 }, 22333 onStripMouseDown : function(b) { 22334 if (b.button !== 0) { 22335 return 22336 } 22337 b.preventDefault(); 22338 var a = this.findTargets(b); 22339 if (a.close) { 22340 if (a.item.fireEvent("beforeclose", a.item) !== false) { 22341 a.item.fireEvent("close", a.item); 22342 this.remove(a.item) 22343 } 22344 return 22345 } 22346 if (a.item && a.item != this.activeTab) { 22347 this.setActiveTab(a.item) 22348 } 22349 }, 22350 onStripContextMenu : function(b) { 22351 b.preventDefault(); 22352 var a = this.findTargets(b); 22353 if (a.item) { 22354 this.fireEvent("contextmenu", this, a.item, b) 22355 } 22356 }, 22357 readTabs : function(d) { 22358 if (d === true) { 22359 this.items.each(function(h) { 22360 this.remove(h) 22361 }, this) 22362 } 22363 var c = this.el.query(this.autoTabSelector); 22364 for (var b = 0, a = c.length; b < a; b++) { 22365 var e = c[b], g = e.getAttribute("title"); 22366 e.removeAttribute("title"); 22367 this.add({ 22368 title : g, 22369 contentEl : e 22370 }) 22371 } 22372 }, 22373 initTab : function(d, b) { 22374 var e = this.strip.dom.childNodes[b], g = this.getTemplateArgs(d), c = e 22375 ? this.itemTpl.insertBefore(e, g) 22376 : this.itemTpl.append(this.strip, g), a = "x-tab-strip-over", h = Ext 22377 .get(c);
22378 h.hover(function() { 22379 if (!d.disabled) { 22380 h.addClass(a) 22381 } 22382 }, function() { 22383 h.removeClass(a) 22384 }); 22385 if (d.tabTip) { 22386 h.child("span.x-tab-strip-text", true).qtip = d.tabTip 22387 } 22388 d.tabEl = c; 22389 h.select("a").on("click", function(i) { 22390 if (!i.getPageX()) { 22391 this.onStripMouseDown(i) 22392 } 22393 }, this, { 22394 preventDefault : true 22395 }); 22396 /* 22397 * ch197cm 07.13 ì¹ ì ê·¼ì±ì ê³ ë ¤íì¬ ìí° ê¸°ë¥ ì¶ê° 22398 */ 22399 h.select("a").on("keydown", function(i) { 22400 if (i.keyCode == 13) { 22401 this.onStripEnter(i) 22402 } 22403 }, this, { 22404 preventDefault : false 22405 }); 22406 d.on({ 22407 scope : this, 22408 disable : this.onItemDisabled, 22409 enable : this.onItemEnabled, 22410 titlechange : this.onItemTitleChanged, 22411 iconchange : this.onItemIconChanged, 22412 beforeshow : this.onBeforeShowItem 22413 }) 22414 }, 22415 getTemplateArgs : function(b) { 22416 var a = b.closable ? "x-tab-strip-closable" : ""; 22417 if (b.disabled) { 22418 a += " x-item-disabled" 22419 } 22420 if (b.iconCls) { 22421 a += " x-tab-with-icon" 22422 } 22423 if (b.tabCls) { 22424 a += " " + b.tabCls 22425 } 22426 return { 22427 id : this.id + this.idDelimiter + b.getItemId(), 22428 text : b.title, 22429 cls : a, 22430 iconCls : b.iconCls || "", 22431 tabIndex : b.tabIndex > 0 ? 'tabindex="'+b.tabIndex+'"' : '' 22432 } 22433 }, 22434 onAdd : function(b) { 22435 Ext.TabPanel.superclass.onAdd.call(this, b); 22436 if (this.rendered) { 22437 var a = this.items; 22438 this.initTab(b, a.indexOf(b)); 22439 this.delegateUpdates() 22440 } 22441 }, 22442 onBeforeAdd : function(b) { 22443 var a = b.events 22444 ? (this.items.containsKey(b.getItemId()) ? b : null) 22445 : this.items.get(b); 22446 if (a) { 22447 this.setActiveTab(b); 22448 return false 22449 } 22450 Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments); 22451 var c = b.elements; 22452 b.elements = c ? c.replace(",header", "") : c; 22453 b.border = (b.border === true) 22454 }, 22455 onRemove : function(d) { 22456 var b = Ext.get(d.tabEl); 22457 if (b) { 22458 b.select("a").removeAllListeners(); 22459 Ext.destroy(b) 22460 } 22461 Ext.TabPanel.superclass.onRemove.call(this, d); 22462 this.stack.remove(d); 22463 delete d.tabEl; 22464 d.un("disable", this.onItemDisabled, this); 22465 d.un("enable", this.onItemEnabled, this); 22466 d.un("titlechange", this.onItemTitleChanged, this); 22467 d.un("iconchange", this.onItemIconChanged, this); 22468 d.un("beforeshow", this.onBeforeShowItem, this); 22469 if (d == this.activeTab) { 22470 var a = this.stack.next(); 22471 if (a) { 22472 this.setActiveTab(a) 22473 } else { 22474 if (this.items.getCount() > 0) { 22475 this.setActiveTab(0) 22476 } else { 22477 this.setActiveTab(null) 22478 } 22479 } 22480 } 22481 if (!this.destroying) { 22482 this.delegateUpdates() 22483 } 22484 }, 22485 onBeforeShowItem : function(a) { 22486 if (a != this.activeTab) { 22487 this.setActiveTab(a); 22488 return false 22489 } 22490 }, 22491 onItemDisabled : function(b) { 22492 var a = this.getTabEl(b); 22493 if (a) { 22494 Ext.fly(a).addClass("x-item-disabled") 22495 } 22496 this.stack.remove(b) 22497 }, 22498 onItemEnabled : function(b) { 22499 var a = this.getTabEl(b); 22500 if (a) { 22501 Ext.fly(a).removeClass("x-item-disabled") 22502 } 22503 }, 22504 onItemTitleChanged : function(b) { 22505 var a = this.getTabEl(b); 22506 if (a) { 22507 Ext.fly(a).child("span.x-tab-strip-text", true).innerHTML = b.title 22508 } 22509 }, 22510 onItemIconChanged : function(d, a, c) { 22511 var b = this.getTabEl(d); 22512 if (b) { 22513 b = Ext.get(b); 22514 b.child("span.x-tab-strip-text").replaceClass(c, a); 22515 b[Ext.isEmpty(a) ? "removeClass" : "addClass"]("x-tab-with-icon") 22516 } 22517 }, 22518 getTabEl : function(a) { 22519 var b = this.getComponent(a); 22520 return b ? b.tabEl : null 22521 }, 22522 onResize : function() { 22523 Ext.TabPanel.superclass.onResize.apply(this, arguments); 22524 this.delegateUpdates() 22525 }, 22526 beginUpdate : function() { 22527 this.suspendUpdates = true 22528 }, 22529 endUpdate : function() { 22530 this.suspendUpdates = false; 22531 this.delegateUpdates() 22532 }, 22533 hideTabStripItem : function(b) { 22534 b = this.getComponent(b); 22535 var a = this.getTabEl(b); 22536 if (a) { 22537 a.style.display = "none"; 22538 this.delegateUpdates() 22539 } 22540 this.stack.remove(b) 22541 }, 22542 unhideTabStripItem : function(b) { 22543 b = this.getComponent(b); 22544 var a = this.getTabEl(b); 22545 if (a) { 22546 a.style.display = ""; 22547 this.delegateUpdates() 22548 } 22549 }, 22550 delegateUpdates : function() { 22551 var a = this.rendered; 22552 if (this.suspendUpdates) { 22553 return 22554 } 22555 if (this.resizeTabs && a) { 22556 this.autoSizeTabs() 22557 } 22558 if (this.enableTabScroll && a) { 22559 this.autoScrollTabs() 22560 } 22561 }, 22562 autoSizeTabs : function() {
22563 var h = this.items.length, b = this.tabPosition != "bottom" 22564 ? "header" 22565 : "footer", c = this[b].dom.offsetWidth, a = this[b].dom.clientWidth; 22566 if (!this.resizeTabs || h < 1 || !a) { 22567 return 22568 } 22569 var k = Math.max(Math.min(Math.floor((a - 4) / h) - this.tabMargin, 22570 this.tabWidth), this.minTabWidth); 22571 this.lastTabWidth = k; 22572 var m = this.strip.query("li:not(.x-tab-edge)"); 22573 for (var e = 0, j = m.length; e < j; e++) { 22574 var l = m[e], n = Ext.fly(l).child(".x-tab-strip-inner", true), g = l.offsetWidth, d = n.offsetWidth; 22575 n.style.width = (k - (g - d)) + "px" 22576 } 22577 }, 22578 adjustBodyWidth : function(a) { 22579 if (this.header) { 22580 this.header.setWidth(a) 22581 } 22582 if (this.footer) { 22583 this.footer.setWidth(a) 22584 } 22585 return a 22586 }, 22587 setActiveTab : function(c) { 22588 c = this.getComponent(c); 22589 if (this.fireEvent("beforetabchange", this, c, this.activeTab) === false) { 22590 return 22591 } 22592 if (!this.rendered) { 22593 this.activeTab = c; 22594 return 22595 } 22596 if (this.activeTab != c) { 22597 if (this.activeTab) { 22598 var a = this.getTabEl(this.activeTab); 22599 if (a) { 22600 Ext.fly(a).removeClass("x-tab-strip-active") 22601 } 22602 } 22603 this.activeTab = c; 22604 if (c) { 22605 var b = this.getTabEl(c); 22606 Ext.fly(b).addClass("x-tab-strip-active"); 22607 this.stack.add(c); 22608 this.layout.setActiveItem(c); 22609 this.delegateUpdates(); 22610 if (this.scrolling) { 22611 this.scrollToTab(c, this.animScroll) 22612 } 22613 } 22614 this.fireEvent("tabchange", this, c) 22615 } 22616 }, 22617 getActiveTab : function() { 22618 return this.activeTab || null 22619 }, 22620 getItem : function(a) { 22621 return this.getComponent(a) 22622 }, 22623 autoScrollTabs : function() { 22624 this.pos = this.tabPosition == "bottom" ? this.footer : this.header; 22625 var h = this.items.length, d = this.pos.dom.offsetWidth, c = this.pos.dom.clientWidth, g = this.stripWrap, e = g.dom, b = e.offsetWidth, i = this 22626 .getScrollPos(), a = this.edge.getOffsetsTo(this.stripWrap)[0] 22627 + i; 22628 if (!this.enableTabScroll || b < 20) { 22629 return 22630 } 22631 if (h == 0 || a <= c) { 22632 e.scrollLeft = 0; 22633 g.setWidth(c); 22634 if (this.scrolling) { 22635 this.scrolling = false; 22636 this.pos.removeClass("x-tab-scrolling"); 22637 this.scrollLeft.hide(); 22638 this.scrollRight.hide(); 22639 if (Ext.isAir || Ext.isWebKit) { 22640 e.style.marginLeft = ""; 22641 e.style.marginRight = "" 22642 } 22643 } 22644 } else { 22645 if (!this.scrolling) { 22646 this.pos.addClass("x-tab-scrolling"); 22647 if (Ext.isAir || Ext.isWebKit) { 22648 e.style.marginLeft = "18px"; 22649 e.style.marginRight = "18px" 22650 } 22651 } 22652 c -= g.getMargins("lr"); 22653 g.setWidth(c > 20 ? c : 20); 22654 if (!this.scrolling) { 22655 if (!this.scrollLeft) { 22656 this.createScrollers() 22657 } else { 22658 this.scrollLeft.show(); 22659 this.scrollRight.show() 22660 } 22661 } 22662 this.scrolling = true; 22663 if (i > (a - c)) { 22664 e.scrollLeft = a - c 22665 } else { 22666 this.scrollToTab(this.activeTab, false) 22667 } 22668 this.updateScrollButtons() 22669 } 22670 }, 22671 createScrollers : function() { 22672 this.pos.addClass("x-tab-scrolling-" + this.tabPosition); 22673 var c = this.stripWrap.dom.offsetHeight; 22674 var a = this.pos.insertFirst({ 22675 cls : "x-tab-scroller-left" 22676 }); 22677 a.setHeight(c); 22678 a.addClassOnOver("x-tab-scroller-left-over"); 22679 this.leftRepeater = new Ext.util.ClickRepeater(a, { 22680 interval : this.scrollRepeatInterval, 22681 handler : this.onScrollLeft, 22682 scope : this 22683 }); 22684 this.scrollLeft = a; 22685 var b = this.pos.insertFirst({ 22686 cls : "x-tab-scroller-right" 22687 }); 22688 b.setHeight(c); 22689 b.addClassOnOver("x-tab-scroller-right-over"); 22690 this.rightRepeater = new Ext.util.ClickRepeater(b, { 22691 interval : this.scrollRepeatInterval, 22692 handler : this.onScrollRight, 22693 scope : this 22694 }); 22695 this.scrollRight = b 22696 }, 22697 getScrollWidth : function() { 22698 return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos() 22699 }, 22700 getScrollPos : function() { 22701 return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0 22702 }, 22703 getScrollArea : function() { 22704 return parseInt(this.stripWrap.dom.clientWidth, 10) || 0 22705 }, 22706 getScrollAnim : function() { 22707 return { 22708 duration : this.scrollDuration, 22709 callback : this.updateScrollButtons, 22710 scope : this 22711 } 22712 }, 22713 getScrollIncrement : function() { 22714 return this.scrollIncrement 22715 || (this.resizeTabs ? this.lastTabWidth + 2 : 100) 22716 }, 22717 scrollToTab : function(e, a) { 22718 if (!e) { 22719 return 22720 }
22721 var c = this.getTabEl(e), h = this.getScrollPos(), d = this 22722 .getScrollArea(), g = Ext.fly(c).getOffsetsTo(this.stripWrap)[0] 22723 + h, b = g + c.offsetWidth; 22724 if (g < h) { 22725 this.scrollTo(g, a) 22726 } else { 22727 if (b > (h + d)) { 22728 this.scrollTo(b - d, a) 22729 } 22730 } 22731 }, 22732 scrollTo : function(b, a) { 22733 this.stripWrap.scrollTo("left", b, a ? this.getScrollAnim() : false); 22734 if (!a) { 22735 this.updateScrollButtons() 22736 } 22737 }, 22738 onWheel : function(g) { 22739 var h = g.getWheelDelta() * this.wheelIncrement * -1; 22740 g.stopEvent(); 22741 var i = this.getScrollPos(), c = i + h, a = this.getScrollWidth() 22742 - this.getScrollArea(); 22743 var b = Math.max(0, Math.min(a, c)); 22744 if (b != i) { 22745 this.scrollTo(b, false) 22746 } 22747 }, 22748 onScrollRight : function() { 22749 var a = this.getScrollWidth() - this.getScrollArea(), c = this 22750 .getScrollPos(), b = Math.min(a, c + this.getScrollIncrement()); 22751 if (b != c) { 22752 this.scrollTo(b, this.animScroll) 22753 } 22754 }, 22755 onScrollLeft : function() { 22756 var b = this.getScrollPos(), a = Math.max(0, b 22757 - this.getScrollIncrement()); 22758 if (a != b) { 22759 this.scrollTo(a, this.animScroll) 22760 } 22761 }, 22762 updateScrollButtons : function() { 22763 var a = this.getScrollPos(); 22764 this.scrollLeft[a === 0 ? "addClass" : "removeClass"]("x-tab-scroller-left-disabled"); 22765 this.scrollRight[a >= (this.getScrollWidth() - this.getScrollArea()) 22766 ? "addClass" 22767 : "removeClass"]("x-tab-scroller-right-disabled") 22768 }, 22769 beforeDestroy : function() { 22770 Ext.destroy(this.leftRepeater, this.rightRepeater); 22771 this.deleteMembers("strip", "edge", "scrollLeft", "scrollRight", 22772 "stripWrap"); 22773 this.activeTab = null; 22774 Ext.TabPanel.superclass.beforeDestroy.apply(this) 22775 } 22776}); 22777Ext.reg("tabpanel", Ext.TabPanel); 22778Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab; 22779Ext.TabPanel.AccessStack = function() { 22780 var a = []; 22781 return { 22782 add : function(b) { 22783 a.push(b); 22784 if (a.length > 10) { 22785 a.shift() 22786 } 22787 }, 22788 remove : function(e) { 22789 var d = []; 22790 for (var c = 0, b = a.length; c < b; c++) { 22791 if (a[c] != e) { 22792 d.push(a[c]) 22793 } 22794 } 22795 a = d 22796 }, 22797 next : function() { 22798 return a.pop() 22799 } 22800 } 22801}; 22802Ext.Button = Ext.extend(Ext.BoxComponent, { 22803 nativeClick : null, 22804 hidden : false, 22805 disabled : false, 22806 pressed : false, 22807 enableToggle : false, 22808 menuAlign : "tl-bl?", 22809 type : "button", 22810 menuClassTarget : "tr:nth(2)", 22811 clickEvent : "click", 22812 handleMouseEvents : true, 22813 tooltipType : "qtip", 22814 buttonSelector : "button:first-child", 22815 scale : "small", 22816 iconAlign : "left", 22817 arrowAlign : "right", 22818 useArrow : false, 22819 initComponent : function() { 22820 if (this.menu) { 22821 if (Ext.isArray(this.menu)) { 22822 this.menu = { 22823 items : this.menu 22824 } 22825 } 22826 if (Ext.isObject(this.menu)) { 22827 this.menu.ownerCt = this 22828 } 22829 this.menu = Ext.menu.MenuMgr.get(this.menu); 22830 this.menu.ownerCt = undefined 22831 } 22832 Ext.Button.superclass.initComponent.call(this); 22833 this.addEvents("click", "toggle", "mouseover", "mouseout", "menushow", 22834 "menuhide", "menutriggerover", "menutriggerout"); 22835 if (Ext.isString(this.toggleGroup)) { 22836 this.enableToggle = true 22837 } 22838 }, 22839 getTemplateArgs : function() { 22840 return [ 22841 this.type, 22842 "x-btn-" + this.scale + " x-btn-icon-" + this.scale + "-" + this.iconAlign, 22843 this.getMenuClass(), 22844 this.cls, 22845 this.id, 22846 this.nativeClick, 22847 this.tabindex > 0 ? this.tabindex : -1] 22848 }, 22849 setButtonClass : function() { 22850 if (this.useSetClass) { 22851 if (!Ext.isEmpty(this.oldCls)) { 22852 this.el.removeClass([this.oldCls, "x-btn-pressed"]) 22853 } 22854 this.oldCls = (this.iconCls || this.icon) ? (this.text 22855 ? "x-btn-text-icon" 22856 : "x-btn-icon") : "x-btn-noicon"; 22857 this.el.addClass([this.oldCls, 22858 this.pressed ? "x-btn-pressed" : null]) 22859 } 22860 }, 22861 getMenuClass : function() { 22862 return this.menu || this.useArrow ? (this.arrowAlign != "bottom" 22863 ? "x-btn-arrow" 22864 : "x-btn-arrow-bottom") : "" 22865 }, 22866 onRender : function(c, a) { 22867 if (!this.template) { 22868 if (!Ext.Button.buttonTemplate) { 22869 Ext.Button.buttonTemplate = new Ext.Template( 22870 '<table id="{4}" cellspacing="0" class="x-btn {3}"><tbody class="{1}">', 22871 '<tr><td class="x-btn-tl"><i> </i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i> </i></td></tr>', 22872 '<tr><td class="x-btn-ml"><i> </i></td><td class="x-btn-mc"><em class="{2}" onclick="javascript:{5};" unselectable="on"><button type="{0}" tabindex="{6}"></button></em></td><td class="x-btn-mr"><i> </i></td></tr>', 22873 '<tr><td class="x-btn-bl"><i> </i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i> </i></td></tr>', 22874 "</tbody></table>"); 22875 Ext.Button.buttonTemplate.compile() 22876 } 22877 this.template = Ext.Button.buttonTemplate 22878 } 22879 var b, d = this.getTemplateArgs(); 22880 if (this.id == 'test') { 22881 console.log(d); 22882 this.getTemplateArgs(); 22883 } 22884 22885 if (a) { 22886 b = this.template.insertBefore(a, d, true) 22887 } else { 22888 b = this.template.append(c, d, true) 22889 } 22890 this.btnEl = b.child(this.buttonSelector); 22891 this.mon(this.btnEl, { 22892 scope : this, 22893 focus : this.onFocus, 22894 blur : this.onBlur 22895 }); 22896 this.initButtonEl(b, this.btnEl); 22897 Ext.ButtonToggleMgr.register(this) 22898 }, 22899 initButtonEl : function(b, c) { 22900 this.el = b; 22901 this.setIcon(this.icon); 22902 this.setText(this.text); 22903 this.setIconClass(this.iconCls); 22904 if (Ext.isDefined(this.tabIndex)) { 22905 c.dom.tabIndex = this.tabIndex 22906 } 22907 if (this.tooltip) { 22908 this.setTooltip(this.tooltip, true) 22909 } 22910 if (this.handleMouseEvents) { 22911 this.mon(b, { 22912 scope : this, 22913 mouseover : this.onMouseOver, 22914 mousedown : this.onMouseDown 22915 }) 22916 } 22917 if (this.menu) { 22918 this.mon(this.menu, { 22919 scope : this, 22920 show : this.onMenuShow, 22921 hide : this.onMenuHide 22922 }) 22923 } 22924 if (this.repeat) { 22925 var a = new Ext.util.ClickRepeater(b, Ext.isObject(this.repeat) 22926 ? this.repeat 22927 : {}); 22928 this.mon(a, "click", this.onRepeatClick, this) 22929 } else { 22930 this.mon(b, this.clickEvent, this.onClick, this) 22931 } 22932 },
22933 afterRender : function() { 22934 Ext.Button.superclass.afterRender.call(this); 22935 this.useSetClass = true; 22936 this.setButtonClass(); 22937 this.doc = Ext.getDoc(); 22938 this.doAutoWidth() 22939 }, 22940 setIconClass : function(a) { 22941 this.iconCls = a; 22942 if (this.el) { 22943 this.btnEl.dom.className = ""; 22944 this.btnEl.addClass(["x-btn-text", a || ""]); 22945 this.setButtonClass() 22946 } 22947 return this 22948 }, 22949 setCtClass : function(a) { 22950 if (a) { 22951 if (this.ctCls) { 22952 this.container.removeClass(this.ctCls.split(' ')); 22953 } 22954 22955 this.ctCls = a 22956 this.container.addClass(this.ctCls); 22957 } 22958 return this 22959 }, 22960 setTooltip : function(b, a) { 22961 if (this.rendered) { 22962 if (!a) { 22963 this.clearTip() 22964 } 22965 if (Ext.isObject(b)) { 22966 Ext.QuickTips.register(Ext.apply({ 22967 target : this.btnEl.id 22968 }, b)); 22969 this.tooltip = b 22970 } else { 22971 this.btnEl.dom[this.tooltipType] = b 22972 } 22973 } else { 22974 this.tooltip = b 22975 } 22976 return this 22977 }, 22978 clearTip : function() { 22979 if (Ext.isObject(this.tooltip)) { 22980 Ext.QuickTips.unregister(this.btnEl) 22981 } 22982 }, 22983 beforeDestroy : function() { 22984 if (this.rendered) { 22985 this.clearTip() 22986 } 22987 if (this.menu && this.destroyMenu !== false) { 22988 Ext.destroy(this.btnEl, this.menu) 22989 } 22990 Ext.destroy(this.repeater) 22991 }, 22992 onDestroy : function() { 22993 if (this.rendered) { 22994 this.doc.un("mouseover", this.monitorMouseOver, this); 22995 this.doc.un("mouseup", this.onMouseUp, this); 22996 delete this.doc; 22997 delete this.btnEl; 22998 Ext.ButtonToggleMgr.unregister(this) 22999 } 23000 Ext.Button.superclass.onDestroy.call(this) 23001 }, 23002 doAutoWidth : function() { 23003 if (this.autoWidth !== false && this.el && this.text 23004 && this.width === undefined) { 23005 this.el.setWidth("auto"); 23006 if (Ext.isIE7 && Ext.isStrict) { 23007 var a = this.btnEl; 23008 if (a && a.getWidth() > 20) { 23009 a.clip(); 23010 a.setWidth(Ext.util.TextMetrics.measure(a, this.text).width 23011 + a.getFrameWidth("lr")) 23012 } 23013 } 23014 if (this.minWidth) { 23015 if (this.el.getWidth() < this.minWidth) { 23016 this.el.setWidth(this.minWidth) 23017 } 23018 } 23019 } 23020 }, 23021 setHandler : function(b, a) { 23022 this.handler = b; 23023 this.scope = a; 23024 return this 23025 }, 23026 setText : function(a) { 23027 this.text = a; 23028 if (this.el) { 23029 this.btnEl.update(a || " "); 23030 this.setButtonClass() 23031 } 23032 this.doAutoWidth(); 23033 return this 23034 }, 23035 setIcon : function(a) { 23036 this.icon = a; 23037 if (this.el) { 23038 this.btnEl.setStyle("background-image", a ? "url(" + a + ")" : ""); 23039 this.setButtonClass() 23040 } 23041 return this 23042 }, 23043 getText : function() { 23044 return this.text 23045 }, 23046 toggle : function(b, a) { 23047 b = b === undefined ? !this.pressed : !!b; 23048 if (b != this.pressed) { 23049 if (this.rendered) { 23050 this.el[b ? "addClass" : "removeClass"]("x-btn-pressed") 23051 } 23052 this.pressed = b; 23053 if (!a) { 23054 this.fireEvent("toggle", this, b); 23055 if (this.toggleHandler) { 23056 this.toggleHandler.call(this.scope || this, this, b) 23057 } 23058 } 23059 } 23060 return this 23061 }, 23062 onDisable : function() { 23063 this.onDisableChange(true) 23064 }, 23065 onEnable : function() { 23066 this.onDisableChange(false) 23067 }, 23068 onDisableChange : function(a) { 23069 if (this.el) { 23070 if (!Ext.isIE6 || !this.text) { 23071 this.el[a ? "addClass" : "removeClass"](this.disabledClass) 23072 } 23073 this.el.dom.disabled = a 23074 } 23075 this.disabled = a 23076 }, 23077 showMenu : function() { 23078 if (this.rendered && this.menu) { 23079 if (this.tooltip) { 23080 Ext.QuickTips.getQuickTip().cancelShow(this.btnEl) 23081 } 23082 if (this.menu.isVisible()) { 23083 this.menu.hide() 23084 } 23085 this.menu.ownerCt = this; 23086 this.menu.show(this.el, this.menuAlign) 23087 } 23088 return this 23089 }, 23090 hideMenu : function() { 23091 if (this.hasVisibleMenu()) { 23092 this.menu.hide() 23093 } 23094 return this 23095 }, 23096 hasVisibleMenu : function() { 23097 return this.menu && this.menu.ownerCt == this && this.menu.isVisible() 23098 }, 23099 onRepeatClick : function(a, b) { 23100 this.onClick(b) 23101 }, 23102 onClick : function(a) { 23103 if (a) { 23104 a.preventDefault() 23105 } 23106 if (a.button !== 0) { 23107 return 23108 } 23109 if (!this.disabled) { 23110 this.doToggle(); 23111 if (this.menu && !this.hasVisibleMenu() && !this.ignoreNextClick) { 23112 this.showMenu() 23113 } 23114 this.fireEvent("click", this, a); 23115 if (this.handler) { 23116 this.handler.call(this.scope || this, this, a) 23117 } 23118 } 23119 }, 23120 doToggle : function() { 23121 if (this.enableToggle && (this.allowDepress !== false || !this.pressed)) { 23122 this.toggle() 23123 } 23124 }, 23125 isMenuTriggerOver : function(b, a) { 23126 return this.menu && !a 23127 }, 23128 isMenuTriggerOut : function(b, a) { 23129 return this.menu && !a 23130 }, 23131 onMouseOver : function(b) { 23132 if (!this.disabled) { 23133 var a = b.within(this.el, true); 23134 if (!a) { 23135 this.el.addClass("x-btn-over"); 23136 if (!this.monitoringMouseOver) { 23137 this.doc.on("mouseover", this.monitorMouseOver, this); 23138 this.monitoringMouseOver = true 23139 } 23140 this.fireEvent("mouseover", this, b) 23141 } 23142 if (this.isMenuTriggerOver(b, a)) { 23143 this.fireEvent("menutriggerover", this, this.menu, b) 23144 } 23145 } 23146 }, 23147 monitorMouseOver : function(a) { 23148 if (a.target != this.el.dom && !a.within(this.el)) { 23149 if (this.monitoringMouseOver) { 23150 this.doc.un("mouseover", this.monitorMouseOver, this); 23151 this.monitoringMouseOver = false 23152 } 23153 this.onMouseOut(a) 23154 } 23155 }, 23156 onMouseOut : function(b) { 23157 var a = b.within(this.el) && b.target != this.el.dom; 23158 this.el.removeClass("x-btn-over"); 23159 this.fireEvent("mouseout", this, b); 23160 if (this.isMenuTriggerOut(b, a)) { 23161 this.fireEvent("menutriggerout", this, this.menu, b) 23162 } 23163 }, 23164 focus : function() { 23165 this.btnEl.focus() 23166 }, 23167 blur : function() { 23168 this.btnEl.blur() 23169 }, 23170 onFocus : function(a) { 23171 if (!this.disabled) { 23172 this.el.addClass("x-btn-focus") 23173 } 23174 }, 23175 onBlur : function(a) { 23176 this.el.removeClass("x-btn-focus") 23177 }, 23178 getClickEl : function(b, a) { 23179 return this.el 23180 }, 23181 onMouseDown : function(a) { 23182 if (!this.disabled && a.button === 0) { 23183 this.getClickEl(a).addClass("x-btn-click"); 23184 this.doc.on("mouseup", this.onMouseUp, this) 23185 } 23186 }, 23187 onMouseUp : function(a) { 23188 if (a.button === 0) { 23189 this.getClickEl(a, true).removeClass("x-btn-click"); 23190 this.doc.un("mouseup", this.onMouseUp, this) 23191 } 23192 },
23193 onMenuShow : function(a) { 23194 if (this.menu.ownerCt == this) { 23195 this.menu.ownerCt = this; 23196 this.ignoreNextClick = 0; 23197 this.el.addClass("x-btn-menu-active"); 23198 this.fireEvent("menushow", this, this.menu) 23199 } 23200 }, 23201 onMenuHide : function(a) { 23202 if (this.menu.ownerCt == this) { 23203 this.el.removeClass("x-btn-menu-active"); 23204 this.ignoreNextClick = this.restoreClick.defer(250, this); 23205 this.fireEvent("menuhide", this, this.menu); 23206 delete this.menu.ownerCt 23207 } 23208 }, 23209 restoreClick : function() { 23210 this.ignoreNextClick = 0 23211 } 23212}); 23213Ext.reg("button", Ext.Button); 23214Ext.ButtonToggleMgr = function() { 23215 var a = {}; 23216 function b(e, j) { 23217 if (j) { 23218 var h = a[e.toggleGroup]; 23219 for (var d = 0, c = h.length; d < c; d++) { 23220 if (h[d] != e) { 23221 h[d].toggle(false) 23222 } 23223 } 23224 } 23225 } 23226 return { 23227 register : function(c) { 23228 if (!c.toggleGroup) { 23229 return 23230 } 23231 var d = a[c.toggleGroup]; 23232 if (!d) { 23233 d = a[c.toggleGroup] = [] 23234 } 23235 d.push(c); 23236 c.on("toggle", b) 23237 }, 23238 unregister : function(c) { 23239 if (!c.toggleGroup) { 23240 return 23241 } 23242 var d = a[c.toggleGroup]; 23243 if (d) { 23244 d.remove(c); 23245 c.un("toggle", b) 23246 } 23247 }, 23248 getPressed : function(h) { 23249 var e = a[h]; 23250 if (e) { 23251 for (var d = 0, c = e.length; d < c; d++) { 23252 if (e[d].pressed === true) { 23253 return e[d] 23254 } 23255 } 23256 } 23257 return null 23258 } 23259 } 23260}(); 23261Ext.SplitButton = Ext.extend(Ext.Button, { 23262 arrowSelector : "em", 23263 split : true, 23264 initComponent : function() { 23265 Ext.SplitButton.superclass.initComponent.call(this); 23266 this.addEvents("arrowclick") 23267 }, 23268 onRender : function() { 23269 Ext.SplitButton.superclass.onRender.apply(this, arguments); 23270 if (this.arrowTooltip) { 23271 this.el.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip 23272 } 23273 }, 23274 setArrowHandler : function(b, a) { 23275 this.arrowHandler = b; 23276 this.scope = a 23277 }, 23278 getMenuClass : function() { 23279 return "x-btn-split" + (this.arrowAlign == "bottom" ? "-bottom" : "") 23280 }, 23281 isClickOnArrow : function(c) { 23282 if (this.arrowAlign != "bottom") { 23283 var b = this.el.child("em.x-btn-split"); 23284 var a = b.getRegion().right - b.getPadding("r"); 23285 return c.getPageX() > a 23286 } else { 23287 return c.getPageY() > this.btnEl.getRegion().bottom 23288 } 23289 }, 23290 onClick : function(b, a) { 23291 b.preventDefault(); 23292 if (!this.disabled) { 23293 if (this.isClickOnArrow(b)) { 23294 if (this.menu && !this.menu.isVisible() 23295 && !this.ignoreNextClick) { 23296 this.showMenu() 23297 } 23298 this.fireEvent("arrowclick", this, b); 23299 if (this.arrowHandler) { 23300 this.arrowHandler.call(this.scope || this, this, b) 23301 } 23302 } else { 23303 this.doToggle(); 23304 this.fireEvent("click", this, b); 23305 if (this.handler) { 23306 this.handler.call(this.scope || this, this, b) 23307 } 23308 } 23309 } 23310 }, 23311 isMenuTriggerOver : function(a) { 23312 return this.menu && a.target.tagName == this.arrowSelector 23313 }, 23314 isMenuTriggerOut : function(b, a) { 23315 return this.menu && b.target.tagName != this.arrowSelector 23316 } 23317}); 23318Ext.reg("splitbutton", Ext.SplitButton); 23319Ext.CycleButton = Ext.extend(Ext.SplitButton, { 23320 getItemText : function(a) { 23321 if (a && this.showText === true) { 23322 var b = ""; 23323 if (this.prependText) { 23324 b += this.prependText 23325 } 23326 b += a.text; 23327 return b 23328 } 23329 return undefined 23330 }, 23331 setActiveItem : function(c, a) { 23332 if (!Ext.isObject(c)) { 23333 c = this.menu.getComponent(c) 23334 } 23335 if (c) { 23336 if (!this.rendered) { 23337 this.text = this.getItemText(c); 23338 this.iconCls = c.iconCls 23339 } else { 23340 var b = this.getItemText(c); 23341 if (b) { 23342 this.setText(b) 23343 } 23344 this.setIconClass(c.iconCls) 23345 } 23346 this.activeItem = c; 23347 if (!c.checked) { 23348 c.setChecked(true, a) 23349 } 23350 if (this.forceIcon) { 23351 this.setIconClass(this.forceIcon) 23352 } 23353 if (!a) { 23354 this.fireEvent("change", this, c) 23355 } 23356 } 23357 }, 23358 getActiveItem : function() { 23359 return this.activeItem 23360 }, 23361 initComponent : function() { 23362 this.addEvents("change"); 23363 if (this.changeHandler) { 23364 this.on("change", this.changeHandler, this.scope || this); 23365 delete this.changeHandler 23366 } 23367 this.itemCount = this.items.length; 23368 this.menu = { 23369 cls : "x-cycle-menu", 23370 items : [] 23371 }; 23372 var a = 0; 23373 Ext.each(this.items, function(c, b) { 23374 Ext.apply(c, { 23375 group : c.group || this.id, 23376 itemIndex : b, 23377 checkHandler : this.checkHandler, 23378 scope : this, 23379 checked : c.checked || false 23380 });
23381 this.menu.items.push(c); 23382 if (c.checked) { 23383 a = b 23384 } 23385 }, this); 23386 Ext.CycleButton.superclass.initComponent.call(this); 23387 this.on("click", this.toggleSelected, this); 23388 this.setActiveItem(a, true) 23389 }, 23390 checkHandler : function(a, b) { 23391 if (b) { 23392 this.setActiveItem(a) 23393 } 23394 }, 23395 toggleSelected : function() { 23396 var a = this.menu; 23397 a.render(); 23398 if (!a.hasLayout) { 23399 a.doLayout() 23400 } 23401 var d, b; 23402 for (var c = 1; c < this.itemCount; c++) { 23403 d = (this.activeItem.itemIndex + c) % this.itemCount; 23404 b = a.items.itemAt(d); 23405 if (!b.disabled) { 23406 b.setChecked(true); 23407 break 23408 } 23409 } 23410 } 23411 }); 23412Ext.reg("cycle", Ext.CycleButton); 23413Ext.Toolbar = function(a) { 23414 if (Ext.isArray(a)) { 23415 a = { 23416 items : a, 23417 layout : "toolbar" 23418 } 23419 } else { 23420 a = Ext.apply({ 23421 layout : "toolbar" 23422 }, a); 23423 if (a.buttons) { 23424 a.items = a.buttons 23425 } 23426 } 23427 Ext.Toolbar.superclass.constructor.call(this, a) 23428}; 23429(function() { 23430 var a = Ext.Toolbar; 23431 Ext.extend(a, Ext.Container, { 23432 defaultType : "button", 23433 enableOverflow : false, 23434 trackMenus : true, 23435 internalDefaults : { 23436 removeMode : "container", 23437 hideParent : true 23438 }, 23439 toolbarCls : "x-toolbar", 23440 initComponent : function() { 23441 a.superclass.initComponent.call(this); 23442 this.addEvents("overflowchange") 23443 }, 23444 onRender : function(c, b) { 23445 if (!this.el) { 23446 if (!this.autoCreate) { 23447 this.autoCreate = { 23448 cls : this.toolbarCls + " x-small-editor" 23449 } 23450 } 23451 this.el = c.createChild(Ext.apply({ 23452 id : this.id 23453 }, this.autoCreate), b); 23454 Ext.Toolbar.superclass.onRender.apply(this, arguments) 23455 } 23456 }, 23457 lookupComponent : function(b) { 23458 if (Ext.isString(b)) { 23459 if (b == "-") { 23460 b = new a.Separator() 23461 } else { 23462 if (b == " ") { 23463 b = new a.Spacer() 23464 } else { 23465 if (b == "->") { 23466 b = new a.Fill() 23467 } else { 23468 b = new a.TextItem(b) 23469 } 23470 } 23471 } 23472 this.applyDefaults(b) 23473 } else { 23474 if (b.isFormField || b.render) { 23475 b = this.createComponent(b) 23476 } else { 23477 if (b.tag) { 23478 b = new a.Item({ 23479 autoEl : b 23480 }) 23481 } else { 23482 if (b.tagName) { 23483 b = new a.Item({ 23484 el : b 23485 }) 23486 } else { 23487 if (Ext.isObject(b)) { 23488 b = b.xtype 23489 ? this.createComponent(b) 23490 : this.constructButton(b) 23491 } 23492 } 23493 } 23494 } 23495 } 23496 return b 23497 }, 23498 applyDefaults : function(e) { 23499 if (!Ext.isString(e)) { 23500 e = Ext.Toolbar.superclass.applyDefaults.call(this, e); 23501 var b = this.internalDefaults; 23502 if (e.events) { 23503 Ext.applyIf(e.initialConfig, b); 23504 Ext.apply(e, b) 23505 } else { 23506 Ext.applyIf(e, b) 23507 } 23508 } 23509 return e 23510 }, 23511 addSeparator : function() { 23512 return this.add(new a.Separator()) 23513 }, 23514 addSpacer : function() { 23515 return this.add(new a.Spacer()) 23516 }, 23517 addFill : function() { 23518 this.add(new a.Fill()) 23519 }, 23520 addElement : function(b) { 23521 return this.addItem(new a.Item({ 23522 el : b 23523 })) 23524 }, 23525 addItem : function(b) { 23526 return this.add.apply(this, arguments) 23527 }, 23528 addButton : function(c) { 23529 if (Ext.isArray(c)) { 23530 var e = []; 23531 for (var d = 0, b = c.length; d < b; d++) { 23532 e.push(this.addButton(c[d])) 23533 } 23534 return e 23535 } 23536 return this.add(this.constructButton(c)) 23537 }, 23538 addText : function(b) { 23539 return this.addItem(new a.TextItem(b)) 23540 }, 23541 addDom : function(b) { 23542 return this.add(new a.Item({ 23543 autoEl : b 23544 })) 23545 }, 23546 addField : function(b) { 23547 return this.add(b) 23548 }, 23549 insertButton : function(c, g) { 23550 if (Ext.isArray(g)) { 23551 var e = []; 23552 for (var d = 0, b = g.length; d < b; d++) { 23553 e.push(this.insertButton(c + d, g[d])) 23554 } 23555 return e 23556 } 23557 return Ext.Toolbar.superclass.insert.call(this, c, g) 23558 }, 23559 trackMenu : function(c, b) { 23560 if (this.trackMenus && c.menu) { 23561 var d = b ? "mun" : "mon"; 23562 this[d](c, "menutriggerover", this.onButtonTriggerOver, 23563 this); 23564 this[d](c, "menushow", this.onButtonMenuShow, this); 23565 this[d](c, "menuhide", this.onButtonMenuHide, this) 23566 } 23567 }, 23568 constructButton : function(d) { 23569 var c = d.events ? d : this.createComponent(d, d.split 23570 ? "splitbutton" 23571 : this.defaultType); 23572 return c 23573 }, 23574 onAdd : function(b) { 23575 Ext.Toolbar.superclass.onAdd.call(this); 23576 this.trackMenu(b); 23577 if (this.disabled) { 23578 b.disable() 23579 } 23580 }, 23581 onRemove : function(b) { 23582 Ext.Toolbar.superclass.onRemove.call(this); 23583 if (b == this.activeMenuBtn) { 23584 delete this.activeMenuBtn 23585 } 23586 this.trackMenu(b, true) 23587 }, 23588 onDisable : function() { 23589 this.items.each(function(b) { 23590 if (b.disable) { 23591 b.disable() 23592 } 23593 }) 23594 }, 23595 onEnable : function() { 23596 this.items.each(function(b) { 23597 if (b.enable) { 23598 b.enable() 23599 } 23600 }) 23601 }, 23602 onButtonTriggerOver : function(b) { 23603 if (this.activeMenuBtn && this.activeMenuBtn != b) { 23604 this.activeMenuBtn.hideMenu(); 23605 b.showMenu(); 23606 this.activeMenuBtn = b 23607 } 23608 }, 23609 onButtonMenuShow : function(b) { 23610 this.activeMenuBtn = b 23611 }, 23612 onButtonMenuHide : function(b) { 23613 delete this.activeMenuBtn 23614 } 23615 }); 23616 Ext.reg("toolbar", Ext.Toolbar); 23617 a.Item = Ext.extend(Ext.BoxComponent, { 23618 hideParent : true, 23619 enable : Ext.emptyFn, 23620 disable : Ext.emptyFn, 23621 focus : Ext.emptyFn 23622 }); 23623 Ext.reg("tbitem", a.Item); 23624 a.Separator = Ext.extend(a.Item, { 23625 onRender : function(c, b) { 23626 this.el = c.createChild({ 23627 tag : "span", 23628 cls : "xtb-sep" 23629 }, b) 23630 } 23631 }); 23632 Ext.reg("tbseparator", a.Separator); 23633 a.Spacer = Ext.extend(a.Item, { 23634 onRender : function(c, b) { 23635 this.el = c.createChild({ 23636 tag : "div", 23637 cls : "xtb-spacer",
23638 style : this.width ? "width:" + this.width 23639 + "px" : "" 23640 }, b) 23641 } 23642 }); 23643 Ext.reg("tbspacer", a.Spacer); 23644 a.Fill = Ext.extend(a.Item, { 23645 render : Ext.emptyFn, 23646 isFill : true 23647 }); 23648 Ext.reg("tbfill", a.Fill); 23649 a.TextItem = Ext.extend(a.Item, { 23650 constructor : function(b) { 23651 a.TextItem.superclass.constructor.call(this, Ext 23652 .isString(b) ? { 23653 text : b 23654 } : b) 23655 }, 23656 onRender : function(c, b) { 23657 this.autoEl = { 23658 cls : "xtb-text", 23659 html : this.text || "" 23660 }; 23661 a.TextItem.superclass.onRender.call(this, c, b) 23662 }, 23663 setText : function(b) { 23664 if (this.rendered) { 23665 this.el.update(b) 23666 } else { 23667 this.text = b 23668 } 23669 } 23670 }); 23671 Ext.reg("tbtext", a.TextItem); 23672 a.Button = Ext.extend(Ext.Button, {}); 23673 a.SplitButton = Ext.extend(Ext.SplitButton, {}); 23674 Ext.reg("tbbutton", a.Button); 23675 Ext.reg("tbsplit", a.SplitButton) 23676})(); 23677Ext.ButtonGroup = Ext.extend(Ext.Panel, { 23678 baseCls : "x-btn-group", 23679 layout : "table", 23680 defaultType : "button", 23681 frame : true, 23682 internalDefaults : { 23683 removeMode : "container", 23684 hideParent : true 23685 }, 23686 initComponent : function() { 23687 this.layoutConfig = this.layoutConfig || {}; 23688 Ext.applyIf(this.layoutConfig, { 23689 columns : this.columns 23690 }); 23691 if (!this.title) { 23692 this.addClass("x-btn-group-notitle") 23693 } 23694 this.on("afterlayout", this.onAfterLayout, this); 23695 Ext.ButtonGroup.superclass.initComponent.call(this) 23696 }, 23697 applyDefaults : function(b) { 23698 b = Ext.ButtonGroup.superclass.applyDefaults.call(this, b); 23699 var a = this.internalDefaults; 23700 if (b.events) { 23701 Ext.applyIf(b.initialConfig, a); 23702 Ext.apply(b, a) 23703 } else { 23704 Ext.applyIf(b, a) 23705 } 23706 return b 23707 }, 23708 onAfterLayout : function() { 23709 var a = this.body.getFrameWidth("lr") 23710 + this.body.dom.firstChild.offsetWidth; 23711 this.body.setWidth(a); 23712 this.el.setWidth(a + this.getFrameWidth()) 23713 } 23714 }); 23715Ext.reg("buttongroup", Ext.ButtonGroup); 23716(function() { 23717 var a = Ext.Toolbar; 23718 Ext.PagingToolbar = Ext.extend(Ext.Toolbar, { 23719 enableRefresh : false, 23720 pageSize : 20, 23721 displayMsg : "Displaying {0} - {1} of {2}", 23722 emptyMsg : "No data to display", 23723 beforePageText : "Page", 23724 afterPageText : "of {0}", 23725 firstText : "First Page", 23726 prevText : "Previous Page", 23727 nextText : "Next Page", 23728 lastText : "Last Page", 23729 refreshText : "Refresh", 23730 cls : 'r3-xtoolbar', 23731 navigatorNum : 10, 23732 initComponent : function() { 23733 var c = [this.first = new a.Button({ 23734 ctCls : 'x-btn-over r3-xtoolbar-pl', 23735 tooltip : this.firstText, 23736 overflowText : this.firstText, 23737 iconCls : "x-tbar-page-first", 23738 disabled : true, 23739 handler : this.moveFirst, 23740 scope : this, 23741 tabIndex : this.tabIndex > -1 ? this.tabIndex: this.tabIndex 23742 }), this.prev = new a.Button({ 23743 ctCls : 'x-btn-over r3-xtoolbar-pr', 23744 tooltip : this.prevText, 23745 overflowText : this.prevText, 23746 iconCls : "x-tbar-page-prev", 23747 disabled : true, 23748 handler : this.movePrevious, 23749 scope : this, 23750 tabIndex : this.tabIndex > -1 ? this.tabIndex: this.tabIndex 23751 }), " ", 23752 this.pagingText = document.createElement('div'), 23753 " ", this.next = new a.Button({ 23754 ctCls : 'x-btn-over r3-xtoolbar-pl', 23755 tooltip : this.nextText, 23756 overflowText : this.nextText, 23757 iconCls : "x-tbar-page-next", 23758 disabled : true, 23759 handler : this.moveNext, 23760 scope : this, 23761 tabIndex : this.tabIndex > -1 ? this.tabIndex: this.tabIndex 23762 }), this.last = new a.Button({ 23763 ctCls : 'x-btn-over r3-xtoolbar-pr', 23764 tooltip : this.lastText, 23765 overflowText : this.lastText, 23766 iconCls : "x-tbar-page-last", 23767 disabled : true, 23768 handler : this.moveLast, 23769 scope : this, 23770 tabIndex : this.tabIndex > -1 ? this.tabIndex: this.tabIndex 23771 })]; 23772 Ext.get(this.pagingText).addClass('r3-paging'); 23773 23774 if (this.enableRefresh) { 23775 c.push("-", this.refresh = new a.Button({ 23776 tooltip : this.refreshText, 23777 overflowText : this.refreshText, 23778 iconCls : "x-tbar-loading", 23779 handler : this.doRefresh, 23780 scope : this 23781 })); 23782 } 23783 var b = this.items || this.buttons || []; 23784 if (this.prependButtons) { 23785 this.items = b.concat(c) 23786 } else {
23787 this.items = c.concat(b) 23788 } 23789 delete this.buttons; 23790 if (this.displayInfo) { 23791 this.items.push("->"); 23792 this.items.push(this.displayItem = new a.TextItem({})) 23793 } 23794 Ext.PagingToolbar.superclass.initComponent.call(this); 23795 this.addEvents("change", "beforechange"); 23796 this.on("afterlayout", this.onFirstLayout, this, { 23797 single : true 23798 }); 23799 this.cursor = 0; 23800 this.bindStore(this.store, true); 23801 23802 Ext.get(this.pagingText).addListener('click', this.pageClick, this); 23803 }, 23804 onFirstLayout : function() { 23805 if (this.dsLoaded) { 23806 this.onLoad.apply(this, this.dsLoaded) 23807 } 23808 }, 23809 updateInfo : function() { 23810 if (this.displayItem) { 23811 var b = this.store.getCount(); 23812 var c = b == 0 ? this.emptyMsg : String.format( 23813 this.displayMsg, this.cursor + 1, this.cursor 23814 + b, this.store.getTotalCount()); 23815 this.displayItem.setText(c) 23816 } 23817 }, 23818 onLoad : function(b, e, j) { 23819 if (!this.rendered) { 23820 this.dsLoaded = [b, e, j]; 23821 return 23822 } 23823 var g = this.getParams(); 23824 this.cursor = (j.params && j.params[g.start]) 23825 ? j.params[g.start] 23826 : 0; 23827 var i = this.getPageData(), c = i.activePage, h = i.pages, 23828 indexNum = c <= this.navigatorNum ? 0 : parseInt((c-1)/this.navigatorNum) * this.navigatorNum, html = []; 23829 23830 for (var i=1; i<=this.navigatorNum; i++) { 23831 var pageNum = i + indexNum; 23832 23833 html.push("<a"); 23834 if (pageNum == c) { 23835 html.push(" class='active' "); 23836 } 23837 if (this.tabIndex > -1) { 23838 html.push(" tabindex='"+this.tabIndex+"' "); 23839 } 23840 html.push(" href='#' id='"+pageNum+"'>"+pageNum+"</a>"); 23841 23842 if (pageNum==h) 23843 break; 23844 } 23845 this.pagingText.innerHTML = html.join(''); 23846 23847 this.first.setDisabled(c == 1); 23848 this.prev.setDisabled(c == 1); 23849 this.next.setDisabled(c == h); 23850 this.last.setDisabled(c == h); 23851 if (this.enableRefresh) { 23852 this.refresh.enable(); 23853 } 23854 this.updateInfo(); 23855 this.fireEvent("change", this, i) 23856 }, 23857 getPageData : function() { 23858 var b = this.store.getTotalCount(); 23859 return { 23860 total : b, 23861 activePage : Math.ceil((this.cursor + this.pageSize) 23862 / this.pageSize), 23863 pages : b < this.pageSize ? 1 : Math.ceil(b 23864 / this.pageSize) 23865 } 23866 }, 23867 changePage : function(b) { 23868 this.doLoad(((b - 1) * this.pageSize).constrain(0, 23869 this.store.getTotalCount())) 23870 }, 23871 onLoadError : function() { 23872 if (!this.rendered) { 23873 return 23874 } 23875 if (this.enableRefresh) { 23876 this.refresh.enable() 23877 } 23878 }, 23879 pageClick : function(e, t) { 23880 e.stopEvent(); 23881 var j = this.getPageData(), g = this.readPage(t.innerHTML, j); 23882 if (g !== false) { 23883 g = Math.min(Math.max(1, g), j.pages) - 1; 23884 this.doLoad(g * this.pageSize) 23885 } 23886 }, 23887 readPage : function(p, e) { 23888 var c; 23889 if (!p || isNaN(c = parseInt(p, 10))) { 23890 p = e.activePage; 23891 return false 23892 } 23893 return c 23894 }, 23895 getParams : function() { 23896 return this.paramNames || this.store.paramNames 23897 }, 23898 beforeLoad : function() { 23899 if (this.rendered && this.refresh) { 23900 this.refresh.disable() 23901 } 23902 }, 23903 doLoad : function(d) { 23904 var c = {}, b = this.getParams(); 23905 c[b.start] = d; 23906 c[b.limit] = this.pageSize; 23907 if (this.fireEvent("beforechange", this, c) !== false) { 23908 this.store.load({ 23909 params : c 23910 }) 23911 } 23912 }, 23913 moveFirst : function() { 23914 this.doLoad(0) 23915 }, 23916 movePrevious : function() { 23917 this.doLoad(Math.max(0, this.cursor - this.pageSize)) 23918 }, 23919 moveNext : function() { 23920 this.doLoad(this.cursor + this.pageSize) 23921 }, 23922 moveLast : function() { 23923 var c = this.store.getTotalCount(), b = c % this.pageSize; 23924 this.doLoad(b ? (c - b) : c - this.pageSize) 23925 }, 23926 doRefresh : function() { 23927 this.doLoad(this.cursor) 23928 }, 23929 bindStore : function(c, d) { 23930 var b; 23931 if (!d && this.store) { 23932 if (c !== this.store && this.store.autoDestroy) { 23933 this.store.destroy() 23934 } else { 23935 this.store.un("beforeload", this.beforeLoad, this); 23936 this.store.un("load", this.onLoad, this); 23937 this.store.un("exception", this.onLoadError, this) 23938 } 23939 if (!c) { 23940 this.store = null 23941 } 23942 } 23943 if (c) { 23944 c = Ext.StoreMgr.lookup(c); 23945 c.on({ 23946 scope : this, 23947 beforeload : this.beforeLoad, 23948 load : this.onLoad, 23949 exception : this.onLoadError 23950 });
23951 b = true 23952 } 23953 this.store = c; 23954 if (b) { 23955 this.onLoad(c, null, {}) 23956 } 23957 }, 23958 unbind : function(b) { 23959 this.bindStore(null) 23960 }, 23961 bind : function(b) { 23962 this.bindStore(b) 23963 }, 23964 onDestroy : function() { 23965 this.bindStore(null); 23966 Ext.PagingToolbar.superclass.onDestroy.call(this) 23967 } 23968 }) 23969})(); 23970Ext.reg("paging", Ext.PagingToolbar); 23971Ext.Tip = Ext.extend(Ext.Panel, { 23972 minWidth : 40, 23973 maxWidth : 300, 23974 shadow : "sides", 23975 defaultAlign : "tl-bl?", 23976 autoRender : true, 23977 quickShowInterval : 250, 23978 frame : true, 23979 hidden : true, 23980 baseCls : "x-tip", 23981 floating : { 23982 shadow : true, 23983 shim : true, 23984 useDisplay : true, 23985 constrain : false 23986 }, 23987 autoHeight : true, 23988 closeAction : "hide", 23989 initComponent : function() { 23990 Ext.Tip.superclass.initComponent.call(this); 23991 if (this.closable && !this.title) { 23992 this.elements += ",header" 23993 } 23994 }, 23995 afterRender : function() { 23996 Ext.Tip.superclass.afterRender.call(this); 23997 if (this.closable) { 23998 this.addTool({ 23999 id : "close", 24000 handler : this[this.closeAction], 24001 scope : this 24002 }) 24003 } 24004 }, 24005 showAt : function(a) { 24006 Ext.Tip.superclass.show.call(this); 24007 if (this.measureWidth !== false 24008 && (!this.initialConfig || typeof this.initialConfig.width != "number")) { 24009 this.doAutoWidth() 24010 } 24011 if (this.constrainPosition) { 24012 a = this.el.adjustForConstraints(a) 24013 } 24014 this.setPagePosition(a[0], a[1]) 24015 }, 24016 doAutoWidth : function(a) { 24017 a = a || 0; 24018 var b = this.body.getTextWidth(); 24019 if (this.title) { 24020 b = Math.max(b, this.header.child("span").getTextWidth(this.title)) 24021 } 24022 b += this.getFrameWidth() + (this.closable ? 20 : 0) 24023 + this.body.getPadding("lr") + a; 24024 this.setWidth(b.constrain(this.minWidth, this.maxWidth)); 24025 if (Ext.isIE7 && !this.repainted) { 24026 this.el.repaint(); 24027 this.repainted = true 24028 } 24029 }, 24030 showBy : function(a, b) { 24031 if (!this.rendered) { 24032 this.render(Ext.getBody()) 24033 } 24034 this.showAt(this.el.getAlignToXY(a, b || this.defaultAlign)) 24035 }, 24036 initDraggable : function() { 24037 this.dd = new Ext.Tip.DD(this, typeof this.draggable == "boolean" 24038 ? null 24039 : this.draggable); 24040 this.header.addClass("x-tip-draggable") 24041 } 24042}); 24043Ext.reg("tip", Ext.Tip); 24044Ext.Tip.DD = function(b, a) { 24045 Ext.apply(this, a); 24046 this.tip = b; 24047 Ext.Tip.DD.superclass.constructor.call(this, b.el.id, "WindowDD-" + b.id); 24048 this.setHandleElId(b.header.id); 24049 this.scroll = false 24050}; 24051Ext.extend(Ext.Tip.DD, Ext.dd.DD, { 24052 moveOnly : true, 24053 scroll : false, 24054 headerOffsets : [100, 25], 24055 startDrag : function() { 24056 this.tip.el.disableShadow() 24057 }, 24058 endDrag : function(a) { 24059 this.tip.el.enableShadow(true) 24060 } 24061 }); 24062Ext.ToolTip = Ext.extend(Ext.Tip, { 24063 showDelay : 500, 24064 hideDelay : 200, 24065 dismissDelay : 5000, 24066 trackMouse : false, 24067 anchorToTarget : true, 24068 anchorOffset : 0, 24069 targetCounter : 0, 24070 constrainPosition : false, 24071 initComponent : function() { 24072 Ext.ToolTip.superclass.initComponent.call(this); 24073 this.lastActive = new Date(); 24074 this.initTarget(this.target); 24075 this.origAnchor = this.anchor 24076 }, 24077 onRender : function(b, a) { 24078 Ext.ToolTip.superclass.onRender.call(this, b, a); 24079 this.anchorCls = "x-tip-anchor-" + this.getAnchorPosition(); 24080 this.anchorEl = this.el.createChild({ 24081 cls : "x-tip-anchor " + this.anchorCls 24082 }) 24083 }, 24084 afterRender : function() { 24085 Ext.ToolTip.superclass.afterRender.call(this); 24086 this.anchorEl.setStyle("z-index", this.el.getZIndex() + 1) 24087 .setVisibilityMode(Ext.Element.DISPLAY) 24088 }, 24089 initTarget : function(c) { 24090 var a; 24091 if ((a = Ext.get(c))) { 24092 if (this.target) { 24093 var b = Ext.get(this.target); 24094 this.mun(b, "mouseover", this.onTargetOver, this); 24095 this.mun(b, "mouseout", this.onTargetOut, this); 24096 this.mun(b, "mousemove", this.onMouseMove, this) 24097 } 24098 this.mon(a, { 24099 mouseover : this.onTargetOver, 24100 mouseout : this.onTargetOut, 24101 mousemove : this.onMouseMove, 24102 scope : this 24103 }); 24104 this.target = a 24105 } 24106 if (this.anchor) { 24107 this.anchorTarget = this.target 24108 } 24109 }, 24110 onMouseMove : function(b) { 24111 var a = this.delegate 24112 ? b.getTarget(this.delegate) 24113 : this.triggerElement = true; 24114 if (a) { 24115 this.targetXY = b.getXY(); 24116 if (a === this.triggerElement) { 24117 if (!this.hidden && this.trackMouse) { 24118 this.setPagePosition(this.getTargetXY()) 24119 } 24120 } else { 24121 this.hide(); 24122 this.lastActive = new Date(0); 24123 this.onTargetOver(b) 24124 } 24125 } else { 24126 if (!this.closable && this.isVisible()) { 24127 this.hide() 24128 } 24129 } 24130 }, 24131 getTargetXY : function() { 24132 if (this.delegate) { 24133 this.anchorTarget = this.triggerElement 24134 } 24135 if (this.anchor) { 24136 this.targetCounter++; 24137 var c = this.getOffsets(), l = (this.anchorToTarget && !this.trackMouse) 24138 ? this.el.getAlignToXY(this.anchorTarget, this 24139 .getAnchorAlign()) 24140 : this.targetXY, a = Ext.lib.Dom.getViewWidth() - 5, h = Ext.lib.Dom 24141 .getViewHeight() 24142 - 5, i = document.documentElement, e = document.body, k = (i.scrollLeft 24143 || e.scrollLeft || 0) 24144 + 5, j = (i.scrollTop || e.scrollTop || 0) + 5, b = [
24145 l[0] + c[0], l[1] + c[1]], g = this.getSize(); 24146 this.anchorEl.removeClass(this.anchorCls); 24147 if (this.targetCounter < 2) { 24148 if (b[0] < k) { 24149 if (this.anchorToTarget) { 24150 this.defaultAlign = "l-r"; 24151 if (this.mouseOffset) { 24152 this.mouseOffset[0] *= -1 24153 } 24154 } 24155 this.anchor = "left"; 24156 return this.getTargetXY() 24157 } 24158 if (b[0] + g.width > a) { 24159 if (this.anchorToTarget) { 24160 this.defaultAlign = "r-l"; 24161 if (this.mouseOffset) { 24162 this.mouseOffset[0] *= -1 24163 } 24164 } 24165 this.anchor = "right"; 24166 return this.getTargetXY() 24167 } 24168 if (b[1] < j) { 24169 if (this.anchorToTarget) { 24170 this.defaultAlign = "t-b"; 24171 if (this.mouseOffset) { 24172 this.mouseOffset[1] *= -1 24173 } 24174 } 24175 this.anchor = "top"; 24176 return this.getTargetXY() 24177 } 24178 if (b[1] + g.height > h) { 24179 if (this.anchorToTarget) { 24180 this.defaultAlign = "b-t"; 24181 if (this.mouseOffset) { 24182 this.mouseOffset[1] *= -1 24183 } 24184 } 24185 this.anchor = "bottom"; 24186 return this.getTargetXY() 24187 } 24188 } 24189 this.anchorCls = "x-tip-anchor-" + this.getAnchorPosition(); 24190 this.anchorEl.addClass(this.anchorCls); 24191 this.targetCounter = 0; 24192 return b 24193 } else { 24194 var d = this.getMouseOffset(); 24195 return [this.targetXY[0] + d[0], this.targetXY[1] + d[1]] 24196 } 24197 }, 24198 getMouseOffset : function() { 24199 var a = this.anchor ? [0, 0] : [15, 18]; 24200 if (this.mouseOffset) { 24201 a[0] += this.mouseOffset[0]; 24202 a[1] += this.mouseOffset[1] 24203 } 24204 return a 24205 }, 24206 getAnchorPosition : function() { 24207 if (this.anchor) { 24208 this.tipAnchor = this.anchor.charAt(0) 24209 } else { 24210 var a = this.defaultAlign.match(/^([a-z]+)-([a-z]+)(\?)?$/); 24211 if (!a) {
24212 throw "AnchorTip.defaultAlign is invalid" 24213 } 24214 this.tipAnchor = a[1].charAt(0) 24215 } 24216 switch (this.tipAnchor) { 24217 case "t" : 24218 return "top"; 24219 case "b" : 24220 return "bottom"; 24221 case "r" : 24222 return "right" 24223 } 24224 return "left" 24225 }, 24226 getAnchorAlign : function() { 24227 switch (this.anchor) { 24228 case "top" : 24229 return "tl-bl"; 24230 case "left" : 24231 return "tl-tr"; 24232 case "right" : 24233 return "tr-tl"; 24234 default : 24235 return "bl-tl" 24236 } 24237 }, 24238 getOffsets : function() { 24239 var b, a = this.getAnchorPosition().charAt(0); 24240 if (this.anchorToTarget && !this.trackMouse) { 24241 switch (a) { 24242 case "t" : 24243 b = [0, 9]; 24244 break; 24245 case "b" : 24246 b = [0, -13]; 24247 break; 24248 case "r" : 24249 b = [-13, 0]; 24250 break; 24251 default : 24252 b = [9, 0]; 24253 break 24254 } 24255 } else { 24256 switch (a) { 24257 case "t" : 24258 b = [-15 - this.anchorOffset, 30]; 24259 break; 24260 case "b" : 24261 b = [-19 - this.anchorOffset, 24262 -13 - this.el.dom.offsetHeight]; 24263 break; 24264 case "r" : 24265 b = [-15 - this.el.dom.offsetWidth, -13 - this.anchorOffset]; 24266 break; 24267 default : 24268 b = [25, -13 - this.anchorOffset]; 24269 break 24270 } 24271 } 24272 var c = this.getMouseOffset(); 24273 b[0] += c[0]; 24274 b[1] += c[1]; 24275 return b 24276 }, 24277 onTargetOver : function(b) { 24278 if (this.disabled || b.within(this.target.dom, true)) { 24279 return 24280 } 24281 var a = b.getTarget(this.delegate); 24282 if (a) { 24283 this.triggerElement = a; 24284 this.clearTimer("hide"); 24285 this.targetXY = b.getXY(); 24286 this.delayShow() 24287 } 24288 }, 24289 delayShow : function() { 24290 if (this.hidden && !this.showTimer) { 24291 if (this.lastActive.getElapsed() < this.quickShowInterval) { 24292 this.show() 24293 } else { 24294 this.showTimer = this.show.defer(this.showDelay, this) 24295 } 24296 } else { 24297 if (!this.hidden && this.autoHide !== false) { 24298 this.show() 24299 } 24300 } 24301 }, 24302 onTargetOut : function(a) { 24303 if (this.disabled || a.within(this.target.dom, true)) { 24304 return 24305 } 24306 this.clearTimer("show"); 24307 if (this.autoHide !== false) { 24308 this.delayHide() 24309 } 24310 }, 24311 delayHide : function() { 24312 if (!this.hidden && !this.hideTimer) { 24313 this.hideTimer = this.hide.defer(this.hideDelay, this) 24314 } 24315 }, 24316 hide : function() { 24317 this.clearTimer("dismiss"); 24318 this.lastActive = new Date(); 24319 if (this.anchorEl) { 24320 this.anchorEl.hide() 24321 } 24322 Ext.ToolTip.superclass.hide.call(this); 24323 delete this.triggerElement 24324 }, 24325 show : function() { 24326 if (this.anchor) { 24327 this.showAt([-1000, -1000]); 24328 this.origConstrainPosition = this.constrainPosition; 24329 this.constrainPosition = false; 24330 this.anchor = this.origAnchor 24331 } 24332 this.showAt(this.getTargetXY()); 24333 if (this.anchor) { 24334 this.anchorEl.show(); 24335 this.syncAnchor(); 24336 this.constrainPosition = this.origConstrainPosition 24337 } else { 24338 this.anchorEl.hide() 24339 } 24340 }, 24341 showAt : function(a) { 24342 this.lastActive = new Date(); 24343 this.clearTimers(); 24344 Ext.ToolTip.superclass.showAt.call(this, a); 24345 if (this.dismissDelay && this.autoHide !== false) { 24346 this.dismissTimer = this.hide.defer(this.dismissDelay, this) 24347 } 24348 if (this.anchor && !this.anchorEl.isVisible()) { 24349 this.syncAnchor(); 24350 this.anchorEl.show() 24351 } else { 24352 this.anchorEl.hide() 24353 } 24354 }, 24355 syncAnchor : function() { 24356 var a, b, c; 24357 switch (this.tipAnchor.charAt(0)) { 24358 case "t" : 24359 a = "b"; 24360 b = "tl"; 24361 c = [20 + this.anchorOffset, 2]; 24362 break; 24363 case "r" : 24364 a = "l"; 24365 b = "tr"; 24366 c = [-2, 11 + this.anchorOffset]; 24367 break; 24368 case "b" : 24369 a = "t"; 24370 b = "bl"; 24371 c = [20 + this.anchorOffset, -2]; 24372 break; 24373 default : 24374 a = "r"; 24375 b = "tl"; 24376 c = [2, 11 + this.anchorOffset]; 24377 break 24378 } 24379 this.anchorEl.alignTo(this.el, a + "-" + b, c) 24380 }, 24381 setPagePosition : function(a, b) { 24382 Ext.ToolTip.superclass.setPagePosition.call(this, a, b); 24383 if (this.anchor) { 24384 this.syncAnchor() 24385 } 24386 }, 24387 clearTimer : function(a) { 24388 a = a + "Timer"; 24389 clearTimeout(this[a]); 24390 delete this[a] 24391 }, 24392 clearTimers : function() { 24393 this.clearTimer("show"); 24394 this.clearTimer("dismiss"); 24395 this.clearTimer("hide") 24396 }, 24397 onShow : function() { 24398 Ext.ToolTip.superclass.onShow.call(this); 24399 Ext.getDoc().on("mousedown", this.onDocMouseDown, this) 24400 }, 24401 onHide : function() { 24402 Ext.ToolTip.superclass.onHide.call(this); 24403 Ext.getDoc().un("mousedown", this.onDocMouseDown, this) 24404 }, 24405 onDocMouseDown : function(a) { 24406 if (this.autoHide !== true && !this.closable && !a.within(this.el.dom)) { 24407 this.disable(); 24408 this.doEnable.defer(100, this) 24409 } 24410 }, 24411 doEnable : function() { 24412 if (!this.isDestroyed) { 24413 this.enable() 24414 } 24415 }, 24416 onDisable : function() { 24417 this.clearTimers(); 24418 this.hide() 24419 }, 24420 adjustPosition : function(a, d) { 24421 if (this.constrainPosition) {
24422 var c = this.targetXY[1], b = this.getSize().height; 24423 if (d <= c && (d + b) >= c) { 24424 d = c - b - 5 24425 } 24426 } 24427 return { 24428 x : a, 24429 y : d 24430 } 24431 }, 24432 beforeDestroy : function() { 24433 this.clearTimers(); 24434 Ext.destroy(this.anchorEl); 24435 delete this.anchorEl; 24436 delete this.target; 24437 delete this.anchorTarget; 24438 delete this.triggerElement; 24439 Ext.ToolTip.superclass.beforeDestroy.call(this) 24440 }, 24441 onDestroy : function() { 24442 Ext.getDoc().un("mousedown", this.onDocMouseDown, this); 24443 Ext.ToolTip.superclass.onDestroy.call(this) 24444 } 24445}); 24446Ext.reg("tooltip", Ext.ToolTip); 24447Ext.QuickTip = Ext.extend(Ext.ToolTip, { 24448 interceptTitles : false, 24449 tagConfig : { 24450 namespace : "ext", 24451 attribute : "qtip", 24452 width : "qwidth", 24453 target : "target", 24454 title : "qtitle", 24455 hide : "hide", 24456 cls : "qclass", 24457 align : "qalign", 24458 anchor : "anchor" 24459 }, 24460 initComponent : function() { 24461 this.target = this.target || Ext.getDoc(); 24462 this.targets = this.targets || {}; 24463 Ext.QuickTip.superclass.initComponent.call(this) 24464 }, 24465 register : function(e) { 24466 var h = Ext.isArray(e) ? e : arguments; 24467 for (var g = 0, a = h.length; g < a; g++) { 24468 var l = h[g]; 24469 var k = l.target; 24470 if (k) { 24471 if (Ext.isArray(k)) { 24472 for (var d = 0, b = k.length; d < b; d++) { 24473 this.targets[Ext.id(k[d])] = l 24474 } 24475 } else { 24476 this.targets[Ext.id(k)] = l 24477 } 24478 } 24479 } 24480 }, 24481 unregister : function(a) { 24482 delete this.targets[Ext.id(a)] 24483 }, 24484 cancelShow : function(b) { 24485 var a = this.activeTarget; 24486 b = Ext.get(b).dom; 24487 if (this.isVisible()) { 24488 if (a && a.el == b) { 24489 this.hide() 24490 } 24491 } else { 24492 if (a && a.el == b) { 24493 this.clearTimer("show") 24494 } 24495 } 24496 }, 24497 getTipCfg : function(d) { 24498 var b = d.getTarget(), c, a; 24499 if (this.interceptTitles && b.title && Ext.isString(b.title)) { 24500 c = b.title; 24501 b.qtip = c; 24502 b.removeAttribute("title"); 24503 d.preventDefault() 24504 } else { 24505 a = this.tagConfig; 24506 c = b.qtip 24507 || Ext.fly(b) 24508 .getAttribute(a.attribute, a.namespace) 24509 } 24510 return c 24511 }, 24512 onTargetOver : function(i) { 24513 if (this.disabled) { 24514 return 24515 } 24516 this.targetXY = i.getXY(); 24517 var c = i.getTarget(); 24518 if (!c || c.nodeType !== 1 || c == document 24519 || c == document.body) { 24520 return 24521 } 24522 if (this.activeTarget 24523 && ((c == this.activeTarget.el) || Ext 24524 .fly(this.activeTarget.el).contains(c))) { 24525 this.clearTimer("hide"); 24526 this.show(); 24527 return 24528 } 24529 if (c && this.targets[c.id]) { 24530 this.activeTarget = this.targets[c.id]; 24531 this.activeTarget.el = c; 24532 this.anchor = this.activeTarget.anchor; 24533 if (this.anchor) { 24534 this.anchorTarget = c 24535 } 24536 this.delayShow(); 24537 return 24538 } 24539 var g, h = Ext.fly(c), b = this.tagConfig, d = b.namespace; 24540 if (g = this.getTipCfg(i)) { 24541 var a = h.getAttribute(b.hide, d); 24542 this.activeTarget = { 24543 el : c, 24544 text : g, 24545 width : h.getAttribute(b.width, d), 24546 autoHide : a != "user" && a !== "false", 24547 title : h.getAttribute(b.title, d), 24548 cls : h.getAttribute(b.cls, d), 24549 align : h.getAttribute(b.align, d) 24550 }; 24551 this.anchor = h.getAttribute(b.anchor, d); 24552 if (this.anchor) { 24553 this.anchorTarget = c 24554 } 24555 this.delayShow() 24556 } 24557 }, 24558 onTargetOut : function(a) { 24559 if (this.activeTarget && a.within(this.activeTarget.el) 24560 && !this.getTipCfg(a)) { 24561 return 24562 } 24563 this.clearTimer("show"); 24564 if (this.autoHide !== false) { 24565 this.delayHide() 24566 } 24567 }, 24568 showAt : function(b) { 24569 var a = this.activeTarget; 24570 if (a) { 24571 if (!this.rendered) { 24572 this.render(Ext.getBody()); 24573 this.activeTarget = a 24574 } 24575 if (a.width) { 24576 this.setWidth(a.width); 24577 this.body.setWidth(this.adjustBodyWidth(a.width 24578 - this.getFrameWidth())); 24579 this.measureWidth = false 24580 } else { 24581 this.measureWidth = true 24582 } 24583 this.setTitle(a.title || ""); 24584 this.body.update(a.text); 24585 this.autoHide = a.autoHide; 24586 this.dismissDelay = a.dismissDelay || this.dismissDelay; 24587 if (this.lastCls) { 24588 this.el.removeClass(this.lastCls); 24589 delete this.lastCls 24590 }
24591 if (a.cls) { 24592 this.el.addClass(a.cls); 24593 this.lastCls = a.cls 24594 } 24595 if (this.anchor) { 24596 this.constrainPosition = false 24597 } else { 24598 if (a.align) { 24599 b = this.el.getAlignToXY(a.el, a.align); 24600 this.constrainPosition = false 24601 } else { 24602 this.constrainPosition = true 24603 } 24604 } 24605 } 24606 Ext.QuickTip.superclass.showAt.call(this, b) 24607 }, 24608 hide : function() { 24609 delete this.activeTarget; 24610 Ext.QuickTip.superclass.hide.call(this) 24611 } 24612 }); 24613Ext.reg("quicktip", Ext.QuickTip); 24614Ext.QuickTips = function() { 24615 var b, a = false; 24616 return { 24617 init : function(c) { 24618 if (!b) { 24619 if (!Ext.isReady) { 24620 Ext.onReady(function() { 24621 Ext.QuickTips.init(c) 24622 }); 24623 return 24624 } 24625 b = new Ext.QuickTip({ 24626 elements : "header,body", 24627 disabled : a 24628 }); 24629 if (c !== false) { 24630 b.render(Ext.getBody()) 24631 } 24632 } 24633 }, 24634 ddDisable : function() { 24635 if (b && !a) { 24636 b.disable() 24637 } 24638 }, 24639 ddEnable : function() { 24640 if (b && !a) { 24641 b.enable() 24642 } 24643 }, 24644 enable : function() { 24645 if (b) { 24646 b.enable() 24647 } 24648 a = false 24649 }, 24650 disable : function() { 24651 if (b) { 24652 b.disable() 24653 } 24654 a = true 24655 }, 24656 isEnabled : function() { 24657 return b !== undefined && !b.disabled 24658 }, 24659 getQuickTip : function() { 24660 return b 24661 }, 24662 register : function() { 24663 b.register.apply(b, arguments) 24664 }, 24665 unregister : function() { 24666 b.unregister.apply(b, arguments) 24667 }, 24668 tips : function() { 24669 b.register.apply(b, arguments) 24670 } 24671 } 24672}(); 24673Ext.tree.TreePanel = Ext.extend(Ext.Panel, { 24674 rootVisible : true, 24675 animate : Ext.enableFx, 24676 lines : true, 24677 enableDD : false, 24678 hlDrop : Ext.enableFx, 24679 pathSeparator : "/", 24680 bubbleEvents : [], 24681 initComponent : function() { 24682 Ext.tree.TreePanel.superclass.initComponent.call(this); 24683 if (!this.eventModel) { 24684 this.eventModel = new Ext.tree.TreeEventModel(this) 24685 } 24686 var a = this.loader; 24687 if (!a) { 24688 a = new Ext.tree.TreeLoader({ 24689 dataUrl : this.dataUrl, 24690 requestMethod : this.requestMethod 24691 }) 24692 } else { 24693 if (Ext.isObject(a) && !a.load) { 24694 a = new Ext.tree.TreeLoader(a) 24695 } 24696 } 24697 this.loader = a; 24698 this.nodeHash = {}; 24699 if (this.root) { 24700 var b = this.root; 24701 delete this.root; 24702 this.setRootNode(b) 24703 } 24704 this.addEvents("append", "remove", "movenode", "insert", 24705 "beforeappend", "beforeremove", "beforemovenode", 24706 "beforeinsert", "beforeload", "load", "textchange", 24707 "beforeexpandnode", "beforecollapsenode", "expandnode", 24708 "disabledchange", "collapsenode", "beforeclick", 24709 "click", "containerclick", "checkchange", 24710 "beforedblclick", "dblclick", "containerdblclick", 24711 "contextmenu", "containercontextmenu", 24712 "beforechildrenrendered", "startdrag", "enddrag", 24713 "dragdrop", "beforenodedrop", "nodedrop", 24714 "nodedragover", "colorchange"); 24715 if (this.singleExpand) { 24716 this.on("beforeexpandnode", this.restrictExpand, this) 24717 } 24718 }, 24719 proxyNodeEvent : function(c, b, a, h, g, e, d) { 24720 if (c == "collapse" || c == "expand" || c == "beforecollapse" 24721 || c == "beforeexpand" || c == "move" 24722 || c == "beforemove") { 24723 c = c + "node" 24724 } 24725 return this.fireEvent(c, b, a, h, g, e, d) 24726 }, 24727 getRootNode : function() { 24728 return this.root 24729 }, 24730 setRootNode : function(b) { 24731 this.destroyRoot(); 24732 if (!b.render) { 24733 b = this.loader.createNode(b) 24734 } 24735 this.root = b; 24736 b.ownerTree = this; 24737 b.isRoot = true; 24738 this.registerNode(b); 24739 if (!this.rootVisible) { 24740 var a = b.attributes.uiProvider; 24741 b.ui = a ? new a(b) : new Ext.tree.RootTreeNodeUI(b) 24742 } 24743 if (this.innerCt) { 24744 this.clearInnerCt(); 24745 this.renderRoot() 24746 } 24747 return b 24748 }, 24749 clearInnerCt : function() { 24750 this.innerCt.update("") 24751 }, 24752 renderRoot : function() { 24753 this.root.render(); 24754 if (!this.rootVisible) { 24755 this.root.renderChildren() 24756 } 24757 }, 24758 getNodeById : function(a) { 24759 return this.nodeHash[a] 24760 }, 24761 registerNode : function(a) { 24762 this.nodeHash[a.id] = a 24763 }, 24764 unregisterNode : function(a) { 24765 delete this.nodeHash[a.id] 24766 }, 24767 toString : function() { 24768 return "[Tree" + (this.id ? " " + this.id : "") + "]" 24769 }, 24770 restrictExpand : function(a) { 24771 var b = a.parentNode; 24772 if (b) { 24773 if (b.expandedChild && b.expandedChild.parentNode == b) { 24774 b.expandedChild.collapse() 24775 }
24776 b.expandedChild = a 24777 } 24778 }, 24779 getChecked : function(b, c) { 24780 c = c || this.root; 24781 var d = []; 24782 var e = function() { 24783 if (this.attributes.checked) { 24784 d.push(!b ? this : (b == "id" 24785 ? this.id 24786 : this.attributes[b])) 24787 } 24788 }; 24789 c.cascade(e); 24790 return d 24791 }, 24792 getLoader : function() { 24793 return this.loader 24794 }, 24795 expandAll : function() { 24796 this.root.expand(true) 24797 }, 24798 collapseAll : function() { 24799 this.root.collapse(true) 24800 }, 24801 getSelectionModel : function() { 24802 if (!this.selModel) { 24803 this.selModel = new Ext.tree.DefaultSelectionModel() 24804 } 24805 return this.selModel 24806 }, 24807 expandPath : function(g, a, h) { 24808 if (Ext.isEmpty(g)) { 24809 if (h) { 24810 h(false, undefined) 24811 } 24812 return 24813 } 24814 a = a || "id"; 24815 var d = g.split(this.pathSeparator); 24816 var c = this.root; 24817 if (c.attributes[a] != d[1]) { 24818 if (h) { 24819 h(false, null) 24820 } 24821 return 24822 } 24823 var b = 1; 24824 var e = function() { 24825 if (++b == d.length) { 24826 if (h) { 24827 h(true, c) 24828 } 24829 return 24830 } 24831 var i = c.findChild(a, d[b]); 24832 if (!i) { 24833 if (h) { 24834 h(false, c) 24835 } 24836 return 24837 } 24838 c = i; 24839 i.expand(false, false, e) 24840 }; 24841 c.expand(false, false, e) 24842 }, 24843 selectPath : function(e, a, g) { 24844 if (Ext.isEmpty(e)) { 24845 if (g) { 24846 g(false, undefined) 24847 } 24848 return 24849 } 24850 a = a || "id"; 24851 var c = e.split(this.pathSeparator), b = c.pop(); 24852 if (c.length > 1) { 24853 var d = function(i, h) { 24854 if (i && h) { 24855 var j = h.findChild(a, b); 24856 if (j) { 24857 j.select(); 24858 if (g) { 24859 g(true, j) 24860 } 24861 } else { 24862 if (g) { 24863 g(false, j) 24864 } 24865 } 24866 } else { 24867 if (g) { 24868 g(false, j) 24869 } 24870 } 24871 }; 24872 this.expandPath(c.join(this.pathSeparator), a, d) 24873 } else { 24874 this.root.select(); 24875 if (g) { 24876 g(true, this.root) 24877 } 24878 } 24879 }, 24880 getTreeEl : function() { 24881 return this.body 24882 }, 24883 onRender : function(b, a) { 24884 Ext.tree.TreePanel.superclass.onRender.call(this, b, a); 24885 this.el.addClass("x-tree"); 24886 this.innerCt = this.body.createChild({ 24887 tag : "ul", 24888 cls : "x-tree-root-ct " 24889 + (this.useArrows 24890 ? "x-tree-arrows" 24891 : this.lines 24892 ? "x-tree-lines" 24893 : "x-tree-no-lines") 24894 }) 24895 }, 24896 initEvents : function() { 24897 Ext.tree.TreePanel.superclass.initEvents.call(this); 24898 if (this.containerScroll) { 24899 Ext.dd.ScrollManager.register(this.body) 24900 } 24901 if ((this.enableDD || this.enableDrop) && !this.dropZone) { 24902 this.dropZone = new Ext.tree.TreeDropZone(this, 24903 this.dropConfig || { 24904 ddGroup : this.ddGroup || "TreeDD", 24905 appendOnly : this.ddAppendOnly === true 24906 }) 24907 } 24908 if ((this.enableDD || this.enableDrag) && !this.dragZone) { 24909 this.dragZone = new Ext.tree.TreeDragZone(this, 24910 this.dragConfig || { 24911 ddGroup : this.ddGroup || "TreeDD", 24912 scroll : this.ddScroll 24913 }) 24914 }
24915 this.getSelectionModel().init(this) 24916 }, 24917 afterRender : function() { 24918 Ext.tree.TreePanel.superclass.afterRender.call(this); 24919 this.renderRoot() 24920 }, 24921 beforeDestroy : function() { 24922 if (this.rendered) { 24923 Ext.dd.ScrollManager.unregister(this.body); 24924 Ext.destroy(this.dropZone, this.dragZone) 24925 } 24926 this.destroyRoot(); 24927 Ext.destroy(this.loader); 24928 this.nodeHash = this.root = this.loader = null; 24929 Ext.tree.TreePanel.superclass.beforeDestroy.call(this) 24930 }, 24931 destroyRoot : function() { 24932 if (this.root && this.root.destroy) { 24933 this.root.destroy(true) 24934 } 24935 } 24936 }); 24937Ext.tree.TreePanel.nodeTypes = {}; 24938Ext.reg("treepanel", Ext.tree.TreePanel); 24939Ext.tree.TreeEventModel = function(a) { 24940 this.tree = a; 24941 this.tree.on("render", this.initEvents, this) 24942}; 24943Ext.tree.TreeEventModel.prototype = { 24944 initEvents : function() { 24945 var a = this.tree; 24946 if (a.trackMouseOver !== false) { 24947 a.mon(a.innerCt, { 24948 scope : this, 24949 mouseover : this.delegateOver, 24950 mouseout : this.delegateOut 24951 }) 24952 } 24953 a.mon(a.getTreeEl(), { 24954 scope : this, 24955 click : this.delegateClick, 24956 dblclick : this.delegateDblClick, 24957 contextmenu : this.delegateContextMenu 24958 }) 24959 }, 24960 getNode : function(b) { 24961 var a; 24962 if (a = b.getTarget(".x-tree-node-el", 10)) { 24963 var c = Ext.fly(a, "_treeEvents").getAttribute("tree-node-id", 24964 "ext"); 24965 if (c) { 24966 return this.tree.getNodeById(c) 24967 } 24968 } 24969 return null 24970 }, 24971 getNodeTarget : function(b) { 24972 var a = b.getTarget(".x-tree-node-icon", 1); 24973 if (!a) { 24974 a = b.getTarget(".x-tree-node-el", 6) 24975 } 24976 return a 24977 }, 24978 delegateOut : function(b, a) { 24979 if (!this.beforeEvent(b)) { 24980 return 24981 } 24982 if (b.getTarget(".x-tree-ec-icon", 1)) { 24983 var c = this.getNode(b); 24984 this.onIconOut(b, c); 24985 if (c == this.lastEcOver) { 24986 delete this.lastEcOver 24987 } 24988 } 24989 if ((a = this.getNodeTarget(b)) && !b.within(a, true)) { 24990 this.onNodeOut(b, this.getNode(b)) 24991 24992 if (b.target) { 24993 this.tree.fireEvent("nodeout", b); 24994 } 24995 } 24996 }, 24997 delegateOver : function(b, a) { 24998 if (!this.beforeEvent(b)) { 24999 return 25000 } 25001 if (Ext.isGecko && !this.trackingDoc) { 25002 Ext.getBody().on("mouseover", this.trackExit, this); 25003 this.trackingDoc = true 25004 } 25005 if (this.lastEcOver) { 25006 this.onIconOut(b, this.lastEcOver); 25007 delete this.lastEcOver 25008 } 25009 if (b.getTarget(".x-tree-ec-icon", 1)) { 25010 this.lastEcOver = this.getNode(b); 25011 this.onIconOver(b, this.lastEcOver) 25012 } 25013 if (a = this.getNodeTarget(b)) { 25014 this.onNodeOver(b, this.getNode(b)) 25015 25016 if (b.target) { 25017 this.tree.fireEvent("nodeover", b); 25018 } 25019 } 25020 }, 25021 trackExit : function(a) { 25022 if (this.lastOverNode) { 25023 if (this.lastOverNode.ui && !a.within(this.lastOverNode.ui.getEl())) { 25024 this.onNodeOut(a, this.lastOverNode) 25025 } 25026 delete this.lastOverNode; 25027 Ext.getBody().un("mouseover", this.trackExit, this); 25028 this.trackingDoc = false 25029 } 25030 }, 25031 delegateClick : function(b, a) { 25032 if (this.beforeEvent(b)) { 25033 if (b.getTarget("input[type=checkbox]", 1)) { 25034 this.onCheckboxClick(b, this.getNode(b)) 25035 } else { 25036 if (b.getTarget(".x-tree-ec-icon", 1)) { 25037 this.onIconClick(b, this.getNode(b)) 25038 } else { 25039 if (this.getNodeTarget(b)) { 25040 this.onNodeClick(b, this.getNode(b)) 25041 } 25042 } 25043 } 25044 } else { 25045 this.checkContainerEvent(b, "click") 25046 } 25047 }, 25048 delegateDblClick : function(b, a) { 25049 if (this.beforeEvent(b)) { 25050 if (this.getNodeTarget(b)) { 25051 this.onNodeDblClick(b, this.getNode(b)) 25052 } 25053 } else { 25054 this.checkContainerEvent(b, "dblclick") 25055 } 25056 }, 25057 delegateContextMenu : function(b, a) { 25058 if (this.beforeEvent(b)) { 25059 if (this.getNodeTarget(b)) { 25060 this.onNodeContextMenu(b, this.getNode(b)) 25061 } 25062 } else { 25063 this.checkContainerEvent(b, "contextmenu") 25064 } 25065 }, 25066 checkContainerEvent : function(b, a) { 25067 if (this.disabled) { 25068 b.stopEvent(); 25069 return false 25070 } 25071 this.onContainerEvent(b, a) 25072 }, 25073 onContainerEvent : function(b, a) { 25074 this.tree.fireEvent("container" + a, this.tree, b) 25075 }, 25076 onNodeClick : function(b, a) { 25077 a.ui.onClick(b) 25078 }, 25079 onNodeOver : function(b, a) { 25080 this.lastOverNode = a; 25081 a.ui.onOver(b) 25082 }, 25083 onNodeOut : function(b, a) { 25084 a.ui.onOut(b) 25085 }, 25086 onIconOver : function(b, a) { 25087 a.ui.addClass("x-tree-ec-over") 25088 }, 25089 onIconOut : function(b, a) { 25090 a.ui.removeClass("x-tree-ec-over") 25091 }, 25092 onIconClick : function(b, a) { 25093 a.ui.ecClick(b) 25094 }, 25095 onCheckboxClick : function(b, a) {
25096 a.ui.onCheckChange(b) 25097 }, 25098 onNodeDblClick : function(b, a) { 25099 a.ui.onDblClick(b) 25100 }, 25101 onNodeContextMenu : function(b, a) { 25102 a.ui.onContextMenu(b) 25103 }, 25104 beforeEvent : function(b) { 25105 var a = this.getNode(b); 25106 if (this.disabled || !a || !a.ui) { 25107 /* 25108 * í´ë ë´ë¶ì ë² ë ì´ë²¤í¸ ë문ì 주ìì²ë¦¬ 25109 * b.stopEvent(); 25110 */ 25111 return true 25112 } 25113 return true 25114 }, 25115 disable : function() { 25116 this.disabled = true 25117 }, 25118 enable : function() { 25119 this.disabled = false 25120 } 25121}; 25122Ext.tree.DefaultSelectionModel = Ext.extend(Ext.util.Observable, { 25123 constructor : function(a) { 25124 this.selNode = null; 25125 this.addEvents("selectionchange", "beforeselect"); 25126 Ext.apply(this, a); 25127 Ext.tree.DefaultSelectionModel.superclass.constructor.call(this) 25128 }, 25129 init : function(a) { 25130 this.tree = a; 25131 a.mon(a.getTreeEl(), "keydown", this.onKeyDown, this); 25132 a.on("click", this.onNodeClick, this) 25133 }, 25134 onNodeClick : function(a, b) { 25135 this.select(a) 25136 }, 25137 select : function(c, a) { 25138 if (!Ext.fly(c.ui.wrap).isVisible() && a) { 25139 return a.call(this, c) 25140 } 25141 var b = this.selNode; 25142 if (c == b) { 25143 c.ui.onSelectedChange(true) 25144 } else { 25145 if (this.fireEvent("beforeselect", this, c, b) !== false) { 25146 if (b && b.ui) { 25147 b.ui.onSelectedChange(false) 25148 } 25149 this.selNode = c; 25150 c.ui.onSelectedChange(true); 25151 this.fireEvent("selectionchange", this, c, b) 25152 } 25153 } 25154 return c 25155 }, 25156 unselect : function(b, a) { 25157 if (this.selNode == b) { 25158 this.clearSelections(a) 25159 } 25160 }, 25161 clearSelections : function(a) { 25162 var b = this.selNode; 25163 if (b) { 25164 b.ui.onSelectedChange(false); 25165 this.selNode = null; 25166 if (a !== true) { 25167 this.fireEvent("selectionchange", this, null) 25168 } 25169 } 25170 return b 25171 }, 25172 getSelectedNode : function() { 25173 return this.selNode 25174 }, 25175 isSelected : function(a) { 25176 return this.selNode == a 25177 }, 25178 selectPrevious : function(a) { 25179 if (!(a = a || this.selNode || this.lastSelNode)) { 25180 return null 25181 } 25182 var c = a.previousSibling; 25183 if (c) { 25184 if (!c.isExpanded() || c.childNodes.length < 1) { 25185 return this.select(c, this.selectPrevious) 25186 } else { 25187 var b = c.lastChild; 25188 while (b && b.isExpanded() && Ext.fly(b.ui.wrap).isVisible() 25189 && b.childNodes.length > 0) { 25190 b = b.lastChild 25191 } 25192 return this.select(b, this.selectPrevious) 25193 } 25194 } else { 25195 if (a.parentNode && (this.tree.rootVisible || !a.parentNode.isRoot)) { 25196 return this.select(a.parentNode, this.selectPrevious) 25197 } 25198 } 25199 return null 25200 }, 25201 selectNext : function(b) { 25202 if (!(b = b || this.selNode || this.lastSelNode)) { 25203 return null 25204 } 25205 if (b.firstChild && b.isExpanded() && Ext.fly(b.ui.wrap).isVisible()) { 25206 return this.select(b.firstChild, this.selectNext) 25207 } else { 25208 if (b.nextSibling) { 25209 return this.select(b.nextSibling, this.selectNext) 25210 } else { 25211 if (b.parentNode) { 25212 var a = null; 25213 b.parentNode.bubble(function() { 25214 if (this.nextSibling) { 25215 a = this.getOwnerTree().selModel.select( 25216 this.nextSibling, this.selectNext); 25217 return false 25218 } 25219 }); 25220 return a 25221 } 25222 } 25223 } 25224 return null 25225 }, 25226 onKeyDown : function(c) { 25227 var b = this.selNode || this.lastSelNode; 25228 var d = this; 25229 if (!b) { 25230 return 25231 } 25232 var a = c.getKey(); 25233 switch (a) { 25234 case c.DOWN : 25235 c.stopEvent(); 25236 this.selectNext(); 25237 break; 25238 case c.UP : 25239 c.stopEvent(); 25240 this.selectPrevious(); 25241 break; 25242 case c.RIGHT : 25243 c.preventDefault(); 25244 if (b.hasChildNodes()) { 25245 if (!b.isExpanded()) { 25246 b.expand() 25247 } else { 25248 if (b.firstChild) { 25249 this.select(b.firstChild, c) 25250 } 25251 } 25252 } 25253 break; 25254 case c.LEFT : 25255 c.preventDefault(); 25256 if (b.hasChildNodes() && b.isExpanded()) { 25257 b.collapse() 25258 } else { 25259 if (b.parentNode 25260 && (this.tree.rootVisible || b.parentNode != this.tree 25261 .getRootNode())) { 25262 this.select(b.parentNode, c) 25263 } 25264 } 25265 break 25266 } 25267 } 25268}); 25269Ext.tree.MultiSelectionModel = Ext.extend(Ext.util.Observable, { 25270 constructor : function(a) { 25271 this.selNodes = []; 25272 this.selMap = {}; 25273 this.addEvents("selectionchange"); 25274 Ext.apply(this, a); 25275 Ext.tree.MultiSelectionModel.superclass.constructor.call(this) 25276 }, 25277 init : function(a) { 25278 this.tree = a; 25279 a.mon(a.getTreeEl(), "keydown", this.onKeyDown, this); 25280 a.on("click", this.onNodeClick, this) 25281 }, 25282 onNodeClick : function(a, b) { 25283 if (b.ctrlKey && this.isSelected(a)) { 25284 this.unselect(a) 25285 } else { 25286 this.select(a, b, b.ctrlKey) 25287 } 25288 }, 25289 select : function(a, c, b) { 25290 if (b !== true) { 25291 this.clearSelections(true) 25292 } 25293 if (this.isSelected(a)) { 25294 this.lastSelNode = a; 25295 return a 25296 } 25297 this.selNodes.push(a); 25298 this.selMap[a.id] = a; 25299 this.lastSelNode = a; 25300 a.ui.onSelectedChange(true); 25301 this.fireEvent("selectionchange", this, this.selNodes); 25302 return a 25303 }, 25304 unselect : function(b) { 25305 if (this.selMap[b.id]) { 25306 b.ui.onSelectedChange(false); 25307 var c = this.selNodes; 25308 var a = c.indexOf(b); 25309 if (a != -1) { 25310 this.selNodes.splice(a, 1) 25311 } 25312 delete this.selMap[b.id]; 25313 this.fireEvent("selectionchange", this, this.selNodes) 25314 } 25315 }, 25316 clearSelections : function(b) { 25317 var d = this.selNodes; 25318 if (d.length > 0) { 25319 for (var c = 0, a = d.length; c < a; c++) { 25320 d[c].ui.onSelectedChange(false) 25321 } 25322 this.selNodes = []; 25323 this.selMap = {}; 25324 if (b !== true) { 25325 this.fireEvent("selectionchange", this, this.selNodes) 25326 } 25327 } 25328 }, 25329 isSelected : function(a) { 25330 return this.selMap[a.id] ? true : false 25331 }, 25332 getSelectedNodes : function() { 25333 return this.selNodes.concat([]) 25334 }, 25335 onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown, 25336 selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext, 25337 selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious 25338 }); 25339Ext.data.Tree = Ext.extend(Ext.util.Observable, { 25340 constructor : function(a) { 25341 this.nodeHash = {}; 25342 this.root = null; 25343 if (a) { 25344 this.setRootNode(a) 25345 } 25346 this.addEvents("append", "remove", "move", "insert", 25347 "beforeappend", "beforeremove", "beforemove", 25348 "beforeinsert"); 25349 Ext.data.Tree.superclass.constructor.call(this) 25350 }, 25351 pathSeparator : "/", 25352 proxyNodeEvent : function() { 25353 return this.fireEvent.apply(this, arguments) 25354 }, 25355 getRootNode : function() { 25356 return this.root 25357 }, 25358 setRootNode : function(a) { 25359 this.root = a; 25360 a.ownerTree = this; 25361 a.isRoot = true; 25362 this.registerNode(a); 25363 return a 25364 }, 25365 getNodeById : function(a) { 25366 return this.nodeHash[a] 25367 }, 25368 registerNode : function(a) { 25369 this.nodeHash[a.id] = a 25370 }, 25371 unregisterNode : function(a) { 25372 delete this.nodeHash[a.id] 25373 }, 25374 toString : function() { 25375 return "[Tree" + (this.id ? " " + this.id : "") + "]" 25376 } 25377 }); 25378Ext.data.Node = Ext.extend(Ext.util.Observable, { 25379 constructor : function(a) { 25380 this.attributes = a || {}; 25381 this.leaf = this.attributes.leaf; 25382 this.id = this.attributes.id; 25383 this.color = this.attributes.color; 25384 if (!this.id) { 25385 this.id = Ext.id(null, "xnode-"); 25386 this.attributes.id = this.id 25387 } 25388 this.childNodes = []; 25389 this.parentNode = null; 25390 this.firstChild = null; 25391 this.lastChild = null; 25392 this.previousSibling = null; 25393 this.nextSibling = null; 25394 this.addEvents({ 25395 append : true, 25396 remove : true, 25397 move : true, 25398 insert : true, 25399 beforeappend : true, 25400 beforeremove : true, 25401 beforemove : true, 25402 beforeinsert : true 25403 }); 25404 this.listeners = this.attributes.listeners; 25405 Ext.data.Node.superclass.constructor.call(this) 25406 }, 25407 fireEvent : function(b) { 25408 if (Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false) { 25409 return false 25410 } 25411 var a = this.getOwnerTree(); 25412 if (a) { 25413 if (a.proxyNodeEvent.apply(a, arguments) === false) { 25414 return false 25415 } 25416 } 25417 return true 25418 }, 25419 isLeaf : function() { 25420 return this.leaf === true 25421 }, 25422 setFirstChild : function(a) { 25423 this.firstChild = a 25424 }, 25425 setLastChild : function(a) { 25426 this.lastChild = a 25427 }, 25428 isLast : function() { 25429 return (!this.parentNode ? true : this.parentNode.lastChild == this) 25430 }, 25431 isFirst : function() { 25432 return (!this.parentNode ? true : this.parentNode.firstChild == this) 25433 }, 25434 hasChildNodes : function() { 25435 return !this.isLeaf() && this.childNodes.length > 0 25436 }, 25437 isExpandable : function() { 25438 return this.attributes.expandable || this.hasChildNodes() 25439 }, 25440 appendChild : function(e) { 25441 var g = false; 25442 if (Ext.isArray(e)) { 25443 g = e 25444 } else { 25445 if (arguments.length > 1) { 25446 g = arguments 25447 } 25448 } 25449 if (g) { 25450 for (var d = 0, a = g.length; d < a; d++) { 25451 this.appendChild(g[d]) 25452 } 25453 } else { 25454 if (this.fireEvent("beforeappend", this.ownerTree, this, e) === false) { 25455 return false 25456 } 25457 var b = this.childNodes.length; 25458 var c = e.parentNode; 25459 if (c) { 25460 if (e.fireEvent("beforemove", e.getOwnerTree(), e, c, this, b) === false) { 25461 return false 25462 } 25463 c.removeChild(e) 25464 } 25465 b = this.childNodes.length; 25466 if (b === 0) { 25467 this.setFirstChild(e) 25468 } 25469 this.childNodes.push(e); 25470 e.parentNode = this; 25471 var h = this.childNodes[b - 1];
25472 if (h) { 25473 e.previousSibling = h; 25474 h.nextSibling = e 25475 } else { 25476 e.previousSibling = null 25477 } 25478 e.nextSibling = null; 25479 this.setLastChild(e); 25480 e.setOwnerTree(this.getOwnerTree()); 25481 this.fireEvent("append", this.ownerTree, this, e, b); 25482 if (c) { 25483 e.fireEvent("move", this.ownerTree, e, c, this, b) 25484 } 25485 return e 25486 } 25487 }, 25488 removeChild : function(c, b) { 25489 var a = this.childNodes.indexOf(c); 25490 if (a == -1) { 25491 return false 25492 } 25493 if (this.fireEvent("beforeremove", this.ownerTree, this, c) === false) { 25494 return false 25495 } 25496 this.childNodes.splice(a, 1); 25497 if (c.previousSibling) { 25498 c.previousSibling.nextSibling = c.nextSibling 25499 } 25500 if (c.nextSibling) { 25501 c.nextSibling.previousSibling = c.previousSibling 25502 } 25503 if (this.firstChild == c) { 25504 this.setFirstChild(c.nextSibling) 25505 } 25506 if (this.lastChild == c) { 25507 this.setLastChild(c.previousSibling) 25508 } 25509 this.fireEvent("remove", this.ownerTree, this, c); 25510 if (b) { 25511 c.destroy(true) 25512 } else { 25513 c.clear() 25514 } 25515 return c 25516 }, 25517 clear : function(a) { 25518 this.setOwnerTree(null, a); 25519 this.parentNode = this.previousSibling = this.nextSibling = null; 25520 if (a) { 25521 this.firstChild = this.lastChild = null 25522 } 25523 }, 25524 destroy : function(a) { 25525 if (a === true) { 25526 this.purgeListeners(); 25527 this.clear(true);
25528 Ext.each(this.childNodes, function(b) { 25529 b.destroy(true) 25530 }); 25531 this.childNodes = null 25532 } else { 25533 this.remove(true) 25534 } 25535 }, 25536 insertBefore : function(d, a) { 25537 if (!a) { 25538 return this.appendChild(d) 25539 } 25540 if (d == a) { 25541 return false 25542 } 25543 if (this.fireEvent("beforeinsert", this.ownerTree, this, d, a) === false) { 25544 return false 25545 } 25546 var b = this.childNodes.indexOf(a); 25547 var c = d.parentNode; 25548 var e = b; 25549 if (c == this && this.childNodes.indexOf(d) < b) { 25550 e-- 25551 } 25552 if (c) { 25553 if (d.fireEvent("beforemove", d.getOwnerTree(), d, c, this, b, a) === false) { 25554 return false 25555 } 25556 c.removeChild(d) 25557 } 25558 if (e === 0) { 25559 this.setFirstChild(d) 25560 } 25561 this.childNodes.splice(e, 0, d); 25562 d.parentNode = this; 25563 var g = this.childNodes[e - 1]; 25564 if (g) { 25565 d.previousSibling = g; 25566 g.nextSibling = d 25567 } else { 25568 d.previousSibling = null 25569 } 25570 d.nextSibling = a; 25571 a.previousSibling = d; 25572 d.setOwnerTree(this.getOwnerTree()); 25573 this.fireEvent("insert", this.ownerTree, this, d, a); 25574 if (c) { 25575 d.fireEvent("move", this.ownerTree, d, c, this, e, a) 25576 } 25577 return d 25578 }, 25579 remove : function(a) { 25580 if (this.parentNode) { 25581 this.parentNode.removeChild(this, a) 25582 } 25583 return this 25584 }, 25585 removeAll : function(a) { 25586 var c = this.childNodes, b; 25587 while ((b = c[0])) { 25588 this.removeChild(b, a) 25589 } 25590 return this 25591 }, 25592 item : function(a) { 25593 return this.childNodes[a] 25594 }, 25595 replaceChild : function(a, c) { 25596 var b = c ? c.nextSibling : null; 25597 this.removeChild(c); 25598 this.insertBefore(a, b); 25599 return c 25600 }, 25601 indexOf : function(a) { 25602 return this.childNodes.indexOf(a) 25603 }, 25604 getOwnerTree : function() { 25605 if (!this.ownerTree) { 25606 var a = this; 25607 while (a) { 25608 if (a.ownerTree) { 25609 this.ownerTree = a.ownerTree; 25610 break 25611 } 25612 a = a.parentNode 25613 } 25614 } 25615 return this.ownerTree 25616 }, 25617 getDepth : function() { 25618 var b = 0; 25619 var a = this; 25620 while (a.parentNode) { 25621 ++b; 25622 a = a.parentNode 25623 } 25624 return b 25625 }, 25626 setOwnerTree : function(a, b) { 25627 if (a != this.ownerTree) { 25628 if (this.ownerTree) { 25629 this.ownerTree.unregisterNode(this) 25630 } 25631 this.ownerTree = a; 25632 if (b !== true) { 25633 Ext.each(this.childNodes, function(c) { 25634 c.setOwnerTree(a) 25635 }) 25636 } 25637 if (a) { 25638 a.registerNode(this) 25639 } 25640 } 25641 }, 25642 setId : function(b) { 25643 if (b !== this.id) { 25644 var a = this.ownerTree; 25645 if (a) { 25646 a.unregisterNode(this) 25647 } 25648 this.id = this.attributes.id = b; 25649 if (a) { 25650 a.registerNode(this) 25651 } 25652 this.onIdChange(b) 25653 } 25654 }, 25655 onIdChange : Ext.emptyFn, 25656 getPath : function(c) { 25657 c = c || "id"; 25658 var e = this.parentNode; 25659 var a = [this.attributes[c]]; 25660 while (e) { 25661 a.unshift(e.attributes[c]); 25662 e = e.parentNode 25663 } 25664 var d = this.getOwnerTree().pathSeparator; 25665 return d + a.join(d) 25666 }, 25667 bubble : function(c, b, a) { 25668 var d = this; 25669 while (d) { 25670 if (c.apply(b || d, a || [d]) === false) { 25671 break 25672 } 25673 d = d.parentNode 25674 } 25675 }, 25676 cascade : function(g, e, b) { 25677 if (g.apply(e || this, b || [this]) !== false) { 25678 var d = this.childNodes; 25679 for (var c = 0, a = d.length; c < a; c++) { 25680 d[c].cascade(g, e, b) 25681 } 25682 } 25683 }, 25684 eachChild : function(g, e, b) { 25685 var d = this.childNodes; 25686 for (var c = 0, a = d.length; c < a; c++) { 25687 if (g.apply(e || d[c], b || [d[c]]) === false) { 25688 break 25689 } 25690 } 25691 }, 25692 findChild : function(b, c, a) { 25693 return this.findChildBy(function() { 25694 return this.attributes[b] == c 25695 }, null, a) 25696 }, 25697 findChildBy : function(h, g, b) { 25698 var e = this.childNodes, a = e.length, d = 0, j, c; 25699 for (; d < a; d++) { 25700 j = e[d]; 25701 if (h.call(g || j, j) === true) { 25702 return j 25703 } else { 25704 if (b) { 25705 c = j.findChildBy(h, g, b); 25706 if (c != null) { 25707 return c 25708 } 25709 } 25710 } 25711 } 25712 return null 25713 }, 25714 sort : function(e, d) { 25715 var c = this.childNodes; 25716 var a = c.length; 25717 if (a > 0) { 25718 var g = d ? function() { 25719 e.apply(d, arguments) 25720 } : e; 25721 c.sort(g); 25722 for (var b = 0; b < a; b++) { 25723 var h = c[b]; 25724 h.previousSibling = c[b - 1];
25725 h.nextSibling = c[b + 1]; 25726 if (b === 0) { 25727 this.setFirstChild(h) 25728 } 25729 if (b == a - 1) { 25730 this.setLastChild(h) 25731 } 25732 } 25733 } 25734 }, 25735 contains : function(a) { 25736 return a.isAncestor(this) 25737 }, 25738 isAncestor : function(a) { 25739 var b = this.parentNode; 25740 while (b) { 25741 if (b == a) { 25742 return true 25743 } 25744 b = b.parentNode 25745 } 25746 return false 25747 }, 25748 toString : function() { 25749 return "[Node" + (this.id ? " " + this.id : "") + "]" 25750 } 25751}); 25752Ext.tree.TreeNode = Ext.extend(Ext.data.Node, { 25753 constructor : function(a) { 25754 a = a || {}; 25755 if (Ext.isString(a)) { 25756 a = { 25757 text : a 25758 } 25759 } 25760 this.childrenRendered = false; 25761 this.rendered = false; 25762 Ext.tree.TreeNode.superclass.constructor.call(this, a); 25763 this.expanded = a.expanded === true; 25764 this.isTarget = a.isTarget !== false; 25765 this.draggable = a.draggable !== false && a.allowDrag !== false; 25766 this.allowChildren = a.allowChildren !== false && a.allowDrop !== false; 25767 this.text = a.text; 25768 this.disabled = a.disabled === true; 25769 this.hidden = a.hidden === true; 25770 this.addEvents("textchange", "beforeexpand", "beforecollapse", 25771 "expand", "disabledchange", "collapse", "beforeclick", "click", 25772 "checkchange", "beforedblclick", "dblclick", "contextmenu", 25773 "beforechildrenrendered", "colorchange"); 25774 var b = this.attributes.uiProvider || this.defaultUI 25775 || Ext.tree.TreeNodeUI; 25776 this.ui = new b(this) 25777 }, 25778 preventHScroll : true, 25779 isExpanded : function() { 25780 return this.expanded 25781 }, 25782 getUI : function() { 25783 return this.ui 25784 }, 25785 getLoader : function() { 25786 var a; 25787 return this.loader 25788 || ((a = this.getOwnerTree()) && a.loader 25789 ? a.loader 25790 : (this.loader = new Ext.tree.TreeLoader())) 25791 }, 25792 setFirstChild : function(a) { 25793 var b = this.firstChild; 25794 Ext.tree.TreeNode.superclass.setFirstChild.call(this, a); 25795 if (this.childrenRendered && b && a != b) { 25796 b.renderIndent(true, true) 25797 } 25798 if (this.rendered) { 25799 this.renderIndent(true, true) 25800 } 25801 }, 25802 setLastChild : function(b) { 25803 var a = this.lastChild; 25804 Ext.tree.TreeNode.superclass.setLastChild.call(this, b); 25805 if (this.childrenRendered && a && b != a) { 25806 a.renderIndent(true, true) 25807 } 25808 if (this.rendered) { 25809 this.renderIndent(true, true) 25810 } 25811 }, 25812 appendChild : function(b) { 25813 if (!b.render && !Ext.isArray(b)) { 25814 b = this.getLoader().createNode(b) 25815 } 25816 var a = Ext.tree.TreeNode.superclass.appendChild.call(this, b); 25817 if (a && this.childrenRendered) { 25818 a.render() 25819 } 25820 this.ui.updateExpandIcon(); 25821 return a 25822 }, 25823 removeChild : function(b, a) { 25824 this.ownerTree.getSelectionModel().unselect(b); 25825 Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments); 25826 if (!a) { 25827 var c = b.ui.rendered; 25828 if (c) { 25829 b.ui.remove() 25830 } 25831 if (c && this.childNodes.length < 1) { 25832 this.collapse(false, false) 25833 } else { 25834 this.ui.updateExpandIcon() 25835 } 25836 if (!this.firstChild && !this.isHiddenRoot()) { 25837 this.childrenRendered = false 25838 } 25839 } 25840 return b 25841 }, 25842 insertBefore : function(c, a) { 25843 if (!c.render) { 25844 c = this.getLoader().createNode(c) 25845 } 25846 var b = Ext.tree.TreeNode.superclass.insertBefore.call(this, c, a); 25847 if (b && a && this.childrenRendered) { 25848 c.render() 25849 } 25850 this.ui.updateExpandIcon(); 25851 return b 25852 }, 25853 setText : function(b) { 25854 var a = this.text; 25855 this.text = this.attributes.text = b; 25856 if (this.rendered) { 25857 this.ui.onTextChange(this, b, a) 25858 } 25859 this.fireEvent("textchange", this, b, a) 25860 }, 25861 setPaletteColor : function (b) { 25862 var a = this.color, 25863 s = '-label-palette-'; 25864 this.color = this.attributes.color = b; 25865 if (this.rendered) { 25866 this.ui.onColorChange(this, b,a, s) 25867 } 25868 this.fireEvent('colorchange', this,b,a, s) 25869 }, 25870 setIconCls : function(b) { 25871 var a = this.attributes.iconCls; 25872 this.attributes.iconCls = b; 25873 if (this.rendered) { 25874 this.ui.onIconClsChange(this, b, a) 25875 } 25876 }, 25877 setTooltip : function(a, b) { 25878 this.attributes.qtip = a; 25879 this.attributes.qtipTitle = b; 25880 if (this.rendered) { 25881 this.ui.onTipChange(this, a, b) 25882 } 25883 }, 25884 setIcon : function(a) { 25885 this.attributes.icon = a; 25886 if (this.rendered) { 25887 this.ui.onIconChange(this, a) 25888 } 25889 }, 25890 setHref : function(a, b) { 25891 this.attributes.href = a; 25892 this.attributes.hrefTarget = b; 25893 if (this.rendered) { 25894 this.ui.onHrefChange(this, a, b) 25895 } 25896 }, 25897 setCls : function(b) { 25898 var a = this.attributes.cls; 25899 this.attributes.cls = b; 25900 if (this.rendered) { 25901 this.ui.onClsChange(this, b, a) 25902 } 25903 }, 25904 select : function() { 25905 var a = this.getOwnerTree(); 25906 if (a) { 25907 a.getSelectionModel().select(this) 25908 } 25909 }, 25910 unselect : function(a) { 25911 var b = this.getOwnerTree(); 25912 if (b) { 25913 b.getSelectionModel().unselect(this, a) 25914 } 25915 }, 25916 isSelected : function() { 25917 var a = this.getOwnerTree(); 25918 return a ? a.getSelectionModel().isSelected(this) : false 25919 }, 25920 expand : function(a, c, d, b) { 25921 if (!this.expanded) { 25922 if (this.fireEvent("beforeexpand", this, a, c) === false) { 25923 return 25924 } 25925 if (!this.childrenRendered) { 25926 this.renderChildren() 25927 } 25928 this.expanded = true; 25929 if (!this.isHiddenRoot() 25930 && (this.getOwnerTree().animate && c !== false) || c) { 25931 this.ui.animExpand(function() { 25932 this.fireEvent("expand", this); 25933 this.runCallback(d, b || this, [this]); 25934 if (a === true) { 25935 this.expandChildNodes(true, true) 25936 } 25937 }.createDelegate(this)); 25938 return 25939 } else { 25940 this.ui.expand(); 25941 this.fireEvent("expand", this); 25942 this.runCallback(d, b || this, [this]) 25943 } 25944 } else { 25945 this.runCallback(d, b || this, [this]) 25946 } 25947 if (a === true) { 25948 this.expandChildNodes(true) 25949 } 25950 }, 25951 runCallback : function(a, c, b) { 25952 if (Ext.isFunction(a)) { 25953 a.apply(c, b) 25954 } 25955 }, 25956 isHiddenRoot : function() { 25957 return this.isRoot && !this.getOwnerTree().rootVisible 25958 }, 25959 collapse : function(b, g, h, e) { 25960 if (this.expanded && !this.isHiddenRoot()) {
25961 if (this.fireEvent("beforecollapse", this, b, g) === false) { 25962 return 25963 } 25964 this.expanded = false; 25965 if ((this.getOwnerTree().animate && g !== false) || g) { 25966 this.ui.animCollapse(function() { 25967 this.fireEvent("collapse", this); 25968 this.runCallback(h, e || this, [this]); 25969 if (b === true) { 25970 this.collapseChildNodes(true) 25971 } 25972 }.createDelegate(this)); 25973 return 25974 } else { 25975 this.ui.collapse(); 25976 this.fireEvent("collapse", this); 25977 this.runCallback(h, e || this, [this]) 25978 } 25979 } else { 25980 if (!this.expanded) { 25981 this.runCallback(h, e || this, [this]) 25982 } 25983 } 25984 if (b === true) { 25985 var d = this.childNodes; 25986 for (var c = 0, a = d.length; c < a; c++) { 25987 d[c].collapse(true, false) 25988 } 25989 } 25990 }, 25991 delayedExpand : function(a) { 25992 if (!this.expandProcId) { 25993 this.expandProcId = this.expand.defer(a, this) 25994 } 25995 }, 25996 cancelExpand : function() { 25997 if (this.expandProcId) { 25998 clearTimeout(this.expandProcId) 25999 } 26000 this.expandProcId = false 26001 }, 26002 toggle : function() { 26003 if (this.expanded) { 26004 this.collapse() 26005 } else { 26006 this.expand() 26007 } 26008 }, 26009 ensureVisible : function(c, b) { 26010 var a = this.getOwnerTree(); 26011 a.expandPath(this.parentNode ? this.parentNode.getPath() : this 26012 .getPath(), false, function() { 26013 var d = a.getNodeById(this.id); 26014 a.getTreeEl().scrollChildIntoView(d.ui.anchor); 26015 this.runCallback(c, b || this, [this]) 26016 }.createDelegate(this)) 26017 }, 26018 expandChildNodes : function(b, e) { 26019 var d = this.childNodes, c, a = d.length; 26020 for (c = 0; c < a; c++) { 26021 d[c].expand(b, e) 26022 } 26023 }, 26024 collapseChildNodes : function(b) { 26025 var d = this.childNodes; 26026 for (var c = 0, a = d.length; c < a; c++) { 26027 d[c].collapse(b) 26028 } 26029 }, 26030 disable : function() { 26031 this.disabled = true; 26032 this.unselect(); 26033 if (this.rendered && this.ui.onDisableChange) { 26034 this.ui.onDisableChange(this, true) 26035 } 26036 this.fireEvent("disabledchange", this, true) 26037 }, 26038 enable : function() { 26039 this.disabled = false; 26040 if (this.rendered && this.ui.onDisableChange) { 26041 this.ui.onDisableChange(this, false) 26042 } 26043 this.fireEvent("disabledchange", this, false) 26044 }, 26045 renderChildren : function(b) { 26046 if (b !== false) { 26047 this.fireEvent("beforechildrenrendered", this) 26048 } 26049 var d = this.childNodes; 26050 for (var c = 0, a = d.length; c < a; c++) { 26051 d[c].render(true) 26052 } 26053 this.childrenRendered = true 26054 }, 26055 sort : function(e, d) { 26056 Ext.tree.TreeNode.superclass.sort.apply(this, arguments); 26057 if (this.childrenRendered) { 26058 var c = this.childNodes; 26059 for (var b = 0, a = c.length; b < a; b++) { 26060 c[b].render(true) 26061 } 26062 } 26063 }, 26064 render : function(a) { 26065 this.ui.render(a); 26066 if (!this.rendered) { 26067 this.getOwnerTree().registerNode(this); 26068 this.rendered = true; 26069 if (this.expanded) { 26070 this.expanded = false; 26071 this.expand(false, false) 26072 } 26073 } 26074 }, 26075 renderIndent : function(b, e) { 26076 if (e) { 26077 this.ui.childIndent = null 26078 } 26079 this.ui.renderIndent(); 26080 if (b === true && this.childrenRendered) { 26081 var d = this.childNodes; 26082 for (var c = 0, a = d.length; c < a; c++) { 26083 d[c].renderIndent(true, e) 26084 } 26085 } 26086 }, 26087 beginUpdate : function() { 26088 this.childrenRendered = false 26089 }, 26090 endUpdate : function() { 26091 if (this.expanded && this.rendered) { 26092 this.renderChildren() 26093 } 26094 }, 26095 destroy : function(a) { 26096 if (a === true) { 26097 this.unselect(true) 26098 } 26099 Ext.tree.TreeNode.superclass.destroy.call(this, a); 26100 Ext.destroy(this.ui, this.loader); 26101 this.ui = this.loader = null 26102 }, 26103 onIdChange : function(a) { 26104 this.ui.onIdChange(a) 26105 } 26106}); 26107Ext.tree.TreePanel.nodeTypes.node = Ext.tree.TreeNode; 26108Ext.tree.AsyncTreeNode = function(a) { 26109 this.loaded = a && a.loaded === true; 26110 this.loading = false; 26111 Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments); 26112 this.addEvents("beforeload", "load") 26113}; 26114Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, { 26115 expand : function(b, e, h, c) { 26116 if (this.loading) { 26117 var g; 26118 var d = function() { 26119 if (!this.loading) { 26120 clearInterval(g); 26121 this.expand(b, e, h, c) 26122 } 26123 }.createDelegate(this); 26124 g = setInterval(d, 200); 26125 return 26126 } 26127 if (!this.loaded) { 26128 if (this.fireEvent("beforeload", this) === false) { 26129 return 26130 } 26131 this.loading = true; 26132 this.ui.beforeLoad(this); 26133 var a = this.loader || this.attributes.loader 26134 || this.getOwnerTree().getLoader(); 26135 if (a) { 26136 a.load(this, this.loadComplete.createDelegate(this, [b, 26137 e, h, c]), this); 26138 return 26139 } 26140 } 26141 Ext.tree.AsyncTreeNode.superclass.expand.call(this, b, e, h, c) 26142 }, 26143 isLoading : function() { 26144 return this.loading 26145 }, 26146 loadComplete : function(a, c, d, b) { 26147 this.loading = false; 26148 this.loaded = true; 26149 this.ui.afterLoad(this); 26150 this.fireEvent("load", this); 26151 this.expand(a, c, d, b) 26152 }, 26153 isLoaded : function() { 26154 return this.loaded 26155 }, 26156 hasChildNodes : function() { 26157 if (!this.isLeaf() && !this.loaded) { 26158 return true 26159 } else { 26160 return Ext.tree.AsyncTreeNode.superclass.hasChildNodes 26161 .call(this) 26162 } 26163 }, 26164 reload : function(b, a) { 26165 this.collapse(false, false); 26166 while (this.firstChild) { 26167 this.removeChild(this.firstChild).destroy() 26168 } 26169 this.childrenRendered = false; 26170 this.loaded = false; 26171 if (this.isHiddenRoot()) { 26172 this.expanded = false 26173 } 26174 this.expand(false, false, b, a) 26175 } 26176 }); 26177Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode; 26178Ext.tree.TreeNodeUI = Ext.extend(Object, { 26179 constructor : function(a) { 26180 Ext.apply(this, { 26181 node : a, 26182 rendered : false, 26183 animating : false, 26184 wasLeaf : true, 26185 ecc : "x-tree-ec-icon x-tree-elbow", 26186 emptyIcon : Ext.BLANK_IMAGE_URL 26187 }) 26188 }, 26189 removeChild : function(a) { 26190 if (this.rendered) { 26191 this.ctNode.removeChild(a.ui.getEl()) 26192 } 26193 }, 26194 beforeLoad : function() { 26195 this.addClass("x-tree-node-loading") 26196 }, 26197 afterLoad : function() { 26198 this.removeClass("x-tree-node-loading") 26199 }, 26200 onTextChange : function(b, c, a) { 26201 if (this.rendered) { 26202 this.textNode.innerHTML = c 26203 } 26204 }, 26205 onColorChange : function(b, c, a, s) { 26206 if (this.rendered) { 26207 var arr, tmp = [], el; 26208 el = Ext.get(this.elNode).select('.folder-label-color').elements[0]; 26209 if (el) { 26210 arr = el.getAttribute('class').split(s); 26211 tmp.push(arr.shift()); 26212 tmp.push(s); 26213 tmp.push(c); 26214 el.setAttribute('class',tmp.join(''));
26215 } 26216 } 26217 }, 26218 onIconClsChange : function(c, a, b) { 26219 if (this.rendered) { 26220 Ext.fly(this.iconNode).replaceClass(b, a) 26221 } 26222 }, 26223 onIconChange : function(b, a) { 26224 if (this.rendered) { 26225 var c = Ext.isEmpty(a); 26226 this.iconNode.src = c ? this.emptyIcon : a; 26227 Ext.fly(this.iconNode)[c ? "removeClass" : "addClass"]("x-tree-node-inline-icon") 26228 } 26229 }, 26230 onTipChange : function(b, c, d) { 26231 if (this.rendered) { 26232 var a = Ext.isDefined(d); 26233 if (this.textNode.setAttributeNS) { 26234 this.textNode.setAttributeNS("ext", "qtip", c); 26235 if (a) { 26236 this.textNode.setAttributeNS("ext", "qtitle", d) 26237 } 26238 } else { 26239 this.textNode.setAttribute("ext:qtip", c); 26240 if (a) { 26241 this.textNode.setAttribute("ext:qtitle", d) 26242 } 26243 } 26244 } 26245 }, 26246 onHrefChange : function(b, a, c) { 26247 if (this.rendered) { 26248 this.anchor.href = this.getHref(a); 26249 if (Ext.isDefined(c)) { 26250 this.anchor.target = c 26251 } 26252 } 26253 }, 26254 onClsChange : function(c, a, b) { 26255 if (this.rendered) { 26256 Ext.fly(this.elNode).replaceClass(b, a) 26257 } 26258 }, 26259 onDisableChange : function(a, b) { 26260 this.disabled = b; 26261 if (this.checkbox) { 26262 this.checkbox.disabled = b 26263 } 26264 this[b ? "addClass" : "removeClass"]("x-tree-node-disabled") 26265 }, 26266 onSelectedChange : function(a) { 26267 if (a) { 26268 this.focus(); 26269 this.addClass("x-tree-selected") 26270 } else { 26271 this.removeClass("x-tree-selected") 26272 } 26273 }, 26274 onMove : function(a, h, e, g, d, b) { 26275 this.childIndent = null; 26276 if (this.rendered) { 26277 var i = g.ui.getContainer(); 26278 if (!i) { 26279 this.holder = document.createElement("div"); 26280 this.holder.appendChild(this.wrap); 26281 return 26282 } 26283 var c = b ? b.ui.getEl() : null; 26284 if (c) { 26285 i.insertBefore(this.wrap, c) 26286 } else { 26287 i.appendChild(this.wrap) 26288 } 26289 this.node.renderIndent(true, e != g) 26290 } 26291 }, 26292 addClass : function(a) { 26293 if (this.elNode) { 26294 Ext.fly(this.elNode).addClass(a) 26295 } 26296 }, 26297 removeClass : function(a) { 26298 if (this.elNode) { 26299 Ext.fly(this.elNode).removeClass(a) 26300 } 26301 }, 26302 remove : function() { 26303 if (this.rendered) { 26304 this.holder = document.createElement("div"); 26305 this.holder.appendChild(this.wrap) 26306 } 26307 }, 26308 fireEvent : function() { 26309 return this.node.fireEvent.apply(this.node, arguments) 26310 }, 26311 initEvents : function() { 26312 this.node.on("move", this.onMove, this); 26313 if (this.node.disabled) { 26314 this.onDisableChange(this.node, true) 26315 } 26316 if (this.node.hidden) { 26317 this.hide() 26318 } 26319 var b = this.node.getOwnerTree(); 26320 var a = b.enableDD || b.enableDrag || b.enableDrop; 26321 if (a && (!this.node.isRoot || b.rootVisible)) { 26322 Ext.dd.Registry.register(this.elNode, { 26323 node : this.node, 26324 handles : this.getDDHandles(), 26325 isHandle : false 26326 }) 26327 } 26328 }, 26329 getDDHandles : function() { 26330 return [this.iconNode, this.textNode, this.elNode] 26331 }, 26332 hide : function() { 26333 this.node.hidden = true; 26334 if (this.wrap) { 26335 this.wrap.style.display = "none" 26336 } 26337 }, 26338 show : function() { 26339 this.node.hidden = false; 26340 if (this.wrap) { 26341 this.wrap.style.display = "" 26342 } 26343 }, 26344 onContextMenu : function(a) { 26345 if (this.node.hasListener("contextmenu") 26346 || this.node.getOwnerTree().hasListener("contextmenu")) { 26347 a.preventDefault(); 26348 this.focus(); 26349 this.fireEvent("contextmenu", this.node, a) 26350 } 26351 }, 26352 onClick : function(c) { 26353 if (this.dropping) { 26354 c.stopEvent(); 26355 return 26356 } 26357 if (this.fireEvent("beforeclick", this.node, c) !== false) { 26358 var b = c.getTarget("a"); 26359 if (!this.disabled && this.node.attributes.href && b) { 26360 this.fireEvent("click", this.node, c); 26361 return 26362 } else { 26363 if (b && c.ctrlKey) { 26364 c.stopEvent() 26365 } 26366 } 26367 c.preventDefault(); 26368 if (this.disabled) { 26369 return 26370 } 26371 if (this.node.attributes.singleClickExpand && !this.animating 26372 && this.node.isExpandable()) { 26373 this.node.toggle() 26374 } 26375 this.fireEvent("click", this.node, c) 26376 } else { 26377 c.stopEvent() 26378 } 26379 }, 26380 onDblClick : function(a) { 26381 a.preventDefault(); 26382 if (this.disabled) { 26383 return 26384 } 26385 if (this.fireEvent("beforedblclick", this.node, a) !== false) { 26386 if (this.checkbox) { 26387 this.toggleCheck() 26388 } 26389 if (!this.animating && this.node.isExpandable()) {
26390 this.node.toggle() 26391 } 26392 this.fireEvent("dblclick", this.node, a) 26393 } 26394 }, 26395 onOver : function(a) { 26396 this.addClass("x-tree-node-over") 26397 }, 26398 onOut : function(a) { 26399 this.removeClass("x-tree-node-over") 26400 }, 26401 onCheckChange : function() { 26402 var a = this.checkbox.checked; 26403 this.checkbox.defaultChecked = a; 26404 this.node.attributes.checked = a; 26405 this.fireEvent("checkchange", this.node, a) 26406 }, 26407 ecClick : function(a) { 26408 if (!this.animating && this.node.isExpandable()) { 26409 this.node.toggle() 26410 } 26411 }, 26412 startDrop : function() { 26413 this.dropping = true 26414 }, 26415 endDrop : function() { 26416 setTimeout(function() { 26417 this.dropping = false 26418 }.createDelegate(this), 50) 26419 }, 26420 expand : function() { 26421 this.updateExpandIcon(); 26422 this.ctNode.style.display = "" 26423 }, 26424 focus : function() { 26425 if (!this.node.preventHScroll) { 26426 try { 26427 this.anchor.focus() 26428 } catch (c) { 26429 } 26430 } else { 26431 try { 26432 var b = this.node.getOwnerTree().getTreeEl().dom; 26433 var a = b.scrollLeft; 26434 this.anchor.focus(); 26435 b.scrollLeft = a 26436 } catch (c) { 26437 } 26438 } 26439 }, 26440 toggleCheck : function(b) { 26441 var a = this.checkbox; 26442 if (a) { 26443 a.checked = (b === undefined ? !a.checked : b); 26444 this.onCheckChange() 26445 } 26446 }, 26447 blur : function() { 26448 try { 26449 this.anchor.blur() 26450 } catch (a) { 26451 } 26452 }, 26453 animExpand : function(b) { 26454 var a = Ext.get(this.ctNode); 26455 a.stopFx(); 26456 if (!this.node.isExpandable()) { 26457 this.updateExpandIcon(); 26458 this.ctNode.style.display = ""; 26459 Ext.callback(b); 26460 return 26461 } 26462 this.animating = true; 26463 this.updateExpandIcon(); 26464 a.slideIn("t", { 26465 callback : function() { 26466 this.animating = false; 26467 Ext.callback(b) 26468 }, 26469 scope : this, 26470 duration : this.node.ownerTree.duration || 0.25 26471 }) 26472 }, 26473 highlight : function() { 26474 var a = this.node.getOwnerTree(); 26475 Ext.fly(this.wrap).highlight(a.hlColor || "C3DAF9", { 26476 endColor : a.hlBaseColor 26477 }) 26478 }, 26479 collapse : function() { 26480 this.updateExpandIcon(); 26481 this.ctNode.style.display = "none" 26482 }, 26483 animCollapse : function(b) { 26484 var a = Ext.get(this.ctNode); 26485 a.enableDisplayMode("block"); 26486 a.stopFx(); 26487 this.animating = true; 26488 this.updateExpandIcon(); 26489 a.slideOut("t", { 26490 callback : function() { 26491 this.animating = false; 26492 Ext.callback(b) 26493 }, 26494 scope : this, 26495 duration : this.node.ownerTree.duration || 0.25 26496 }) 26497 }, 26498 getContainer : function() { 26499 return this.ctNode 26500 }, 26501 getEl : function() { 26502 return this.wrap 26503 }, 26504 appendDDGhost : function(a) { 26505 a.appendChild(this.elNode.cloneNode(true)) 26506 }, 26507 getDDRepairXY : function() { 26508 return Ext.lib.Dom.getXY(this.iconNode) 26509 }, 26510 onRender : function() { 26511 this.render() 26512 }, 26513 render : function(c) { 26514 var e = this.node, b = e.attributes; 26515 var d = e.parentNode 26516 ? e.parentNode.ui.getContainer() 26517 : e.ownerTree.innerCt.dom; 26518 if (!this.rendered) { 26519 this.rendered = true; 26520 this.renderElements(e, b, d, c); 26521 if (b.qtip) { 26522 this.onTipChange(e, b.qtip, b.qtipTitle) 26523 } else { 26524 if (b.qtipCfg) { 26525 b.qtipCfg.target = Ext.id(this.textNode); 26526 Ext.QuickTips.register(b.qtipCfg) 26527 } 26528 } 26529 this.initEvents(); 26530 if (!this.node.expanded) { 26531 this.updateExpandIcon(true) 26532 } 26533 } else { 26534 if (c === true) { 26535 d.appendChild(this.wrap) 26536 } 26537 } 26538 }, 26539 renderElements : function(e, k, j, l) { 26540 this.indentMarkup = e.parentNode 26541 ? e.parentNode.ui.getChildIndent() 26542 : ""; 26543 var g = Ext.isBoolean(k.checked), b, c = this.getHref(k.href), d = [ 26544 '<li class="x-tree-node"><div ext:tree-node-id="', 26545 e.id, 26546 '" class="x-tree-node-el x-tree-node-leaf x-unselectable ', 26547 k.cls, 26548 '" unselectable="on">', 26549 '<span class="x-tree-node-indent">', 26550 this.indentMarkup, 26551 "</span>", 26552 '<img alt="" src="', 26553 this.emptyIcon, 26554 '" class="x-tree-ec-icon x-tree-elbow" />', 26555 '<img alt="" src="', 26556 k.icon || this.emptyIcon, 26557 '" class="x-tree-node-icon', 26558 (k.icon ? " x-tree-node-inline-icon" : ""), 26559 (k.iconCls ? " " + k.iconCls : ""), 26560 '" unselectable="on" />', 26561 g
26562 ? ('<input class="x-tree-node-cb" type="checkbox" ' + (k.checked 26563 ? 'checked="checked" />' 26564 : "/>")) 26565 : "", 26566 '<a hidefocus="on" class="x-tree-node-anchor" href="', c, 26567 '" tabIndex="1" ', 26568 k.hrefTarget ? ' target="' + k.hrefTarget + '"' : "", 26569 '><span unselectable="on">', e.text, "</span></a></div>", 26570 '<ul class="x-tree-node-ct" style="display:none;"></ul>', 26571 "</li>"].join(""); 26572 if (l !== true && e.nextSibling && (b = e.nextSibling.ui.getEl())) { 26573 this.wrap = Ext.DomHelper.insertHtml("beforeBegin", b, d) 26574 } else { 26575 this.wrap = Ext.DomHelper.insertHtml("beforeEnd", j, d) 26576 } 26577 this.elNode = this.wrap.childNodes[0]; 26578 this.ctNode = this.wrap.childNodes[1]; 26579 var i = this.elNode.childNodes; 26580 this.indentNode = i[0]; 26581 this.ecNode = i[1]; 26582 this.iconNode = i[2]; 26583 var h = 3; 26584 if (g) { 26585 this.checkbox = i[3]; 26586 this.checkbox.defaultChecked = this.checkbox.checked; 26587 h++ 26588 } 26589 this.anchor = i[h]; 26590 this.textNode = i[h].firstChild 26591 }, 26592 getHref : function(a) { 26593 return Ext.isEmpty(a) ? (Ext.isGecko ? "" : "#") : a 26594 }, 26595 getAnchor : function() { 26596 return this.anchor 26597 }, 26598 getTextEl : function() { 26599 return this.textNode 26600 }, 26601 getIconEl : function() { 26602 return this.iconNode 26603 }, 26604 isChecked : function() { 26605 return this.checkbox ? this.checkbox.checked : false 26606 }, 26607 updateExpandIcon : function() { 26608 if (this.rendered) { 26609 var g = this.node, d, c, a = g.isLast() 26610 ? "x-tree-elbow-end" 26611 : "x-tree-elbow", e = g.hasChildNodes(),h = ''; 26612 if (e || g.attributes.expandable) { 26613 if (g.expanded) { 26614 a += "-minus"; 26615 d = "x-tree-node-collapsed"; 26616 c = "x-tree-node-expanded" 26617 } else { 26618 a += "-plus"; 26619 d = "x-tree-node-expanded"; 26620 c = "x-tree-node-collapsed" 26621 } 26622 if (this.wasLeaf) { 26623 this.removeClass("x-tree-node-leaf"); 26624 this.wasLeaf = false 26625 } 26626 if (this.c1 != d || this.c2 != c) { 26627 Ext.fly(this.elNode).replaceClass(d, c); 26628 this.c1 = d; 26629 this.c2 = c 26630 } 26631 } else { 26632 if (!this.wasLeaf) { 26633 Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", 26634 "x-tree-node-collapsed"); 26635 delete this.c1; 26636 delete this.c2; 26637 this.wasLeaf = true 26638 } 26639 } 26640 26641 if (window.isPage === 'MAIL' && g.attributes.folderType == 1 && a.endsWith('-end')) { 26642 h = 'x-hidden '; 26643 } 26644 26645 var b = h + "x-tree-ec-icon " + a; 26646 if (this.ecc != b) { 26647 this.ecNode.className = b; 26648 this.ecc = b 26649 } 26650 } 26651 }, 26652 onIdChange : function(a) { 26653 if (this.rendered) { 26654 this.elNode.setAttribute("ext:tree-node-id", a) 26655 } 26656 }, 26657 getChildIndent : function() { 26658 if (!this.childIndent) { 26659 var a = [], b = this.node; 26660 while (b) { 26661 if (!b.isRoot || (b.isRoot && b.ownerTree.rootVisible)) { 26662 if (!b.isLast()) { 26663 a.unshift('<img alt="" src="' + this.emptyIcon 26664 + '" class="x-tree-elbow-line" />') 26665 } else { 26666 a.unshift('<img alt="" src="' + this.emptyIcon 26667 + '" class="x-tree-icon" />') 26668 } 26669 } 26670 b = b.parentNode 26671 } 26672 this.childIndent = a.join("") 26673 } 26674 return this.childIndent 26675 }, 26676 renderIndent : function() { 26677 if (this.rendered) { 26678 var a = "", b = this.node.parentNode; 26679 if (b) { 26680 a = b.ui.getChildIndent() 26681 } 26682 if (this.indentMarkup != a) { 26683 this.indentNode.innerHTML = a; 26684 this.indentMarkup = a 26685 } 26686 this.updateExpandIcon() 26687 } 26688 }, 26689 destroy : function() { 26690 if (this.elNode) { 26691 Ext.dd.Registry.unregister(this.elNode.id) 26692 } 26693 Ext.each(["textnode", "anchor", "checkbox", "indentNode", "ecNode", 26694 "iconNode", "elNode", "ctNode", "wrap", "holder"], 26695 function(a) { 26696 if (this[a]) { 26697 Ext.fly(this[a]).remove(); 26698 delete this[a] 26699 } 26700 }, this); 26701 delete this.node 26702 } 26703}); 26704Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { 26705 render : function() { 26706 if (!this.rendered) { 26707 var a = this.node.ownerTree.innerCt.dom; 26708 this.node.expanded = true; 26709 a.innerHTML = '<div class="x-tree-root-node"></div>'; 26710 this.wrap = this.ctNode = a.firstChild 26711 } 26712 }, 26713 collapse : Ext.emptyFn, 26714 expand : Ext.emptyFn 26715 });
26716Ext.tree.TreeLoader = function(a) { 26717 this.baseParams = {}; 26718 Ext.apply(this, a); 26719 this.addEvents("beforeload", "load", "loadexception"); 26720 Ext.tree.TreeLoader.superclass.constructor.call(this); 26721 if (Ext.isString(this.paramOrder)) { 26722 this.paramOrder = this.paramOrder.split(/[\s,|]/) 26723 } 26724}; 26725Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, { 26726 uiProviders : {}, 26727 clearOnLoad : true, 26728 paramOrder : undefined, 26729 paramsAsHash : false, 26730 nodeParameter : "node", 26731 directFn : undefined, 26732 load : function(b, c, a) { 26733 if (this.clearOnLoad) { 26734 while (b.firstChild) { 26735 b.removeChild(b.firstChild) 26736 } 26737 } 26738 if (this.doPreload(b)) { 26739 this.runCallback(c, a || b, [b]) 26740 } else { 26741 if (this.directFn || this.dataUrl || this.url) { 26742 this.requestData(b, c, a || b) 26743 } 26744 } 26745 }, 26746 doPreload : function(d) { 26747 if (d.attributes.children) { 26748 if (d.childNodes.length < 1) { 26749 var c = d.attributes.children; 26750 d.beginUpdate(); 26751 for (var b = 0, a = c.length; b < a; b++) { 26752 var e = d.appendChild(this.createNode(c[b])); 26753 if (this.preloadChildren) { 26754 this.doPreload(e) 26755 } 26756 } 26757 d.endUpdate() 26758 } 26759 return true 26760 } 26761 return false 26762 }, 26763 getParams : function(g) { 26764 var e = Ext.apply({}, this.baseParams), h = this.nodeParameter, b = this.paramOrder; 26765 h && (e[h] = g.id); 26766 if (this.directFn) { 26767 var c = [g.id]; 26768 if (b) { 26769 if (h && b.indexOf(h) > -1) { 26770 c = [] 26771 } 26772 for (var d = 0, a = b.length; d < a; d++) { 26773 c.push(e[b[d]]) 26774 } 26775 } else { 26776 if (this.paramsAsHash) { 26777 c = [e] 26778 } 26779 } 26780 return c 26781 } else { 26782 return e 26783 } 26784 }, 26785 requestData : function(c, d, b) { 26786 if (this.fireEvent("beforeload", this, c, d) !== false) { 26787 if (this.directFn) { 26788 var a = this.getParams(c); 26789 a.push(this.processDirectResponse.createDelegate(this, [{ 26790 callback : d, 26791 node : c, 26792 scope : b 26793 }], true)); 26794 this.directFn.apply(window, a) 26795 } else { 26796 this.transId = Ext.Ajax.request({ 26797 method : this.requestMethod, 26798 url : this.dataUrl || this.url, 26799 success : this.handleResponse, 26800 failure : this.handleFailure, 26801 scope : this, 26802 argument : { 26803 callback : d, 26804 node : c, 26805 scope : b 26806 }, 26807 params : this.getParams(c) 26808 }) 26809 } 26810 } else { 26811 this.runCallback(d, b || c, []) 26812 } 26813 }, 26814 processDirectResponse : function(a, b, c) { 26815 if (b.status) { 26816 this.handleResponse({ 26817 responseData : Ext.isArray(a) ? a : null, 26818 responseText : a, 26819 argument : c 26820 }) 26821 } else { 26822 this.handleFailure({ 26823 argument : c 26824 }) 26825 } 26826 }, 26827 runCallback : function(a, c, b) { 26828 if (Ext.isFunction(a)) { 26829 a.apply(c, b) 26830 } 26831 }, 26832 isLoading : function() { 26833 return !!this.transId 26834 }, 26835 abort : function() { 26836 if (this.isLoading()) { 26837 Ext.Ajax.abort(this.transId) 26838 } 26839 }, 26840 createNode : function(attr) { 26841 if (this.baseAttrs) { 26842 Ext.applyIf(attr, this.baseAttrs) 26843 } 26844 if (this.applyLoader !== false && !attr.loader) { 26845 attr.loader = this 26846 } 26847 if (Ext.isString(attr.uiProvider)) { 26848 attr.uiProvider = this.uiProviders[attr.uiProvider] 26849 || eval(attr.uiProvider) 26850 } 26851 if (attr.nodeType) { 26852 return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr) 26853 } else { 26854 return attr.leaf 26855 ? new Ext.tree.TreeNode(attr) 26856 : new Ext.tree.AsyncTreeNode(attr) 26857 } 26858 }, 26859 processResponse : function(d, c, k, l) { 26860 var m = d.responseText; 26861 try { 26862 var a = d.responseData || Ext.decode(m); 26863 c.beginUpdate(); 26864 for (var g = 0, h = a.length; g < h; g++) { 26865 var b = this.createNode(a[g]); 26866 if (b) { 26867 c.appendChild(b) 26868 } 26869 } 26870 c.endUpdate(); 26871 this.runCallback(k, l || c, [c]) 26872 } catch (j) { 26873 this.handleFailure(d) 26874 } 26875 }, 26876 handleResponse : function(c) { 26877 this.transId = false; 26878 var b = c.argument; 26879 this.processResponse(c, b.node, b.callback, b.scope); 26880 this.fireEvent("load", this, b.node, c) 26881 }, 26882 handleFailure : function(c) { 26883 this.transId = false; 26884 var b = c.argument; 26885 this.fireEvent("loadexception", this, b.node, c); 26886 this.runCallback(b.callback, b.scope || b.node, [b.node]) 26887 }, 26888 destroy : function() { 26889 this.abort(); 26890 this.purgeListeners() 26891 } 26892}); 26893Ext.tree.TreeFilter = function(a, b) { 26894 this.tree = a; 26895 this.filtered = {}; 26896 Ext.apply(this, b) 26897}; 26898Ext.tree.TreeFilter.prototype = { 26899 clearBlank : false, 26900 reverse : false, 26901 autoClear : false, 26902 remove : false, 26903 filter : function(d, a, b) { 26904 a = a || "text"; 26905 var c; 26906 if (typeof d == "string") { 26907 var e = d.length; 26908 if (e == 0 && this.clearBlank) { 26909 this.clear(); 26910 return 26911 } 26912 d = d.toLowerCase(); 26913 c = function(g) { 26914 return g.attributes[a].substr(0, e).toLowerCase() == d 26915 } 26916 } else { 26917 if (d.exec) { 26918 c = function(g) { 26919 return d.test(g.attributes[a]) 26920 } 26921 } else { 26922 throw "Illegal filter type, must be string or regex" 26923 } 26924 } 26925 this.filterBy(c, null, b) 26926 }, 26927 filterBy : function(d, c, b) { 26928 b = b || this.tree.root; 26929 if (this.autoClear) { 26930 this.clear() 26931 } 26932 var a = this.filtered, i = this.reverse; 26933 var e = function(k) { 26934 if (k == b) { 26935 return true 26936 } 26937 if (a[k.id]) { 26938 return false 26939 } 26940 var j = d.call(c || k, k); 26941 if (!j || i) { 26942 a[k.id] = k; 26943 k.ui.hide(); 26944 return false 26945 } 26946 return true 26947 }; 26948 b.cascade(e); 26949 if (this.remove) { 26950 for (var h in a) { 26951 if (typeof h != "function") { 26952 var g = a[h]; 26953 if (g && g.parentNode) { 26954 g.parentNode.removeChild(g) 26955 } 26956 } 26957 } 26958 } 26959 }, 26960 clear : function() { 26961 var b = this.tree; 26962 var a = this.filtered; 26963 for (var d in a) { 26964 if (typeof d != "function") { 26965 var c = a[d]; 26966 if (c) { 26967 c.ui.show() 26968 } 26969 } 26970 } 26971 this.filtered = {} 26972 } 26973}; 26974Ext.tree.TreeSorter = Ext.extend(Object, { 26975 constructor : function(a, c) { 26976 Ext.apply(this, c); 26977 a.on({ 26978 scope : this, 26979 beforechildrenrendered : this.doSort, 26980 append : this.updateSort, 26981 insert : this.updateSort, 26982 textchange : this.updateSortParent 26983 }); 26984 var e = this.dir && this.dir.toLowerCase() == "desc", i = this.property 26985 || "text", d = this.sortType, h = this.folderSort, b = this.caseSensitive === true, g = this.leafAttr 26986 || "leaf"; 26987 if (Ext.isString(d)) { 26988 d = Ext.data.SortTypes[d] 26989 } 26990 this.sortFn = function(o, m) { 26991 var k = o.attributes, j = m.attributes; 26992 if (h) { 26993 if (k[g] && !j[g]) { 26994 return 1 26995 } 26996 if (!k[g] && j[g]) { 26997 return -1 26998 } 26999 } 27000 var n = k[i], l = j[i], q = d ? d(n) : (b ? n : n.toUpperCase()), p = d 27001 ? d(l) 27002 : (b ? l : l.toUpperCase()); 27003 if (q < p) { 27004 return e ? 1 : -1 27005 } else { 27006 if (q > p) { 27007 return e ? -1 : 1 27008 } 27009 } 27010 return 0 27011 } 27012 }, 27013 doSort : function(a) { 27014 a.sort(this.sortFn) 27015 }, 27016 updateSort : function(a, b) { 27017 if (b.childrenRendered) { 27018 this.doSort.defer(1, this, [b]) 27019 } 27020 }, 27021 updateSortParent : function(a) { 27022 var b = a.parentNode; 27023 if (b && b.childrenRendered) { 27024 this.doSort.defer(1, this, [b]) 27025 } 27026 } 27027}); 27028if (Ext.dd.DropZone) { 27029 Ext.tree.TreeDropZone = function(a, b) { 27030 this.allowParentInsert = b.allowParentInsert || false; 27031 this.allowContainerDrop = b.allowContainerDrop || false; 27032 this.appendOnly = b.appendOnly || false; 27033 Ext.tree.TreeDropZone.superclass.constructor.call(this, a.getTreeEl(), 27034 b); 27035 this.tree = a; 27036 this.dragOverData = {}; 27037 this.lastInsertClass = "x-tree-no-status" 27038 }; 27039 Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, { 27040 ddGroup : "TreeDD", 27041 expandDelay : 1000, 27042 expandNode : function(a) { 27043 if (a.hasChildNodes() && !a.isExpanded()) {
27044 a.expand(false, null, this.triggerCacheRefresh 27045 .createDelegate(this)) 27046 } 27047 }, 27048 queueExpand : function(a) { 27049 this.expandProcId = this.expandNode.defer(this.expandDelay, 27050 this, [a]) 27051 }, 27052 cancelExpand : function() { 27053 if (this.expandProcId) { 27054 clearTimeout(this.expandProcId); 27055 this.expandProcId = false 27056 } 27057 }, 27058 isValidDropPoint : function(a, k, i, d, c) { 27059 if (!a || !c) { 27060 return false 27061 } 27062 var g = a.node; 27063 var h = c.node; 27064 if (!(g && g.isTarget && k)) { 27065 return false 27066 } 27067 if (k == "append" && g.allowChildren === false) { 27068 return false 27069 } 27070 if ((k == "above" || k == "below") 27071 && (g.parentNode && g.parentNode.allowChildren === false)) { 27072 return false 27073 } 27074 if (h && (g == h || h.contains(g))) { 27075 return false 27076 } 27077 var b = this.dragOverData; 27078 b.tree = this.tree; 27079 b.target = g; 27080 b.data = c; 27081 b.point = k; 27082 b.source = i; 27083 b.rawEvent = d; 27084 b.dropNode = h; 27085 b.cancel = false; 27086 var j = this.tree.fireEvent("nodedragover", b); 27087 return b.cancel === false && j !== false 27088 }, 27089 getDropPoint : function(h, g, l) { 27090 var m = g.node; 27091 if (m.isRoot) { 27092 return m.allowChildren !== false ? "append" : false 27093 } 27094 var c = g.ddel; 27095 var o = Ext.lib.Dom.getY(c), j = o + c.offsetHeight; 27096 var i = Ext.lib.Event.getPageY(h); 27097 var k = m.allowChildren === false || m.isLeaf(); 27098 if (this.appendOnly || m.parentNode.allowChildren === false) { 27099 return k ? false : "append" 27100 } 27101 var d = false; 27102 if (!this.allowParentInsert) { 27103 d = m.hasChildNodes() && m.isExpanded() 27104 } 27105 var a = (j - o) / (k ? 2 : 3); 27106 if (i >= o && i < (o + a)) { 27107 return "above" 27108 } else { 27109 if (!d && (k || i >= j - a && i <= j)) { 27110 return "below" 27111 } else { 27112 return "append" 27113 } 27114 } 27115 }, 27116 onNodeEnter : function(d, a, c, b) { 27117 this.cancelExpand() 27118 }, 27119 onContainerOver : function(a, c, b) { 27120 if (this.allowContainerDrop && this.isValidDropPoint({ 27121 ddel : this.tree.getRootNode().ui.elNode, 27122 node : this.tree.getRootNode() 27123 }, "append", a, c, b)) { 27124 return this.dropAllowed 27125 } 27126 return this.dropNotAllowed 27127 }, 27128 onNodeOver : function(b, i, h, g) { 27129 var k = this.getDropPoint(h, b, i); 27130 var c = b.node; 27131 if (!this.expandProcId && k == "append" 27132 && c.hasChildNodes() && !b.node.isExpanded()) { 27133 this.queueExpand(c) 27134 } else { 27135 if (k != "append") { 27136 this.cancelExpand() 27137 } 27138 } 27139 var d = this.dropNotAllowed; 27140 if (this.isValidDropPoint(b, k, i, h, g)) { 27141 if (k) { 27142 var a = b.ddel; 27143 var j; 27144 if (k == "above") { 27145 d = b.node.isFirst() 27146 ? "x-tree-drop-ok-above" 27147 : "x-tree-drop-ok-between"; 27148 j = "x-tree-drag-insert-above" 27149 } else { 27150 if (k == "below") { 27151 d = b.node.isLast() 27152 ? "x-tree-drop-ok-below" 27153 : "x-tree-drop-ok-between"; 27154 j = "x-tree-drag-insert-below" 27155 } else { 27156 d = "x-tree-drop-ok-append"; 27157 j = "x-tree-drag-append" 27158 } 27159 } 27160 if (this.lastInsertClass != j) { 27161 Ext.fly(a) 27162 .replaceClass(this.lastInsertClass, j); 27163 this.lastInsertClass = j 27164 } 27165 } 27166 } 27167 return d 27168 }, 27169 onNodeOut : function(d, a, c, b) { 27170 this.cancelExpand(); 27171 this.removeDropIndicators(d) 27172 }, 27173 onNodeDrop : function(i, b, h, d) { 27174 var a = this.getDropPoint(h, i, b); 27175 var g = i.node; 27176 g.ui.startDrop(); 27177 if (!this.isValidDropPoint(i, a, b, h, d)) { 27178 g.ui.endDrop(); 27179 return false 27180 } 27181 var c = d.node 27182 || (b.getTreeNode 27183 ? b.getTreeNode(d, g, a, h) 27184 : null); 27185 return this.processDrop(g, d, a, b, h, c) 27186 }, 27187 onContainerDrop : function(a, g, c) { 27188 if (this.allowContainerDrop && this.isValidDropPoint({ 27189 ddel : this.tree.getRootNode().ui.elNode, 27190 node : this.tree.getRootNode() 27191 }, "append", a, g, c)) { 27192 var d = this.tree.getRootNode(); 27193 d.ui.startDrop(); 27194 var b = c.node 27195 || (a.getTreeNode ? a.getTreeNode(c, d, 27196 "append", g) : null); 27197 return this.processDrop(d, c, "append", a, g, b) 27198 } 27199 return false 27200 }, 27201 processDrop : function(j, h, b, a, i, d) { 27202 var g = { 27203 tree : this.tree, 27204 target : j, 27205 data : h, 27206 point : b, 27207 source : a, 27208 rawEvent : i, 27209 dropNode : d, 27210 cancel : !d, 27211 dropStatus : false 27212 }; 27213 var c = this.tree.fireEvent("beforenodedrop", g); 27214 if (c === false || g.cancel === true || !g.dropNode) { 27215 j.ui.endDrop(); 27216 return g.dropStatus 27217 } 27218 j = g.target; 27219 if (b == "append" && !j.isExpanded()) { 27220 j.expand(false, null, function() { 27221 this.completeDrop(g) 27222 }.createDelegate(this)) 27223 } else { 27224 this.completeDrop(g) 27225 } 27226 return true 27227 }, 27228 completeDrop : function(h) { 27229 var d = h.dropNode, e = h.point, c = h.target; 27230 if (!Ext.isArray(d)) { 27231 d = [d] 27232 } 27233 var g; 27234 for (var b = 0, a = d.length; b < a; b++) { 27235 g = d[b]; 27236 if (e == "above") { 27237 c.parentNode.insertBefore(g, c) 27238 } else { 27239 if (e == "below") { 27240 c.parentNode.insertBefore(g, c.nextSibling) 27241 } else { 27242 c.appendChild(g) 27243 } 27244 } 27245 } 27246 g.ui.focus(); 27247 if (Ext.enableFx && this.tree.hlDrop) { 27248 g.ui.highlight() 27249 } 27250 c.ui.endDrop(); 27251 this.tree.fireEvent("nodedrop", h) 27252 }, 27253 afterNodeMoved : function(a, c, g, d, b) { 27254 if (Ext.enableFx && this.tree.hlDrop) { 27255 b.ui.focus(); 27256 b.ui.highlight() 27257 } 27258 this.tree.fireEvent("nodedrop", this.tree, d, c, a, g) 27259 }, 27260 getTree : function() { 27261 return this.tree 27262 }, 27263 removeDropIndicators : function(b) { 27264 if (b && b.ddel) { 27265 var a = b.ddel; 27266 Ext.fly(a).removeClass(["x-tree-drag-insert-above", 27267 "x-tree-drag-insert-below", 27268 "x-tree-drag-append"]);
27269 this.lastInsertClass = "_noclass" 27270 } 27271 }, 27272 beforeDragDrop : function(b, a, c) { 27273 this.cancelExpand(); 27274 return true 27275 }, 27276 afterRepair : function(a) { 27277 if (a && Ext.enableFx) { 27278 a.node.ui.highlight() 27279 } 27280 this.hideProxy() 27281 } 27282 }) 27283} 27284if (Ext.dd.DragZone) { 27285 Ext.tree.TreeDragZone = function(a, b) { 27286 Ext.tree.TreeDragZone.superclass.constructor.call(this, a.innerCt, b); 27287 this.tree = a 27288 }; 27289 Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, { 27290 ddGroup : "TreeDD", 27291 onBeforeDrag : function(a, b) { 27292 var c = a.node; 27293 return c && c.draggable && !c.disabled 27294 }, 27295 onInitDrag : function(b) { 27296 var a = this.dragData; 27297 this.tree.getSelectionModel().select(a.node); 27298 this.tree.eventModel.disable(); 27299 this.proxy.update(""); 27300 a.node.ui.appendDDGhost(this.proxy.ghost.dom); 27301 this.tree.fireEvent("startdrag", this.tree, a.node, b) 27302 }, 27303 getRepairXY : function(b, a) { 27304 return a.node.ui.getDDRepairXY() 27305 }, 27306 onEndDrag : function(a, b) { 27307 this.tree.eventModel.enable.defer(100, this.tree.eventModel); 27308 this.tree.fireEvent("enddrag", this.tree, a.node, b) 27309 }, 27310 onValidDrop : function(a, b, c) { 27311 this.tree 27312 .fireEvent("dragdrop", this.tree, this.dragData.node, a, b); 27313 this.hideProxy() 27314 }, 27315 beforeInvalidDrop : function(a, c) { 27316 var b = this.tree.getSelectionModel(); 27317 b.clearSelections(); 27318 b.select(this.dragData.node) 27319 }, 27320 afterRepair : function() { 27321 if (Ext.enableFx && this.tree.hlDrop) { 27322 Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor 27323 || "c3daf9") 27324 } 27325 this.dragging = false 27326 } 27327 }) 27328} 27329Ext.menu.Menu = Ext.extend(Ext.Container, { 27330 minWidth : 120, 27331 shadow : "sides", 27332 subMenuAlign : "tl-tr?", 27333 defaultAlign : "tl-bl?", 27334 allowOtherMenus : false, 27335 ignoreParentClicks : false, 27336 enableScrolling : true, 27337 maxHeight : null, 27338 scrollIncrement : 24, 27339 showSeparator : true, 27340 defaultOffsets : [0, 0], 27341 plain : false, 27342 floating : true, 27343 zIndex : 15000, 27344 hidden : true, 27345 layout : "menu", 27346 hideMode : "offsets", 27347 scrollerHeight : 8, 27348 autoLayout : true, 27349 defaultType : "menuitem", 27350 bufferResize : false, 27351 initComponent : function() { 27352 if (Ext.isArray(this.initialConfig)) { 27353 Ext.apply(this, { 27354 items : this.initialConfig 27355 }) 27356 } 27357 this.addEvents("click", "mouseover", "mouseout", "itemclick"); 27358 Ext.menu.MenuMgr.register(this); 27359 if (this.floating) { 27360 Ext.EventManager.onWindowResize(this.hide, this) 27361 } else { 27362 if (this.initialConfig.hidden !== false) { 27363 this.hidden = false 27364 } 27365 this.internalDefaults = { 27366 hideOnClick : false 27367 } 27368 } 27369 Ext.menu.Menu.superclass.initComponent.call(this); 27370 if (this.autoLayout) { 27371 var a = this.doLayout.createDelegate(this, []); 27372 this.on({ 27373 add : a, 27374 remove : a 27375 }) 27376 } 27377 }, 27378 getLayoutTarget : function() { 27379 return this.ul 27380 }, 27381 onRender : function(b, a) { 27382 if (!b) { 27383 b = Ext.getBody() 27384 } 27385 var c = { 27386 id : this.getId(), 27387 cls : "x-menu " 27388 + ((this.floating) ? "x-menu-floating x-layer " : "") 27389 + (this.cls || "") + (this.plain ? " x-menu-plain" : "") 27390 + (this.showSeparator ? "" : " x-menu-nosep"), 27391 style : this.style, 27392 cn : [{ 27393 tag : "a", 27394 cls : "x-menu-focus", 27395 href : "#", 27396 onclick : "return false;", 27397 tabIndex : "-1" 27398 }, { 27399 tag : "ul", 27400 cls : "x-menu-list" 27401 }] 27402 }; 27403 if (this.floating) { 27404 this.el = new Ext.Layer({ 27405 shadow : this.shadow, 27406 dh : c, 27407 constrain : false, 27408 parentEl : b, 27409 zindex : this.zIndex 27410 }) 27411 } else { 27412 this.el = b.createChild(c) 27413 } 27414 Ext.menu.Menu.superclass.onRender.call(this, b, a); 27415 if (!this.keyNav) { 27416 this.keyNav = new Ext.menu.MenuNav(this) 27417 } 27418 this.focusEl = this.el.child("a.x-menu-focus"); 27419 this.ul = this.el.child("ul.x-menu-list"); 27420 this.mon(this.ul, { 27421 scope : this, 27422 click : this.onClick, 27423 mouseover : this.onMouseOver, 27424 mouseout : this.onMouseOut 27425 }); 27426 if (this.enableScrolling) { 27427 this.mon(this.el, { 27428 scope : this, 27429 delegate : ".x-menu-scroller", 27430 click : this.onScroll, 27431 mouseover : this.deactivateActive 27432 }) 27433 } 27434 }, 27435 findTargetItem : function(b) { 27436 var a = b.getTarget(".x-menu-list-item", this.ul, true); 27437 if (a && a.menuItemId) { 27438 return this.items.get(a.menuItemId) 27439 } 27440 }, 27441 onClick : function(b) { 27442 var a = this.findTargetItem(b); 27443 if (a) { 27444 if (a.isFormField) { 27445 this.setActiveItem(a) 27446 } else { 27447 if (a instanceof Ext.menu.BaseItem) { 27448 if (a.menu && this.ignoreParentClicks) {
27449 a.expandMenu(); 27450 b.preventDefault() 27451 } else { 27452 if (a.onClick) { 27453 a.onClick(b); 27454 this.fireEvent("click", this, a, b) 27455 } 27456 } 27457 } 27458 } 27459 } 27460 }, 27461 setActiveItem : function(a, b) { 27462 if (a != this.activeItem) { 27463 this.deactivateActive(); 27464 if ((this.activeItem = a).isFormField) { 27465 a.focus() 27466 } else { 27467 a.activate(b) 27468 } 27469 } else { 27470 if (b) { 27471 a.expandMenu() 27472 } 27473 } 27474 }, 27475 deactivateActive : function() { 27476 var b = this.activeItem; 27477 if (b) { 27478 if (b.isFormField) { 27479 if (b.collapse) { 27480 b.collapse() 27481 } 27482 } else { 27483 b.deactivate() 27484 } 27485 delete this.activeItem 27486 } 27487 }, 27488 tryActivate : function(g, e) { 27489 var b = this.items; 27490 for (var c = g, a = b.length; c >= 0 && c < a; c += e) { 27491 var d = b.get(c); 27492 if (d.isVisible() && !d.disabled 27493 && (d.canActivate || d.isFormField)) { 27494 this.setActiveItem(d, false); 27495 return d 27496 } 27497 } 27498 return false 27499 }, 27500 onMouseOver : function(b) { 27501 var a = this.findTargetItem(b); 27502 if (a) { 27503 if (a.canActivate && !a.disabled) { 27504 this.setActiveItem(a, true) 27505 } 27506 } 27507 this.over = true; 27508 this.fireEvent("mouseover", this, b, a) 27509 }, 27510 onMouseOut : function(b) { 27511 var a = this.findTargetItem(b); 27512 if (a) { 27513 if (a == this.activeItem && a.shouldDeactivate 27514 && a.shouldDeactivate(b)) { 27515 this.activeItem.deactivate(); 27516 delete this.activeItem 27517 } 27518 } 27519 this.over = false; 27520 this.fireEvent("mouseout", this, b, a) 27521 }, 27522 onScroll : function(d, b) { 27523 if (d) { 27524 d.stopEvent() 27525 } 27526 var a = this.ul.dom, c = Ext.fly(b).is(".x-menu-scroller-top"); 27527 a.scrollTop += this.scrollIncrement * (c ? -1 : 1); 27528 if (c 27529 ? a.scrollTop <= 0 27530 : a.scrollTop + this.activeMax >= a.scrollHeight) { 27531 this.onScrollerOut(null, b) 27532 } 27533 }, 27534 onScrollerIn : function(d, b) { 27535 var a = this.ul.dom, c = Ext.fly(b).is(".x-menu-scroller-top"); 27536 if (c ? a.scrollTop > 0 : a.scrollTop + this.activeMax < a.scrollHeight) { 27537 Ext.fly(b) 27538 .addClass(["x-menu-item-active", "x-menu-scroller-active"]) 27539 } 27540 }, 27541 onScrollerOut : function(b, a) { 27542 Ext.fly(a) 27543 .removeClass(["x-menu-item-active", "x-menu-scroller-active"]) 27544 }, 27545 show : function(b, c, a) { 27546 if (this.floating) { 27547 this.parentMenu = a; 27548 if (!this.el) { 27549 this.render(); 27550 this.doLayout(false, true) 27551 } 27552 this.showAt(this.el.getAlignToXY(b, c || this.defaultAlign, 27553 this.defaultOffsets), a) 27554 } else { 27555 Ext.menu.Menu.superclass.show.call(this) 27556 } 27557 }, 27558 showAt : function(b, a) { 27559 if (this.fireEvent("beforeshow", this) !== false) { 27560 this.parentMenu = a; 27561 if (!this.el) { 27562 this.render() 27563 } 27564 27565 if (Ext.isIE6 || Ext.isIE7 || Ext.isIE8 || Ext.isIE9 || Ext.isChrome) { 27566 27567 } else { 27568 if (this.enableScrolling) { 27569 this.el.setXY(b); 27570 b[1] = this.constrainScroll(b[1]); 27571 b = [this.el.adjustForConstraints(b)[0], b[1]] 27572 } else { 27573 b = this.el.adjustForConstraints(b) 27574 } 27575 } 27576 this.el.setXY(b); 27577 this.el.show(); 27578 Ext.menu.Menu.superclass.onShow.call(this); 27579 if (Ext.isIE) { 27580 this.fireEvent("autosize", this); 27581 if (!Ext.isIE8) { 27582 this.el.repaint() 27583 } 27584 } 27585 this.hidden = false; 27586 this.focus(); 27587 this.fireEvent("show", this) 27588 } 27589 }, 27590 constrainScroll : function(i) { 27591 var b, d = this.ul.setHeight("auto").getHeight(), a = i, h, e, g, c; 27592 if (this.floating) { 27593 e = Ext.fly(this.el.dom.parentNode); 27594 g = e.getScroll().top; 27595 c = e.getViewSize().height; 27596 h = i - g; 27597 b = this.maxHeight ? this.maxHeight : c - h; 27598 if (d > c) { 27599 b = c; 27600 a = i - h 27601 } else { 27602 if (b < d) { 27603 a = i - (d - b); 27604 b = d 27605 } 27606 } 27607 } else { 27608 b = this.getHeight() 27609 } 27610 if (this.maxHeight) { 27611 b = Math.min(this.maxHeight, b) 27612 } 27613 if (d > b && b > 0) { 27614 this.activeMax = b - this.scrollerHeight * 2 27615 - this.el.getFrameWidth("tb") 27616 - Ext.num(this.el.shadowOffset, 0); 27617 this.ul.setHeight(this.activeMax); 27618 this.createScrollers(); 27619 this.el.select(".x-menu-scroller").setDisplayed("") 27620 } else { 27621 this.ul.setHeight(d); 27622 this.el.select(".x-menu-scroller").setDisplayed("none") 27623 } 27624 this.ul.dom.scrollTop = 0; 27625 return a 27626 }, 27627 createScrollers : function() { 27628 if (!this.scroller) { 27629 this.scroller = { 27630 pos : 0, 27631 top : this.el.insertFirst({ 27632 tag : "div", 27633 cls : "x-menu-scroller x-menu-scroller-top", 27634 html : " " 27635 }), 27636 bottom : this.el.createChild({ 27637 tag : "div", 27638 cls : "x-menu-scroller x-menu-scroller-bottom", 27639 html : " " 27640 }) 27641 }; 27642 this.scroller.top 27643 .hover(this.onScrollerIn, this.onScrollerOut, this); 27644 this.scroller.topRepeater = new Ext.util.ClickRepeater( 27645 this.scroller.top, { 27646 listeners : { 27647 click : this.onScroll.createDelegate(this, [null, 27648 this.scroller.top], false) 27649 } 27650 });
27651 this.scroller.bottom.hover(this.onScrollerIn, this.onScrollerOut, 27652 this); 27653 this.scroller.bottomRepeater = new Ext.util.ClickRepeater( 27654 this.scroller.bottom, { 27655 listeners : { 27656 click : this.onScroll.createDelegate(this, [null, 27657 this.scroller.bottom], false) 27658 } 27659 }) 27660 } 27661 }, 27662 onLayout : function() { 27663 if (this.isVisible()) { 27664 if (this.enableScrolling) { 27665 this.constrainScroll(this.el.getTop()) 27666 } 27667 if (this.floating) { 27668 this.el.sync() 27669 } 27670 } 27671 }, 27672 focus : function() { 27673 if (!this.hidden) { 27674 this.doFocus.defer(50, this) 27675 } 27676 }, 27677 doFocus : function() { 27678 if (!this.hidden) { 27679 this.focusEl.focus() 27680 } 27681 }, 27682 hide : function(a) { 27683 if (!this.isDestroyed) { 27684 this.deepHide = a; 27685 Ext.menu.Menu.superclass.hide.call(this); 27686 delete this.deepHide 27687 } 27688 }, 27689 onHide : function() { 27690 Ext.menu.Menu.superclass.onHide.call(this); 27691 this.deactivateActive(); 27692 if (this.el && this.floating) { 27693 this.el.hide() 27694 } 27695 var a = this.parentMenu; 27696 if (this.deepHide === true && a) { 27697 if (a.floating) { 27698 a.hide(true) 27699 } else { 27700 a.deactivateActive() 27701 } 27702 } 27703 }, 27704 lookupComponent : function(a) { 27705 if (Ext.isString(a)) { 27706 a = (a == "separator" || a == "-") 27707 ? new Ext.menu.Separator() 27708 : new Ext.menu.TextItem(a); 27709 this.applyDefaults(a) 27710 } else { 27711 if (Ext.isObject(a)) { 27712 a = this.getMenuItem(a) 27713 } else { 27714 if (a.tagName || a.el) { 27715 a = new Ext.BoxComponent({ 27716 el : a 27717 }) 27718 } 27719 } 27720 } 27721 return a 27722 }, 27723 applyDefaults : function(b) { 27724 if (!Ext.isString(b)) { 27725 b = Ext.menu.Menu.superclass.applyDefaults.call(this, b); 27726 var a = this.internalDefaults; 27727 if (a) { 27728 if (b.events) { 27729 Ext.applyIf(b.initialConfig, a); 27730 Ext.apply(b, a) 27731 } else { 27732 Ext.applyIf(b, a) 27733 } 27734 } 27735 } 27736 return b 27737 }, 27738 getMenuItem : function(a) { 27739 a.ownerCt = this; 27740 if (!a.isXType) { 27741 if (!a.xtype && Ext.isBoolean(a.checked)) { 27742 return new Ext.menu.CheckItem(a) 27743 } 27744 return Ext.create(a, this.defaultType) 27745 } 27746 return a 27747 }, 27748 addSeparator : function() { 27749 return this.add(new Ext.menu.Separator()) 27750 }, 27751 addElement : function(a) { 27752 return this.add(new Ext.menu.BaseItem({ 27753 el : a 27754 })) 27755 }, 27756 addItem : function(a) { 27757 return this.add(a) 27758 }, 27759 addMenuItem : function(a) { 27760 return this.add(this.getMenuItem(a)) 27761 }, 27762 addText : function(a) { 27763 return this.add(new Ext.menu.TextItem(a)) 27764 }, 27765 onDestroy : function() { 27766 Ext.EventManager.removeResizeListener(this.hide, this); 27767 var a = this.parentMenu; 27768 if (a && a.activeChild == this) { 27769 delete a.activeChild 27770 } 27771 delete this.parentMenu; 27772 Ext.menu.Menu.superclass.onDestroy.call(this); 27773 Ext.menu.MenuMgr.unregister(this); 27774 if (this.keyNav) { 27775 this.keyNav.disable() 27776 } 27777 var b = this.scroller; 27778 if (b) { 27779 Ext.destroy(b.topRepeater, b.bottomRepeater, b.top, b.bottom) 27780 } 27781 Ext.destroy(this.el, this.focusEl, this.ul) 27782 } 27783}); 27784Ext.reg("menu", Ext.menu.Menu); 27785Ext.menu.MenuNav = Ext.extend(Ext.KeyNav, function() { 27786 function a(d, c) { 27787 if (!c.tryActivate(c.items.indexOf(c.activeItem) - 1, -1)) { 27788 c.tryActivate(c.items.length - 1, -1) 27789 } 27790 } 27791 function b(d, c) { 27792 if (!c.tryActivate(c.items.indexOf(c.activeItem) + 1, 1)) { 27793 c.tryActivate(0, 1) 27794 } 27795 } 27796 return { 27797 constructor : function(c) { 27798 Ext.menu.MenuNav.superclass.constructor.call(this, c.el); 27799 this.scope = this.menu = c 27800 }, 27801 doRelay : function(g, d) { 27802 var c = g.getKey(); 27803 if (this.menu.activeItem 27804 && this.menu.activeItem.isFormField && c != g.TAB) { 27805 return false 27806 } 27807 if (!this.menu.activeItem && g.isNavKeyPress() 27808 && c != g.SPACE && c != g.RETURN) { 27809 this.menu.tryActivate(0, 1); 27810 return false 27811 } 27812 return d.call(this.scope || this, g, this.menu) 27813 }, 27814 tab : function(d, c) { 27815 d.stopEvent(); 27816 if (d.shiftKey) { 27817 a(d, c) 27818 } else { 27819 b(d, c) 27820 } 27821 }, 27822 up : a, 27823 down : b, 27824 right : function(d, c) { 27825 if (c.activeItem) { 27826 c.activeItem.expandMenu(true) 27827 } 27828 }, 27829 left : function(d, c) { 27830 c.hide(); 27831 if (c.parentMenu && c.parentMenu.activeItem) { 27832 c.parentMenu.activeItem.activate() 27833 } 27834 }, 27835 enter : function(d, c) { 27836 if (c.activeItem) { 27837 d.stopPropagation(); 27838 c.activeItem.onClick(d); 27839 c.fireEvent("click", this, c.activeItem); 27840 return true 27841 } 27842 } 27843 } 27844 }()); 27845Ext.menu.MenuMgr = function() { 27846 var h, e, b, d = {}, a = false, l = new Date(); 27847 function n() { 27848 h = {}; 27849 e = new Ext.util.MixedCollection(); 27850 b = Ext.getDoc().addKeyListener(27, j); 27851 b.disable() 27852 } 27853 function j() { 27854 if (e && e.length > 0) { 27855 var o = e.clone(); 27856 o.each(function(p) { 27857 p.hide() 27858 });
27859 return true 27860 } 27861 return false 27862 } 27863 function g(o) { 27864 e.remove(o); 27865 if (e.length < 1) { 27866 b.disable(); 27867 Ext.getDoc().un("mousedown", m); 27868 a = false 27869 } 27870 } 27871 function k(o) { 27872 var p = e.last(); 27873 l = new Date(); 27874 e.add(o); 27875 if (!a) { 27876 b.enable(); 27877 Ext.getDoc().on("mousedown", m); 27878 a = true 27879 } 27880 if (o.parentMenu) { 27881 o.getEl().setZIndex(parseInt(o.parentMenu.getEl() 27882 .getStyle("z-index"), 10) 27883 + 3); 27884 o.parentMenu.activeChild = o 27885 } else { 27886 if (p && !p.isDestroyed && p.isVisible()) { 27887 o.getEl().setZIndex(parseInt(p.getEl().getStyle("z-index"), 10) 27888 + 3) 27889 } 27890 } 27891 } 27892 function c(o) { 27893 if (o.activeChild) { 27894 o.activeChild.hide() 27895 } 27896 if (o.autoHideTimer) { 27897 clearTimeout(o.autoHideTimer); 27898 delete o.autoHideTimer 27899 } 27900 } 27901 function i(o) { 27902 var p = o.parentMenu; 27903 if (!p && !o.allowOtherMenus) { 27904 j() 27905 } else { 27906 if (p && p.activeChild) { 27907 p.activeChild.hide() 27908 } 27909 } 27910 } 27911 function m(o) { 27912 if (l.getElapsed() > 50 && e.length > 0 && !o.getTarget(".x-menu")) { 27913 j() 27914 } 27915 } 27916 return { 27917 hideAll : function() { 27918 return j() 27919 }, 27920 register : function(o) { 27921 if (!h) { 27922 n() 27923 } 27924 h[o.id] = o; 27925 o.on({ 27926 beforehide : c, 27927 hide : g, 27928 beforeshow : i, 27929 show : k 27930 }) 27931 }, 27932 get : function(o) { 27933 if (typeof o == "string") { 27934 if (!h) { 27935 return null 27936 } 27937 return h[o] 27938 } else { 27939 if (o.events) { 27940 return o 27941 } else { 27942 if (typeof o.length == "number") { 27943 return new Ext.menu.Menu({ 27944 items : o 27945 }) 27946 } else { 27947 return Ext.create(o, "menu") 27948 } 27949 } 27950 } 27951 }, 27952 unregister : function(o) { 27953 delete h[o.id]; 27954 o.un("beforehide", c); 27955 o.un("hide", g); 27956 o.un("beforeshow", i); 27957 o.un("show", k) 27958 }, 27959 registerCheckable : function(o) { 27960 var p = o.group; 27961 if (p) { 27962 if (!d[p]) { 27963 d[p] = [] 27964 } 27965 d[p].push(o) 27966 } 27967 }, 27968 unregisterCheckable : function(o) { 27969 var p = o.group; 27970 if (p) { 27971 d[p].remove(o) 27972 } 27973 }, 27974 onCheckChange : function(q, r) { 27975 if (q.group && r) { 27976 var t = d[q.group], p = 0, o = t.length, s; 27977 for (; p < o; p++) { 27978 s = t[p]; 27979 if (s != q) { 27980 s.setChecked(false) 27981 } 27982 } 27983 } 27984 }, 27985 getCheckedItem : function(q) { 27986 var r = d[q]; 27987 if (r) { 27988 for (var p = 0, o = r.length; p < o; p++) { 27989 if (r[p].checked) { 27990 return r[p] 27991 } 27992 } 27993 } 27994 return null 27995 }, 27996 setCheckedItem : function(q, s) { 27997 var r = d[q]; 27998 if (r) { 27999 for (var p = 0, o = r.length; p < o; p++) { 28000 if (r[p].id == s) { 28001 r[p].setChecked(true) 28002 } 28003 } 28004 } 28005 return null 28006 } 28007 } 28008}(); 28009Ext.menu.BaseItem = Ext.extend(Ext.Component, { 28010 canActivate : false, 28011// activeClass : "x-menu-item-active", 28012 activeClass : "r3-menu-item-active", 28013 hideOnClick : true, 28014 clickHideDelay : 1, 28015 ctype : "Ext.menu.BaseItem", 28016 actionMode : "container", 28017 initComponent : function() { 28018 Ext.menu.BaseItem.superclass.initComponent.call(this); 28019 this.addEvents("click", "activate", "deactivate"); 28020 if (this.handler) { 28021 this.on("click", this.handler, this.scope) 28022 } 28023 }, 28024 onRender : function(b, a) { 28025 Ext.menu.BaseItem.superclass.onRender.apply(this, arguments); 28026 if (this.ownerCt && this.ownerCt instanceof Ext.menu.Menu) { 28027 this.parentMenu = this.ownerCt 28028 } else { 28029 this.container.addClass("x-menu-list-item"); 28030 this.mon(this.el, { 28031 scope : this, 28032 click : this.onClick, 28033 mouseenter : this.activate, 28034 mouseleave : this.deactivate 28035 }) 28036 } 28037 }, 28038 setHandler : function(b, a) { 28039 if (this.handler) { 28040 this.un("click", this.handler, this.scope) 28041 } 28042 this.on("click", this.handler = b, this.scope = a) 28043 }, 28044 onClick : function(a) { 28045 if (!this.disabled 28046 && this.fireEvent("click", this, a) !== false 28047 && (this.parentMenu && this.parentMenu.fireEvent( 28048 "itemclick", this, a) !== false)) { 28049 this.handleClick(a) 28050 } else { 28051 a.stopEvent() 28052 } 28053 }, 28054 activate : function() { 28055 if (this.disabled) { 28056 return false 28057 } 28058 var a = this.container; 28059 a.addClass(this.activeClass);
28060 this.region = a.getRegion().adjust(2, 2, -2, -2); 28061 this.fireEvent("activate", this); 28062 return true 28063 }, 28064 deactivate : function() { 28065 this.container.removeClass(this.activeClass); 28066 this.fireEvent("deactivate", this) 28067 }, 28068 shouldDeactivate : function(a) { 28069 return !this.region || !this.region.contains(a.getPoint()) 28070 }, 28071 handleClick : function(b) { 28072 var a = this.parentMenu; 28073 if (this.hideOnClick) { 28074 if (a.floating) { 28075 this.clickHideDelayTimer = a.hide.defer( 28076 this.clickHideDelay, a, [true]) 28077 } else { 28078 a.deactivateActive() 28079 } 28080 } 28081 }, 28082 beforeDestroy : function() { 28083 clearTimeout(this.clickHideDelayTimer); 28084 Ext.menu.BaseItem.superclass.beforeDestroy.call(this) 28085 }, 28086 expandMenu : Ext.emptyFn, 28087 hideMenu : Ext.emptyFn 28088 }); 28089Ext.reg("menubaseitem", Ext.menu.BaseItem); 28090Ext.menu.TextItem = Ext.extend(Ext.menu.BaseItem, { 28091 hideOnClick : false, 28092 itemCls : "x-menu-text", 28093 constructor : function(a) { 28094 if (typeof a == "string") { 28095 a = { 28096 text : a 28097 } 28098 } 28099 Ext.menu.TextItem.superclass.constructor.call(this, a) 28100 }, 28101 onRender : function() { 28102 var a = document.createElement("span"); 28103 a.className = this.itemCls; 28104 a.innerHTML = this.text; 28105 this.el = a; 28106 Ext.menu.TextItem.superclass.onRender.apply(this, arguments) 28107 } 28108 }); 28109Ext.reg("menutextitem", Ext.menu.TextItem); 28110Ext.menu.Separator = Ext.extend(Ext.menu.BaseItem, { 28111 itemCls : "x-menu-sep", 28112 hideOnClick : false, 28113 activeClass : "", 28114 onRender : function(a) { 28115 var b = document.createElement("span"); 28116 b.className = this.itemCls; 28117 b.innerHTML = " "; 28118 this.el = b; 28119 a.addClass("x-menu-sep-li"); 28120 Ext.menu.Separator.superclass.onRender.apply(this, arguments) 28121 } 28122 }); 28123Ext.reg("menuseparator", Ext.menu.Separator); 28124Ext.menu.Item = Ext.extend(Ext.menu.BaseItem, { 28125 itemCls : "x-menu-item", 28126 canActivate : true, 28127 showDelay : 200, 28128 altText : "", 28129 hideDelay : 200, 28130 ctype : "Ext.menu.Item", 28131 initComponent : function() { 28132 Ext.menu.Item.superclass.initComponent.call(this); 28133 if (this.menu) { 28134 if (Ext.isArray(this.menu)) { 28135 this.menu = { 28136 items : this.menu 28137 } 28138 } 28139 if (Ext.isObject(this.menu)) { 28140 this.menu.ownerCt = this 28141 } 28142 this.menu = Ext.menu.MenuMgr.get(this.menu); 28143 this.menu.ownerCt = undefined 28144 } 28145 }, 28146 onRender : function(d, b) { 28147 if (!this.itemTpl) { 28148 this.itemTpl = Ext.menu.Item.prototype.itemTpl = new Ext.XTemplate( 28149 '<a id="{id}" class="{cls}" hidefocus="true" unselectable="on" href="{href}"', 28150 '<tpl if="hrefTarget">', 28151 ' target="{hrefTarget}"', 28152 "</tpl>", 28153 ">", 28154 '<img alt="{altText}" src="{icon}" class="x-menu-item-icon {iconCls}"/>', 28155 '<span class="x-menu-item-text">{text}</span>', "</a>") 28156 } 28157 var c = this.getTemplateArgs(); 28158 this.el = b ? this.itemTpl.insertBefore(b, c, true) : this.itemTpl 28159 .append(d, c, true); 28160 this.iconEl = this.el.child("img.x-menu-item-icon"); 28161 this.textEl = this.el.child(".x-menu-item-text"); 28162 if (!this.href) { 28163 this.mon(this.el, "click", Ext.emptyFn, null, { 28164 preventDefault : true 28165 }) 28166 } 28167 Ext.menu.Item.superclass.onRender.call(this, d, b) 28168 }, 28169 getTemplateArgs : function() { 28170 return { 28171 id : this.id, 28172 cls : this.itemCls + (this.menu ? " x-menu-item-arrow" : "") 28173 + (this.cls ? " " + this.cls : ""), 28174 href : this.href || "#", 28175 hrefTarget : this.hrefTarget, 28176 icon : this.icon || Ext.BLANK_IMAGE_URL, 28177 iconCls : this.iconCls || "", 28178 text : this.itemText || this.text || " ", 28179 altText : this.altText || "" 28180 } 28181 }, 28182 setText : function(a) { 28183 this.text = a || " "; 28184 if (this.rendered) { 28185 this.textEl.update(this.text); 28186 this.parentMenu.layout.doAutoSize() 28187 } 28188 }, 28189 setIconClass : function(a) { 28190 var b = this.iconCls; 28191 this.iconCls = a; 28192 if (this.rendered) { 28193 this.iconEl.replaceClass(b, this.iconCls) 28194 } 28195 }, 28196 beforeDestroy : function() { 28197 clearTimeout(this.showTimer); 28198 clearTimeout(this.hideTimer); 28199 if (this.menu) { 28200 delete this.menu.ownerCt; 28201 this.menu.destroy() 28202 } 28203 Ext.menu.Item.superclass.beforeDestroy.call(this) 28204 }, 28205 handleClick : function(a) { 28206 if (!this.href) { 28207 a.stopEvent() 28208 } 28209 Ext.menu.Item.superclass.handleClick.apply(this, arguments) 28210 }, 28211 activate : function(a) { 28212 if (Ext.menu.Item.superclass.activate.apply(this, arguments)) { 28213 this.focus(); 28214 if (a) { 28215 this.expandMenu() 28216 } 28217 } 28218 return true 28219 }, 28220 shouldDeactivate : function(a) { 28221 if (Ext.menu.Item.superclass.shouldDeactivate.call(this, a)) { 28222 if (this.menu && this.menu.isVisible()) { 28223 return !this.menu.getEl().getRegion().contains(a.getPoint()) 28224 } 28225 return true 28226 } 28227 return false 28228 }, 28229 deactivate : function() { 28230 Ext.menu.Item.superclass.deactivate.apply(this, arguments); 28231 this.hideMenu() 28232 }, 28233 expandMenu : function(a) { 28234 if (!this.disabled && this.menu) { 28235 clearTimeout(this.hideTimer); 28236 delete this.hideTimer; 28237 if (!this.menu.isVisible() && !this.showTimer) { 28238 this.showTimer = this.deferExpand.defer(this.showDelay, this, 28239 [a]) 28240 } else { 28241 if (this.menu.isVisible() && a) { 28242 this.menu.tryActivate(0, 1) 28243 } 28244 } 28245 } 28246 }, 28247 deferExpand : function(a) { 28248 delete this.showTimer; 28249 this.menu.show(this.container, 28250 this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu); 28251 if (a) { 28252 this.menu.tryActivate(0, 1) 28253 } 28254 }, 28255 hideMenu : function() { 28256 clearTimeout(this.showTimer); 28257 delete this.showTimer; 28258 if (!this.hideTimer && this.menu && this.menu.isVisible()) { 28259 this.hideTimer = this.deferHide.defer(this.hideDelay, this) 28260 } 28261 }, 28262 deferHide : function() { 28263 delete this.hideTimer; 28264 if (this.menu.over) { 28265 this.parentMenu.setActiveItem(this, false) 28266 } else { 28267 this.menu.hide() 28268 } 28269 } 28270}); 28271Ext.reg("menuitem", Ext.menu.Item); 28272Ext.menu.CheckItem = Ext.extend(Ext.menu.Item, { 28273 itemCls : "x-menu-item x-menu-check-item", 28274 groupClass : "x-menu-group-item", 28275 checked : false, 28276 ctype : "Ext.menu.CheckItem", 28277 initComponent : function() { 28278 Ext.menu.CheckItem.superclass.initComponent.call(this); 28279 this.addEvents("beforecheckchange", "checkchange"); 28280 if (this.checkHandler) { 28281 this.on("checkchange", this.checkHandler, this.scope) 28282 } 28283 Ext.menu.MenuMgr.registerCheckable(this) 28284 }, 28285 onRender : function(a) { 28286 Ext.menu.CheckItem.superclass.onRender.apply(this, arguments); 28287 if (this.group) { 28288 this.el.addClass(this.groupClass) 28289 } 28290 if (this.checked) { 28291 this.checked = false; 28292 this.setChecked(true, true) 28293 } 28294 }, 28295 destroy : function() { 28296 Ext.menu.MenuMgr.unregisterCheckable(this); 28297 Ext.menu.CheckItem.superclass.destroy.apply(this, arguments) 28298 }, 28299 setChecked : function(b, a) { 28300 var c = a === true; 28301 if (this.checked != b 28302 && (c || this.fireEvent("beforecheckchange", this, b) !== false)) {
28303 Ext.menu.MenuMgr.onCheckChange(this, b); 28304 if (this.container) { 28305 this.container[b ? "addClass" : "removeClass"]("x-menu-item-checked") 28306 } 28307 this.checked = b; 28308 if (!c) { 28309 this.fireEvent("checkchange", this, b) 28310 } 28311 } 28312 }, 28313 handleClick : function(a) { 28314 if (!this.disabled && !(this.checked && this.group)) { 28315 this.setChecked(!this.checked) 28316 } 28317 Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments) 28318 } 28319}); 28320Ext.reg("menucheckitem", Ext.menu.CheckItem); 28321Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, { 28322 enableScrolling : false, 28323 hideOnClick : true, 28324 pickerId : null, 28325 cls : "x-date-menu", 28326 initComponent : function() { 28327 this.on("beforeshow", this.onBeforeShow, this); 28328 if (this.strict = (Ext.isIE7 && Ext.isStrict)) { 28329 this.on("show", this.onShow, this, { 28330 single : true, 28331 delay : 20 28332 }) 28333 } 28334 Ext.apply(this, { 28335 plain : true, 28336 showSeparator : false, 28337 items : this.picker = new Ext.DatePicker(Ext 28338 .applyIf({ 28339 internalRender : this.strict 28340 || !Ext.isIE, 28341 ctCls : "x-menu-date-item", 28342 id : this.pickerId 28343 }, this.initialConfig)) 28344 }); 28345 this.picker.purgeListeners(); 28346 Ext.menu.DateMenu.superclass.initComponent.call(this); 28347 this.relayEvents(this.picker, ["select"]); 28348 this.on("show", this.picker.focus, this.picker); 28349 this.on("select", this.menuHide, this); 28350 if (this.handler) { 28351 this.on("select", this.handler, this.scope || this) 28352 } 28353 }, 28354 menuHide : function() { 28355 if (this.hideOnClick) { 28356 this.hide(true) 28357 } 28358 }, 28359 onBeforeShow : function() { 28360 if (this.picker) { 28361 this.picker.hideMonthPicker(true) 28362 } 28363 }, 28364 onShow : function() { 28365 var a = this.picker.getEl(); 28366 a.setWidth(a.getWidth()) 28367 } 28368 }); 28369Ext.reg("datemenu", Ext.menu.DateMenu); 28370Ext.menu.ColorMenu = Ext.extend(Ext.menu.Menu, { 28371 enableScrolling : false, 28372 hideOnClick : true, 28373 cls : "x-color-menu", 28374 paletteId : null, 28375 initComponent : function() { 28376 Ext.apply(this, { 28377 plain : true, 28378 showSeparator : false, 28379 items : this.palette = new Ext.ColorPalette(Ext 28380 .applyIf({ 28381 id : this.paletteId 28382 }, this.initialConfig)) 28383 }); 28384 this.palette.purgeListeners(); 28385 Ext.menu.ColorMenu.superclass.initComponent.call(this); 28386 this.relayEvents(this.palette, ["select"]); 28387 this.on("select", this.menuHide, this); 28388 if (this.handler) { 28389 this.on("select", this.handler, this.scope || this) 28390 } 28391 }, 28392 menuHide : function() { 28393 if (this.hideOnClick) { 28394 this.hide(true) 28395 } 28396 } 28397 }); 28398Ext.reg("colormenu", Ext.menu.ColorMenu); 28399Ext.form.Field = Ext.extend(Ext.BoxComponent, { 28400 invalidClass : "x-form-invalid", 28401 invalidText : "The value in this field is invalid", 28402 focusClass : "x-form-focus", 28403 validationEvent : "keyup", 28404 validateOnBlur : true, 28405 validationDelay : 250, 28406 defaultAutoCreate : { 28407 tag : "input", 28408 type : "text", 28409 size : "20", 28410 autocomplete : "off" 28411 }, 28412 fieldClass : "x-form-field", 28413 msgTarget : "qtip", 28414 msgFx : "normal", 28415 readOnly : false, 28416 disabled : false, 28417 submitValue : true, 28418 isFormField : true, 28419 msgDisplay : "", 28420 hasFocus : false, 28421 tabIndex : -1, 28422 initComponent : function() { 28423 Ext.form.Field.superclass.initComponent.call(this); 28424 this.addEvents("focus", "blur", "specialkey", "change", 28425 "invalid", "valid") 28426 }, 28427 getName : function() { 28428 return this.rendered && this.el.dom.name 28429 ? this.el.dom.name 28430 : this.name || this.id || "" 28431 }, 28432 onRender : function(c, a) { 28433 if (!this.el) { 28434 var b = this.getAutoCreate(); 28435 if (!b.name) { 28436 b.name = this.name || this.id 28437 } 28438 if (this.inputType) { 28439 b.type = this.inputType 28440 } 28441 this.autoEl = b 28442 } 28443 Ext.form.Field.superclass.onRender.call(this, c, a); 28444 if (this.submitValue === false) { 28445 this.el.dom.removeAttribute("name") 28446 } 28447 var d = this.el.dom.type; 28448 if (d) { 28449 if (d == "password") { 28450 d = "text" 28451 } 28452 this.el.addClass("x-form-" + d) 28453 } 28454 if (this.readOnly) { 28455 this.setReadOnly(true) 28456 } 28457 if (this.tabIndex !== undefined) { 28458 this.el.dom.setAttribute("tabIndex", this.tabIndex) 28459 } 28460 this.el.addClass([this.fieldClass, this.cls]) 28461 }, 28462 getItemCt : function() { 28463 return this.itemCt 28464 }, 28465 initValue : function() { 28466 if (this.value !== undefined) { 28467 this.setValue(this.value) 28468 } else { 28469 if (!Ext.isEmpty(this.el.dom.value) 28470 && this.el.dom.value != this.emptyText) { 28471 this.setValue(this.el.dom.value) 28472 } 28473 } 28474 this.originalValue = this.getValue() 28475 }, 28476 isDirty : function() { 28477 if (this.disabled || !this.rendered) { 28478 return false 28479 } 28480 return String(this.getValue()) !== String(this.originalValue) 28481 }, 28482 setReadOnly : function(a) { 28483 if (this.rendered) { 28484 this.el.dom.readOnly = a 28485 } 28486 this.readOnly = a 28487 }, 28488 afterRender : function() { 28489 Ext.form.Field.superclass.afterRender.call(this); 28490 this.initEvents(); 28491 this.initValue() 28492 }, 28493 fireKey : function(a) { 28494 if (a.isSpecialKey()) { 28495 this.fireEvent("specialkey", this, a) 28496 } 28497 }, 28498 reset : function() { 28499 this.setValue(this.originalValue); 28500 this.clearInvalid() 28501 }, 28502 initEvents : function() { 28503 this.mon(this.el, Ext.EventManager.getKeyEvent(), this.fireKey, 28504 this); 28505 this.mon(this.el, "focus", this.onFocus, this); 28506 this.mon(this.el, "blur", this.onBlur, this, this.inEditor ? { 28507 buffer : 10 28508 } : null) 28509 }, 28510 preFocus : Ext.emptyFn, 28511 onFocus : function() { 28512 this.preFocus(); 28513 if (this.focusClass) { 28514 this.el.addClass(this.focusClass) 28515 } 28516 if (!this.hasFocus) { 28517 this.hasFocus = true; 28518 this.startValue = this.getValue(); 28519 this.fireEvent("focus", this) 28520 } 28521 }, 28522 beforeBlur : Ext.emptyFn, 28523 onBlur : function() { 28524 this.beforeBlur(); 28525 if (this.focusClass) { 28526 this.el.removeClass(this.focusClass) 28527 } 28528 this.hasFocus = false; 28529 if (this.validationEvent !== false 28530 && (this.validateOnBlur || this.validationEvent == "blur")) { 28531 this.validate() 28532 } 28533 var a = this.getValue(); 28534 if (String(a) !== String(this.startValue)) { 28535 this.fireEvent("change", this, a, this.startValue) 28536 } 28537 this.fireEvent("blur", this); 28538 this.postBlur() 28539 }, 28540 postBlur : Ext.emptyFn, 28541 isValid : function(a) { 28542 if (this.disabled) { 28543 return true 28544 } 28545 var c = this.preventMark; 28546 this.preventMark = a === true; 28547 var b = this.validateValue(this 28548 .processValue(this.getRawValue()), a); 28549 this.preventMark = c; 28550 return b 28551 }, 28552 validate : function() { 28553 if (this.disabled 28554 || this.validateValue(this.processValue(this 28555 .getRawValue()))) { 28556 this.clearInvalid(); 28557 return true 28558 } 28559 return false 28560 }, 28561 processValue : function(a) { 28562 return a 28563 }, 28564 validateValue : function(b) { 28565 var a = this.getErrors(b)[0]; 28566 if (a == undefined) { 28567 return true 28568 } else { 28569 this.markInvalid(a); 28570 return false 28571 } 28572 }, 28573 getErrors : function() { 28574 return [] 28575 }, 28576 getActiveError : function() { 28577 return this.activeError || "" 28578 }, 28579 markInvalid : function(c) { 28580 if (this.rendered && !this.preventMark) { 28581 c = c || this.invalidText; 28582 var a = this.getMessageHandler(); 28583 if (a) { 28584 a.mark(this, c) 28585 } else { 28586 if (this.msgTarget) { 28587 this.el.addClass(this.invalidClass); 28588 var b = Ext.getDom(this.msgTarget); 28589 if (b) { 28590 b.innerHTML = c; 28591 b.style.display = this.msgDisplay 28592 } 28593 } 28594 } 28595 } 28596 this.setActiveError(c) 28597 }, 28598 clearInvalid : function() { 28599 if (this.rendered && !this.preventMark) { 28600 this.el.removeClass(this.invalidClass); 28601 var a = this.getMessageHandler(); 28602 if (a) { 28603 a.clear(this) 28604 } else { 28605 if (this.msgTarget) { 28606 this.el.removeClass(this.invalidClass); 28607 var b = Ext.getDom(this.msgTarget); 28608 if (b) { 28609 b.innerHTML = ""; 28610 b.style.display = "none" 28611 } 28612 } 28613 } 28614 } 28615 this.unsetActiveError() 28616 }, 28617 setActiveError : function(b, a) { 28618 this.activeError = b; 28619 if (a !== true) { 28620 this.fireEvent("invalid", this, b) 28621 } 28622 }, 28623 unsetActiveError : function(a) { 28624 delete this.activeError; 28625 if (a !== true) { 28626 this.fireEvent("valid", this) 28627 } 28628 }, 28629 getMessageHandler : function() { 28630 return Ext.form.MessageTargets[this.msgTarget] 28631 }, 28632 getErrorCt : function() { 28633 return this.el.findParent(".x-form-element", 5, true) 28634 || this.el.findParent(".x-form-field-wrap", 5, true) 28635 }, 28636 alignErrorEl : function() { 28637 this.errorEl.setWidth(this.getErrorCt().getWidth(true) - 20) 28638 }, 28639 alignErrorIcon : function() { 28640 this.errorIcon.alignTo(this.el, "tl-tr", [2, 0]) 28641 }, 28642 getRawValue : function() { 28643 var a = this.rendered ? this.el.getValue() : Ext.value( 28644 this.value, ""); 28645 if (a === this.emptyText) { 28646 a = "" 28647 } 28648 return a 28649 }, 28650 getValue : function() { 28651 if (!this.rendered) { 28652 return this.value 28653 } 28654 var a = this.el.getValue(); 28655 if (a === this.emptyText || a === undefined) { 28656 a = "" 28657 } 28658 return a 28659 }, 28660 setRawValue : function(a) { 28661 return this.rendered ? (this.el.dom.value = (Ext.isEmpty(a) 28662 ? "" 28663 : a)) : "" 28664 }, 28665 setValue : function(a) { 28666 this.value = a; 28667 if (this.rendered) { 28668 this.el.dom.value = (Ext.isEmpty(a) ? "" : a); 28669 this.validate() 28670 } 28671 return this 28672 }, 28673 append : function(a) { 28674 this.setValue([this.getValue(), a].join("")) 28675 } 28676 }); 28677Ext.form.MessageTargets = { 28678 qtip : { 28679 mark : function(a, b) { 28680 a.el.addClass(a.invalidClass); 28681 a.el.dom.qtip = b; 28682 a.el.dom.qclass = "x-form-invalid-tip"; 28683 if (Ext.QuickTips) { 28684 Ext.QuickTips.enable() 28685 } 28686 }, 28687 clear : function(a) { 28688 a.el.removeClass(a.invalidClass); 28689 a.el.dom.qtip = "" 28690 } 28691 }, 28692 title : { 28693 mark : function(a, b) { 28694 a.el.addClass(a.invalidClass); 28695 a.el.dom.title = b 28696 }, 28697 clear : function(a) { 28698 a.el.dom.title = "" 28699 } 28700 }, 28701 under : { 28702 mark : function(b, c) {
28703 b.el.addClass(b.invalidClass); 28704 if (!b.errorEl) { 28705 var a = b.getErrorCt(); 28706 if (!a) { 28707 b.el.dom.title = c; 28708 return 28709 } 28710 b.errorEl = a.createChild({ 28711 cls : "x-form-invalid-msg" 28712 }); 28713 b.on("resize", b.alignErrorEl, b); 28714 b.on("destroy", function() { 28715 Ext.destroy(this.errorEl) 28716 }, b) 28717 } 28718 b.alignErrorEl(); 28719 b.errorEl.update(c); 28720 Ext.form.Field.msgFx[b.msgFx].show(b.errorEl, b) 28721 }, 28722 clear : function(a) { 28723 a.el.removeClass(a.invalidClass); 28724 if (a.errorEl) { 28725 Ext.form.Field.msgFx[a.msgFx].hide(a.errorEl, a) 28726 } else { 28727 a.el.dom.title = "" 28728 } 28729 } 28730 }, 28731 side : { 28732 mark : function(b, c) { 28733 b.el.addClass(b.invalidClass); 28734 if (!b.errorIcon) { 28735 var a = b.getErrorCt(); 28736 if (!a) { 28737 b.el.dom.title = c; 28738 return 28739 } 28740 b.errorIcon = a.createChild({ 28741 cls : "x-form-invalid-icon" 28742 }); 28743 if (b.ownerCt) { 28744 b.ownerCt.on("afterlayout", b.alignErrorIcon, b); 28745 b.ownerCt.on("expand", b.alignErrorIcon, b) 28746 } 28747 b.on("resize", b.alignErrorIcon, b); 28748 b.on("destroy", function() { 28749 Ext.destroy(this.errorIcon) 28750 }, b) 28751 } 28752 b.alignErrorIcon(); 28753 b.errorIcon.dom.qtip = c; 28754 b.errorIcon.dom.qclass = "x-form-invalid-tip"; 28755 b.errorIcon.show() 28756 }, 28757 clear : function(a) { 28758 a.el.removeClass(a.invalidClass); 28759 if (a.errorIcon) { 28760 a.errorIcon.dom.qtip = ""; 28761 a.errorIcon.hide() 28762 } else { 28763 a.el.dom.title = "" 28764 } 28765 } 28766 } 28767}; 28768Ext.form.Field.msgFx = { 28769 normal : { 28770 show : function(a, b) { 28771 a.setDisplayed("block") 28772 }, 28773 hide : function(a, b) { 28774 a.setDisplayed(false).update("") 28775 } 28776 }, 28777 slide : { 28778 show : function(a, b) { 28779 a.slideIn("t", { 28780 stopFx : true 28781 }) 28782 }, 28783 hide : function(a, b) { 28784 a.slideOut("t", { 28785 stopFx : true, 28786 useDisplay : true 28787 }) 28788 } 28789 }, 28790 slideRight : { 28791 show : function(a, b) { 28792 a.fixDisplay(); 28793 a.alignTo(b.el, "tl-tr"); 28794 a.slideIn("l", { 28795 stopFx : true 28796 }) 28797 }, 28798 hide : function(a, b) { 28799 a.slideOut("l", { 28800 stopFx : true, 28801 useDisplay : true 28802 }) 28803 } 28804 } 28805}; 28806Ext.reg("field", Ext.form.Field); 28807Ext.form.TextField = Ext.extend(Ext.form.Field, { 28808 grow : false, 28809 growMin : 30, 28810 growMax : 800, 28811 vtype : null, 28812 maskRe : null, 28813 disableKeyFilter : false, 28814 allowBlank : true, 28815 minLength : 0, 28816 maxLength : Number.MAX_VALUE, 28817 minLengthText : "The minimum length for this field is {0}", 28818 maxLengthText : "The maximum length for this field is {0}", 28819 selectOnFocus : false, 28820 blankText : "This field is required", 28821 validator : null, 28822 regex : null, 28823 regexText : "", 28824 emptyText : null, 28825 emptyClass : "x-form-empty-field", 28826 initComponent : function() { 28827 Ext.form.TextField.superclass.initComponent.call(this); 28828 this.addEvents("autosize", "keydown", "keyup", "keypress") 28829 }, 28830 initEvents : function() { 28831 Ext.form.TextField.superclass.initEvents.call(this); 28832 if (this.validationEvent == "keyup") { 28833 this.validationTask = new Ext.util.DelayedTask(this.validate, this); 28834 this.mon(this.el, "keyup", this.filterValidation, this) 28835 } else { 28836 if (this.validationEvent !== false 28837 && this.validationEvent != "blur") { 28838 this.mon(this.el, this.validationEvent, this.validate, this, { 28839 buffer : this.validationDelay 28840 }) 28841 } 28842 } 28843 if (this.selectOnFocus || this.emptyText) { 28844 this.mon(this.el, "mousedown", this.onMouseDown, this); 28845 if (this.emptyText) { 28846 this.applyEmptyText() 28847 } 28848 } 28849 if (this.maskRe 28850 || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype 28851 + "Mask"]))) { 28852 this.mon(this.el, "keypress", this.filterKeys, this) 28853 } 28854 if (this.grow) { 28855 this.mon(this.el, "keyup", this.onKeyUpBuffered, this, { 28856 buffer : 50 28857 }); 28858 this.mon(this.el, "click", this.autoSize, this) 28859 } 28860 if (this.enableKeyEvents) { 28861 this.mon(this.el, { 28862 scope : this, 28863 keyup : this.onKeyUp, 28864 keydown : this.onKeyDown, 28865 keypress : this.onKeyPress 28866 }) 28867 } 28868 }, 28869 onMouseDown : function(a) { 28870 if (!this.hasFocus) { 28871 this.mon(this.el, "mouseup", Ext.emptyFn, this, { 28872 single : true, 28873 preventDefault : true 28874 }) 28875 } 28876 }, 28877 processValue : function(a) { 28878 if (this.stripCharsRe) { 28879 var b = a.replace(this.stripCharsRe, ""); 28880 if (b !== a) { 28881 this.setRawValue(b); 28882 return b 28883 } 28884 } 28885 return a 28886 }, 28887 filterValidation : function(a) { 28888 if (!a.isNavKeyPress()) { 28889 this.validationTask.delay(this.validationDelay) 28890 } 28891 }, 28892 onDisable : function() { 28893 Ext.form.TextField.superclass.onDisable.call(this); 28894 if (Ext.isIE) { 28895 this.el.dom.unselectable = "on" 28896 } 28897 }, 28898 onEnable : function() { 28899 Ext.form.TextField.superclass.onEnable.call(this); 28900 if (Ext.isIE) { 28901 this.el.dom.unselectable = "" 28902 } 28903 }, 28904 onKeyUpBuffered : function(a) { 28905 if (this.doAutoSize(a)) { 28906 this.autoSize() 28907 } 28908 }, 28909 doAutoSize : function(a) { 28910 return !a.isNavKeyPress() 28911 }, 28912 onKeyUp : function(a) { 28913 this.fireEvent("keyup", this, a) 28914 }, 28915 onKeyDown : function(a) { 28916 this.fireEvent("keydown", this, a) 28917 }, 28918 onKeyPress : function(a) { 28919 this.fireEvent("keypress", this, a) 28920 }, 28921 reset : function() { 28922 Ext.form.TextField.superclass.reset.call(this); 28923 this.applyEmptyText() 28924 }, 28925 applyEmptyText : function() { 28926 if (this.rendered && this.emptyText && this.getRawValue().length < 1 28927 && !this.hasFocus) { 28928 this.setRawValue(this.emptyText); 28929 this.el.addClass(this.emptyClass) 28930 } 28931 }, 28932 preFocus : function() { 28933 var a = this.el, b; 28934 if (this.emptyText) { 28935 if (a.dom.value == this.emptyText) { 28936 this.setRawValue(""); 28937 b = true 28938 } 28939 a.removeClass(this.emptyClass) 28940 } 28941 if (this.selectOnFocus || b) { 28942 a.dom.select() 28943 } 28944 }, 28945 postBlur : function() { 28946 this.applyEmptyText() 28947 }, 28948 filterKeys : function(b) { 28949 if (b.ctrlKey) { 28950 return 28951 } 28952 var a = b.getKey(); 28953 if (Ext.isGecko
28954 && (b.isNavKeyPress() || a == b.BACKSPACE || (a == b.DELETE && b.button == -1))) { 28955 return 28956 } 28957 var c = String.fromCharCode(b.getCharCode()); 28958 if (!Ext.isGecko && b.isSpecialKey() && !c) { 28959 return 28960 } 28961 if (!this.maskRe.test(c)) { 28962 b.stopEvent() 28963 } 28964 }, 28965 setValue : function(a) { 28966 if (this.emptyText && this.el && !Ext.isEmpty(a)) { 28967 this.el.removeClass(this.emptyClass) 28968 } 28969 Ext.form.TextField.superclass.setValue.apply(this, arguments); 28970 this.applyEmptyText(); 28971 this.autoSize(); 28972 return this 28973 }, 28974 getErrors : function(a) { 28975 var d = Ext.form.TextField.superclass.getErrors.apply(this, arguments); 28976 a = Ext.isDefined(a) ? a : this.processValue(this.getRawValue()); 28977 if (Ext.isFunction(this.validator)) { 28978 var c = this.validator(a); 28979 if (c !== true) { 28980 d.push(c) 28981 } 28982 } 28983 if (a.length < 1 || a === this.emptyText) { 28984 if (this.allowBlank) { 28985 return d 28986 } else { 28987 d.push(this.blankText) 28988 } 28989 } 28990 if (!this.allowBlank && (a.length < 1 || a === this.emptyText)) { 28991 d.push(this.blankText) 28992 } 28993 if (a.length < this.minLength) { 28994 d.push(String.format(this.minLengthText, this.minLength)) 28995 } 28996 if (a.length > this.maxLength) { 28997 d.push(String.format(this.maxLengthText, this.maxLength)) 28998 } 28999 if (this.vtype) { 29000 var b = Ext.form.VTypes; 29001 if (!b[this.vtype](a, this)) { 29002 d.push(this.vtypeText || b[this.vtype + "Text"]) 29003 } 29004 } 29005 if (this.regex && !this.regex.test(a)) { 29006 d.push(this.regexText) 29007 } 29008 return d 29009 }, 29010 selectText : function(h, a) { 29011 var c = this.getRawValue(); 29012 var e = false; 29013 if (c.length > 0) { 29014 h = h === undefined ? 0 : h; 29015 a = a === undefined ? c.length : a; 29016 var g = this.el.dom; 29017 if (g.setSelectionRange) { 29018 g.setSelectionRange(h, a) 29019 } else { 29020 if (g.createTextRange) { 29021 var b = g.createTextRange(); 29022 b.moveStart("character", h); 29023 b.moveEnd("character", a - c.length); 29024 b.select() 29025 } 29026 } 29027 e = Ext.isGecko || Ext.isOpera 29028 } else { 29029 e = true 29030 } 29031 if (e) { 29032 this.focus() 29033 } 29034 }, 29035 autoSize : function() { 29036 if (!this.grow || !this.rendered) { 29037 return 29038 } 29039 if (!this.metrics) { 29040 this.metrics = Ext.util.TextMetrics.createInstance(this.el) 29041 } 29042 var c = this.el; 29043 var b = c.dom.value; 29044 var e = document.createElement("div"); 29045 e.appendChild(document.createTextNode(b)); 29046 b = e.innerHTML; 29047 Ext.removeNode(e); 29048 e = null; 29049 b += " "; 29050 var a = Math.min(this.growMax, Math.max(this.metrics.getWidth(b) + 10, 29051 this.growMin)); 29052 this.el.setWidth(a); 29053 this.fireEvent("autosize", this, a) 29054 }, 29055 onDestroy : function() { 29056 if (this.validationTask) { 29057 this.validationTask.cancel(); 29058 this.validationTask = null 29059 } 29060 Ext.form.TextField.superclass.onDestroy.call(this) 29061 } 29062}); 29063Ext.reg("textfield", Ext.form.TextField); 29064Ext.form.TriggerField = Ext.extend(Ext.form.TextField, { 29065 defaultAutoCreate : { 29066 tag : "input", 29067 type : "text", 29068 size : "16", 29069 autocomplete : "off" 29070 }, 29071 hideTrigger : false, 29072 editable : true, 29073 readOnly : false, 29074 wrapFocusClass : "x-trigger-wrap-focus", 29075 autoSize : Ext.emptyFn, 29076 monitorTab : true, 29077 deferHeight : true, 29078 mimicing : false, 29079 actionMode : "wrap", 29080 defaultTriggerWidth : 17, 29081 onResize : function(a, c) { 29082 Ext.form.TriggerField.superclass.onResize.call(this, a, c); 29083 var b = this.getTriggerWidth(); 29084 if (Ext.isNumber(a)) { 29085 this.el.setWidth(a - b) 29086 } 29087 this.wrap.setWidth(this.el.getWidth() + b) 29088 }, 29089 getTriggerWidth : function() { 29090 var a = this.trigger.getWidth(); 29091 if (!this.hideTrigger && !this.readOnly && a === 0) { 29092 a = this.defaultTriggerWidth 29093 } 29094 return a 29095 }, 29096 alignErrorIcon : function() { 29097 if (this.wrap) { 29098 this.errorIcon.alignTo(this.wrap, "tl-tr", [2, 0]) 29099 } 29100 }, 29101 onRender : function(b, a) { 29102 this.doc = Ext.isIE ? Ext.getBody() : Ext.getDoc(); 29103 Ext.form.TriggerField.superclass.onRender.call(this, b, a); 29104 this.wrap = this.el.wrap({ 29105 cls : "x-form-field-wrap x-form-field-trigger-wrap" 29106 });
29107 this.trigger = this.wrap.createChild(this.triggerConfig || { 29108 tag : "img", 29109 src : Ext.BLANK_IMAGE_URL, 29110 alt : "", 29111 cls : "x-form-trigger " + this.triggerClass 29112 }); 29113 this.initTrigger(); 29114 if (!this.width) { 29115 this.wrap.setWidth(this.el.getWidth() 29116 + this.trigger.getWidth()) 29117 } 29118 this.resizeEl = this.positionEl = this.wrap 29119 }, 29120 getWidth : function() { 29121 return (this.el.getWidth() + this.trigger.getWidth()) 29122 }, 29123 updateEditState : function() { 29124 if (this.rendered) { 29125 if (this.readOnly) { 29126 this.el.dom.readOnly = true; 29127 this.el.addClass("x-trigger-noedit"); 29128 this.mun(this.el, "click", this.onTriggerClick, this); 29129 this.trigger.setDisplayed(false) 29130 } else { 29131 if (!this.editable) { 29132 this.el.dom.readOnly = true; 29133 this.el.addClass("x-trigger-noedit"); 29134 this.mon(this.el, "click", this.onTriggerClick, 29135 this) 29136 } else { 29137 this.el.dom.readOnly = false; 29138 this.el.removeClass("x-trigger-noedit"); 29139 this.mun(this.el, "click", this.onTriggerClick, 29140 this) 29141 } 29142 this.trigger.setDisplayed(!this.hideTrigger) 29143 } 29144 this.onResize(this.width || this.wrap.getWidth()) 29145 } 29146 }, 29147 setHideTrigger : function(a) { 29148 if (a != this.hideTrigger) { 29149 this.hideTrigger = a; 29150 this.updateEditState() 29151 } 29152 }, 29153 setEditable : function(a) { 29154 if (a != this.editable) { 29155 this.editable = a; 29156 this.updateEditState() 29157 } 29158 }, 29159 setReadOnly : function(a) { 29160 if (a != this.readOnly) { 29161 this.readOnly = a; 29162 this.updateEditState() 29163 } 29164 }, 29165 afterRender : function() { 29166 Ext.form.TriggerField.superclass.afterRender.call(this); 29167 this.updateEditState() 29168 }, 29169 initTrigger : function() { 29170 this.mon(this.trigger, "click", this.onTriggerClick, this, { 29171 preventDefault : true 29172 }); 29173 this.trigger.addClassOnOver("x-form-trigger-over"); 29174 this.trigger.addClassOnClick("x-form-trigger-click") 29175 }, 29176 onDestroy : function() { 29177 Ext.destroy(this.trigger, this.wrap); 29178 if (this.mimicing) { 29179 this.doc.un("mousedown", this.mimicBlur, this) 29180 } 29181 delete this.doc; 29182 Ext.form.TriggerField.superclass.onDestroy.call(this) 29183 }, 29184 onFocus : function() { 29185 Ext.form.TriggerField.superclass.onFocus.call(this); 29186 if (!this.mimicing) { 29187 this.wrap.addClass(this.wrapFocusClass); 29188 this.mimicing = true; 29189 this.doc.on("mousedown", this.mimicBlur, this, { 29190 delay : 10 29191 }); 29192 if (this.monitorTab) { 29193 this.on("specialkey", this.checkTab, this) 29194 } 29195 } 29196 }, 29197 checkTab : function(a, b) { 29198 if (b.getKey() == b.TAB) { 29199 this.triggerBlur() 29200 } 29201 }, 29202 onBlur : Ext.emptyFn, 29203 mimicBlur : function(a) { 29204 if (!this.isDestroyed && !this.wrap.contains(a.target) 29205 && this.validateBlur(a)) { 29206 this.triggerBlur() 29207 } 29208 }, 29209 triggerBlur : function() { 29210 this.mimicing = false; 29211 this.doc.un("mousedown", this.mimicBlur, this); 29212 if (this.monitorTab && this.el) { 29213 this.un("specialkey", this.checkTab, this) 29214 } 29215 Ext.form.TriggerField.superclass.onBlur.call(this); 29216 if (this.wrap) { 29217 this.wrap.removeClass(this.wrapFocusClass) 29218 } 29219 }, 29220 beforeBlur : Ext.emptyFn, 29221 validateBlur : function(a) { 29222 return true 29223 }, 29224 onTriggerClick : Ext.emptyFn 29225 }); 29226Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, { 29227 initComponent : function() { 29228 Ext.form.TwinTriggerField.superclass.initComponent.call(this); 29229 this.triggerConfig = { 29230 tag : "span", 29231 cls : "x-form-twin-triggers", 29232 cn : [{ 29233 tag : "img", 29234 src : Ext.BLANK_IMAGE_URL, 29235 alt : "", 29236 cls : "x-form-trigger " + this.trigger1Class 29237 }, { 29238 tag : "img", 29239 src : Ext.BLANK_IMAGE_URL, 29240 alt : "", 29241 cls : "x-form-trigger " + this.trigger2Class 29242 }] 29243 } 29244 }, 29245 getTrigger : function(a) { 29246 return this.triggers[a] 29247 }, 29248 afterRender : function() { 29249 Ext.form.TwinTriggerField.superclass.afterRender.call(this); 29250 var c = this.triggers, b = 0, a = c.length; 29251 for (; b < a; ++b) { 29252 if (this["hideTrigger" + (b + 1)]) { 29253 c[b].hide() 29254 } 29255 } 29256 }, 29257 initTrigger : function() { 29258 var a = this.trigger.select(".x-form-trigger", true), b = this; 29259 a.each(function(d, g, c) { 29260 var e = "Trigger" + (c + 1); 29261 d.hide = function() { 29262 var h = b.wrap.getWidth(); 29263 this.dom.style.display = "none"; 29264 b.el.setWidth(h - b.trigger.getWidth()); 29265 b["hidden" + e] = true 29266 }; 29267 d.show = function() { 29268 var h = b.wrap.getWidth(); 29269 this.dom.style.display = ""; 29270 b.el.setWidth(h - b.trigger.getWidth()); 29271 b["hidden" + e] = false 29272 }; 29273 this.mon(d, "click", this["on" + e + "Click"], 29274 this, { 29275 preventDefault : true 29276 });
29277 d.addClassOnOver("x-form-trigger-over"); 29278 d.addClassOnClick("x-form-trigger-click") 29279 }, this); 29280 this.triggers = a.elements 29281 }, 29282 getTriggerWidth : function() { 29283 var a = 0; 29284 Ext.each(this.triggers, function(d, c) { 29285 var e = "Trigger" + (c + 1), b = d.getWidth(); 29286 if (b === 0 && !this["hidden" + e]) { 29287 a += this.defaultTriggerWidth 29288 } else { 29289 a += b 29290 } 29291 }, this); 29292 return a 29293 }, 29294 onDestroy : function() { 29295 Ext.destroy(this.triggers); 29296 Ext.form.TwinTriggerField.superclass.onDestroy.call(this) 29297 }, 29298 onTrigger1Click : Ext.emptyFn, 29299 onTrigger2Click : Ext.emptyFn 29300 }); 29301Ext.reg("trigger", Ext.form.TriggerField); 29302Ext.form.TextArea = Ext.extend(Ext.form.TextField, { 29303 growMin : 60, 29304 growMax : 1000, 29305 growAppend : " \n ", 29306 enterIsSpecial : false, 29307 preventScrollbars : false, 29308 onRender : function(b, a) { 29309 if (!this.el) { 29310 this.defaultAutoCreate = { 29311 tag : "textarea", 29312 style : "width:100px;height:60px;", 29313 autocomplete : "off" 29314 } 29315 } 29316 Ext.form.TextArea.superclass.onRender.call(this, b, a); 29317 if (this.grow) { 29318 this.textSizeEl = Ext.DomHelper.append(document.body, { 29319 tag : "pre", 29320 cls : "x-form-grow-sizer" 29321 }); 29322 if (this.preventScrollbars) { 29323 this.el.setStyle("overflow", "hidden") 29324 } 29325 this.el.setHeight(this.growMin) 29326 } 29327 }, 29328 onDestroy : function() { 29329 Ext.removeNode(this.textSizeEl); 29330 Ext.form.TextArea.superclass.onDestroy.call(this) 29331 }, 29332 fireKey : function(a) { 29333 if (a.isSpecialKey() 29334 && (this.enterIsSpecial || (a.getKey() != a.ENTER || a 29335 .hasModifier()))) { 29336 this.fireEvent("specialkey", this, a) 29337 } 29338 }, 29339 doAutoSize : function(a) { 29340 return !a.isNavKeyPress() || a.getKey() == a.ENTER 29341 }, 29342 filterValidation : function(a) { 29343 if (!a.isNavKeyPress() 29344 || (!this.enterIsSpecial && a.keyCode == a.ENTER)) { 29345 this.validationTask.delay(this.validationDelay) 29346 } 29347 }, 29348 autoSize : function() { 29349 if (!this.grow || !this.textSizeEl) { 29350 return 29351 } 29352 var c = this.el, a = Ext.util.Format.htmlEncode(c.dom.value), d = this.textSizeEl, b; 29353 Ext.fly(d).setWidth(this.el.getWidth()); 29354 if (a.length < 1) { 29355 a = "  " 29356 } else { 29357 a += this.growAppend; 29358 if (Ext.isIE) { 29359 a = a.replace(/\n/g, " <br />") 29360 } 29361 } 29362 d.innerHTML = a; 29363 b = Math.min(this.growMax, Math.max(d.offsetHeight, this.growMin)); 29364 if (b != this.lastHeight) { 29365 this.lastHeight = b; 29366 this.el.setHeight(b); 29367 this.fireEvent("autosize", this, b) 29368 } 29369 } 29370}); 29371Ext.reg("textarea", Ext.form.TextArea); 29372Ext.form.NumberField = Ext.extend(Ext.form.TextField, { 29373 fieldClass : "x-form-field x-form-num-field", 29374 allowDecimals : true, 29375 decimalSeparator : ".", 29376 decimalPrecision : 2, 29377 allowNegative : true, 29378 minValue : Number.NEGATIVE_INFINITY, 29379 maxValue : Number.MAX_VALUE, 29380 minText : "The minimum value for this field is {0}", 29381 maxText : "The maximum value for this field is {0}", 29382 nanText : "{0} is not a valid number", 29383 baseChars : "0123456789", 29384 autoStripChars : false, 29385 initEvents : function() { 29386 var a = this.baseChars + ""; 29387 if (this.allowDecimals) { 29388 a += this.decimalSeparator 29389 } 29390 if (this.allowNegative) { 29391 a += "-" 29392 } 29393 a = Ext.escapeRe(a); 29394 this.maskRe = new RegExp("[" + a + "]"); 29395 if (this.autoStripChars) { 29396 this.stripCharsRe = new RegExp("[^" + a + "]", "gi") 29397 } 29398 Ext.form.NumberField.superclass.initEvents.call(this) 29399 }, 29400 getErrors : function(b) { 29401 var c = Ext.form.NumberField.superclass.getErrors.apply(this, 29402 arguments); 29403 b = Ext.isDefined(b) ? b : this 29404 .processValue(this.getRawValue()); 29405 if (b.length < 1) { 29406 return c 29407 } 29408 b = String(b).replace(this.decimalSeparator, "."); 29409 if (isNaN(b)) { 29410 c.push(String.format(this.nanText, b)) 29411 } 29412 var a = this.parseValue(b); 29413 if (a < this.minValue) { 29414 c.push(String.format(this.minText, this.minValue)) 29415 } 29416 if (a > this.maxValue) { 29417 c.push(String.format(this.maxText, this.maxValue)) 29418 } 29419 return c 29420 }, 29421 getValue : function() { 29422 return this.fixPrecision(this 29423 .parseValue(Ext.form.NumberField.superclass.getValue 29424 .call(this))) 29425 }, 29426 setValue : function(a) { 29427 a = Ext.isNumber(a) ? a : parseFloat(String(a).replace( 29428 this.decimalSeparator, ".")); 29429 a = this.fixPrecision(a); 29430 a = isNaN(a) ? "" : String(a).replace(".", 29431 this.decimalSeparator); 29432 return Ext.form.NumberField.superclass.setValue.call(this, a) 29433 }, 29434 setMinValue : function(a) { 29435 this.minValue = Ext.num(a, Number.NEGATIVE_INFINITY) 29436 }, 29437 setMaxValue : function(a) { 29438 this.maxValue = Ext.num(a, Number.MAX_VALUE) 29439 }, 29440 parseValue : function(a) { 29441 a = parseFloat(String(a).replace(this.decimalSeparator, ".")); 29442 return isNaN(a) ? "" : a 29443 }, 29444 fixPrecision : function(b) { 29445 var a = isNaN(b); 29446 if (!this.allowDecimals || this.decimalPrecision == -1 || a 29447 || !b) { 29448 return a ? "" : b 29449 } 29450 return parseFloat(parseFloat(b).toFixed(this.decimalPrecision)) 29451 }, 29452 beforeBlur : function() { 29453 var a = this.parseValue(this.getRawValue()); 29454 if (!Ext.isEmpty(a)) { 29455 this.setValue(a) 29456 } 29457 } 29458 }); 29459Ext.reg("numberfield", Ext.form.NumberField); 29460Ext.form.DateField = Ext.extend(Ext.form.TriggerField, { 29461 format : "m/d/Y", 29462 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|n-j|n/j", 29463 disabledDaysText : "Disabled", 29464 disabledDatesText : "Disabled", 29465 minText : "The date in this field must be equal to or after {0}", 29466 maxText : "The date in this field must be equal to or before {0}", 29467 invalidText : "{0} is not a valid date - it must be in the format {1}", 29468 triggerClass : "x-form-date-trigger", 29469 showToday : true, 29470 startDay : 0, 29471 defaultAutoCreate : { 29472 tag : "input", 29473 type : "text", 29474 size : "10", 29475 autocomplete : "off" 29476 }, 29477 initTime : "12", 29478 initTimeFormat : "H", 29479 safeParse : function(b, c) { 29480 if (Date.formatContainsHourInfo(c)) { 29481 return Date.parseDate(b, c) 29482 } else { 29483 var a = Date.parseDate(b + " " + this.initTime, c + " " 29484 + this.initTimeFormat); 29485 if (a) { 29486 return a.clearTime() 29487 } 29488 } 29489 }, 29490 initComponent : function() { 29491 Ext.form.DateField.superclass.initComponent.call(this); 29492 this.addEvents("select"); 29493 if (Ext.isString(this.minValue)) { 29494 this.minValue = this.parseDate(this.minValue) 29495 } 29496 if (Ext.isString(this.maxValue)) { 29497 this.maxValue = this.parseDate(this.maxValue) 29498 } 29499 this.disabledDatesRE = null; 29500 this.initDisabledDays() 29501 }, 29502 initEvents : function() { 29503 Ext.form.DateField.superclass.initEvents.call(this); 29504 this.keyNav = new Ext.KeyNav(this.el, { 29505 down : function(a) { 29506 this.onTriggerClick() 29507 }, 29508 scope : this, 29509 forceKeyDown : true 29510 }) 29511 }, 29512 initDisabledDays : function() { 29513 if (this.disabledDates) { 29514 var b = this.disabledDates, a = b.length - 1, c = "(?:"; 29515 Ext.each(b, function(g, e) { 29516 c += Ext.isDate(g) 29517 ? "^" + Ext.escapeRe(g.dateFormat(this.format)) 29518 + "$" 29519 : b[e]; 29520 if (e != a) { 29521 c += "|" 29522 } 29523 }, this); 29524 this.disabledDatesRE = new RegExp(c + ")") 29525 } 29526 }, 29527 setDisabledDates : function(a) { 29528 this.disabledDates = a; 29529 this.initDisabledDays(); 29530 if (this.menu) { 29531 this.menu.picker.setDisabledDates(this.disabledDatesRE) 29532 } 29533 }, 29534 setDisabledDays : function(a) { 29535 this.disabledDays = a; 29536 if (this.menu) { 29537 this.menu.picker.setDisabledDays(a) 29538 } 29539 }, 29540 setMinValue : function(a) { 29541 this.minValue = (Ext.isString(a) ? this.parseDate(a) : a);
29542 if (this.menu) { 29543 this.menu.picker.setMinDate(this.minValue) 29544 } 29545 }, 29546 setMaxValue : function(a) { 29547 this.maxValue = (Ext.isString(a) ? this.parseDate(a) : a); 29548 if (this.menu) { 29549 this.menu.picker.setMaxDate(this.maxValue) 29550 } 29551 }, 29552 getErrors : function(e) { 29553 var h = Ext.form.DateField.superclass.getErrors.apply(this, arguments); 29554 e = this.formatDate(e || this.processValue(this.getRawValue())); 29555 if (e.length < 1) { 29556 return h 29557 } 29558 var c = e; 29559 e = this.parseDate(e); 29560 if (!e) { 29561 h.push(String.format(this.invalidText, c, this.format)); 29562 return h 29563 } 29564 var g = e.getTime(); 29565 if (this.minValue && g < this.minValue.clearTime().getTime()) { 29566 h.push(String.format(this.minText, this.formatDate(this.minValue))) 29567 } 29568 if (this.maxValue && g > this.maxValue.clearTime().getTime()) { 29569 h.push(String.format(this.maxText, this.formatDate(this.maxValue))) 29570 } 29571 if (this.disabledDays) { 29572 var a = e.getDay(); 29573 for (var b = 0; b < this.disabledDays.length; b++) { 29574 if (a === this.disabledDays[b]) { 29575 h.push(this.disabledDaysText); 29576 break 29577 } 29578 } 29579 } 29580 var d = this.formatDate(e); 29581 if (this.disabledDatesRE && this.disabledDatesRE.test(d)) { 29582 h.push(String.format(this.disabledDatesText, d)) 29583 } 29584 return h 29585 }, 29586 validateBlur : function() { 29587 return !this.menu || !this.menu.isVisible() 29588 }, 29589 getValue : function() { 29590 return this 29591 .parseDate(Ext.form.DateField.superclass.getValue.call(this)) 29592 || "" 29593 }, 29594 setValue : function(a) { 29595 return Ext.form.DateField.superclass.setValue.call(this, this 29596 .formatDate(this.parseDate(a))) 29597 }, 29598 parseDate : function(g) { 29599 if (!g || Ext.isDate(g)) { 29600 return g 29601 } 29602 var b = this.safeParse(g, this.format), c = this.altFormats, e = this.altFormatsArray; 29603 if (!b && c) { 29604 e = e || c.split("|"); 29605 for (var d = 0, a = e.length; d < a && !b; d++) { 29606 b = this.safeParse(g, e[d]) 29607 } 29608 } 29609 return b 29610 }, 29611 onDestroy : function() { 29612 Ext.destroy(this.menu, this.keyNav); 29613 Ext.form.DateField.superclass.onDestroy.call(this) 29614 }, 29615 formatDate : function(a) { 29616 return Ext.isDate(a) ? a.dateFormat(this.format) : a 29617 }, 29618 onTriggerClick : function() { 29619 if (this.disabled) { 29620 return 29621 } 29622 if (this.menu == null) { 29623 this.menu = new Ext.menu.DateMenu({ 29624 hideOnClick : false, 29625 focusOnSelect : false 29626 }) 29627 } 29628 this.onFocus(); 29629 Ext.apply(this.menu.picker, { 29630 minDate : this.minValue, 29631 maxDate : this.maxValue, 29632 disabledDatesRE : this.disabledDatesRE, 29633 disabledDatesText : this.disabledDatesText, 29634 disabledDays : this.disabledDays, 29635 disabledDaysText : this.disabledDaysText, 29636 format : this.format, 29637 showToday : this.showToday, 29638 startDay : this.startDay, 29639 minText : String.format(this.minText, this 29640 .formatDate(this.minValue)), 29641 maxText : String.format(this.maxText, this 29642 .formatDate(this.maxValue)) 29643 }); 29644 this.menu.picker.setValue(this.getValue() || new Date()); 29645 this.menu.show(this.el, "tl-bl?"); 29646 this.menuEvents("on") 29647 }, 29648 menuEvents : function(a) { 29649 this.menu[a]("select", this.onSelect, this); 29650 this.menu[a]("hide", this.onMenuHide, this); 29651 this.menu[a]("show", this.onFocus, this) 29652 }, 29653 onSelect : function(a, b) { 29654 this.setValue(b); 29655 this.fireEvent("select", this, b); 29656 this.menu.hide() 29657 }, 29658 onMenuHide : function() { 29659 this.focus(false, 60); 29660 this.menuEvents("un") 29661 }, 29662 beforeBlur : function() { 29663 var a = this.parseDate(this.getRawValue()); 29664 if (a) { 29665 this.setValue(a) 29666 } 29667 } 29668}); 29669Ext.reg("datefield", Ext.form.DateField); 29670Ext.form.DisplayField = Ext.extend(Ext.form.Field, { 29671 validationEvent : false, 29672 validateOnBlur : false, 29673 defaultAutoCreate : { 29674 tag : "div" 29675 }, 29676 fieldClass : "x-form-display-field", 29677 htmlEncode : false, 29678 initEvents : Ext.emptyFn, 29679 isValid : function() { 29680 return true 29681 }, 29682 validate : function() { 29683 return true 29684 }, 29685 getRawValue : function() { 29686 var a = this.rendered ? this.el.dom.innerHTML : Ext.value( 29687 this.value, ""); 29688 if (a === this.emptyText) { 29689 a = "" 29690 } 29691 if (this.htmlEncode) { 29692 a = Ext.util.Format.htmlDecode(a) 29693 } 29694 return a 29695 }, 29696 getValue : function() { 29697 return this.getRawValue() 29698 }, 29699 getName : function() { 29700 return this.name 29701 }, 29702 setRawValue : function(a) { 29703 if (this.htmlEncode) { 29704 a = Ext.util.Format.htmlEncode(a) 29705 } 29706 return this.rendered ? (this.el.dom.innerHTML = (Ext.isEmpty(a) 29707 ? "" 29708 : a)) : (this.value = a) 29709 }, 29710 setValue : function(a) { 29711 this.setRawValue(a); 29712 return this 29713 } 29714 }); 29715Ext.reg("displayfield", Ext.form.DisplayField); 29716Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, { 29717 defaultAutoCreate : { 29718 tag : "input", 29719 type : "text", 29720 size : "24", 29721 autocomplete : "off" 29722 }, 29723 listClass : "", 29724 selectedClass : "x-combo-selected", 29725 listEmptyText : "", 29726 triggerClass : "x-form-arrow-trigger", 29727 shadow : "sides", 29728 listAlign : "tl-bl?", 29729 maxHeight : 300, 29730 minHeight : 90, 29731 triggerAction : "query", 29732 minChars : 4, 29733 autoSelect : true, 29734 typeAhead : false, 29735 queryDelay : 500, 29736 pageSize : 0, 29737 selectOnFocus : false, 29738 queryParam : "query", 29739 loadingText : "Loading...", 29740 resizable : false, 29741 handleHeight : 8, 29742 allQuery : "", 29743 mode : "remote", 29744 minListWidth : 70, 29745 forceSelection : false, 29746 typeAheadDelay : 250, 29747 lazyInit : true, 29748 clearFilterOnReset : true, 29749 submitValue : undefined, 29750 initComponent : function() { 29751 Ext.form.ComboBox.superclass.initComponent.call(this); 29752 this.addEvents("expand", "collapse", "beforeselect", "select", 29753 "beforequery"); 29754 if (this.transform) { 29755 var c = Ext.getDom(this.transform); 29756 if (!this.hiddenName) { 29757 this.hiddenName = c.name 29758 } 29759 if (!this.store) { 29760 this.mode = "local"; 29761 var j = [], e = c.options; 29762 for (var b = 0, a = e.length; b < a; b++) { 29763 var h = e[b], g = (h.hasAttribute 29764 ? h.hasAttribute("value") 29765 : h.getAttributeNode("value").specified) 29766 ? h.value 29767 : h.text; 29768 if (h.selected && Ext.isEmpty(this.value, true)) { 29769 this.value = g 29770 } 29771 j.push([g, h.text]) 29772 } 29773 this.store = new Ext.data.ArrayStore({ 29774 idIndex : 0, 29775 fields : ["value", "text"], 29776 data : j, 29777 autoDestroy : true 29778 });
29779 this.valueField = "value"; 29780 this.displayField = "text" 29781 } 29782 c.name = Ext.id(); 29783 if (!this.lazyRender) { 29784 this.target = true; 29785 this.el = Ext.DomHelper.insertBefore(c, this.autoCreate 29786 || this.defaultAutoCreate); 29787 this.render(this.el.parentNode, c) 29788 } 29789 Ext.removeNode(c) 29790 } else { 29791 if (this.store) { 29792 this.store = Ext.StoreMgr.lookup(this.store); 29793 if (this.store.autoCreated) { 29794 this.displayField = this.valueField = "field1"; 29795 if (!this.store.expandData) { 29796 this.displayField = "field2" 29797 } 29798 this.mode = "local" 29799 } 29800 } 29801 } 29802 this.selectedIndex = -1; 29803 if (this.mode == "local") { 29804 if (!Ext.isDefined(this.initialConfig.queryDelay)) { 29805 this.queryDelay = 10 29806 } 29807 if (!Ext.isDefined(this.initialConfig.minChars)) { 29808 this.minChars = 0 29809 } 29810 } 29811 }, 29812 onRender : function(b, a) { 29813 if (this.hiddenName && !Ext.isDefined(this.submitValue)) { 29814 this.submitValue = false 29815 } 29816 Ext.form.ComboBox.superclass.onRender.call(this, b, a); 29817 if (this.hiddenName) { 29818 this.hiddenField = this.el.insertSibling({ 29819 tag : "input", 29820 type : "hidden", 29821 name : this.hiddenName, 29822 id : (this.hiddenId || Ext.id()) 29823 }, "before", true) 29824 } 29825 if (Ext.isGecko) { 29826 this.el.dom.setAttribute("autocomplete", "off") 29827 } 29828 if (!this.lazyInit) { 29829 this.initList() 29830 } else { 29831 this.on("focus", this.initList, this, { 29832 single : true 29833 }) 29834 } 29835 }, 29836 initValue : function() { 29837 Ext.form.ComboBox.superclass.initValue.call(this); 29838 if (this.hiddenField) { 29839 this.hiddenField.value = Ext.value(Ext.isDefined(this.hiddenValue) 29840 ? this.hiddenValue 29841 : this.value, "") 29842 } 29843 }, 29844 getParentZIndex : function() { 29845 var a; 29846 if (this.ownerCt) { 29847 this.findParentBy(function(b) { 29848 a = parseInt(b.getPositionEl().getStyle("z-index"), 10); 29849 return !!a 29850 }) 29851 } 29852 return a 29853 }, 29854 getZIndex : function(b) { 29855 b = b || Ext.getDom(this.getListParent() || Ext.getBody()); 29856 var a = parseInt(Ext.fly(b).getStyle("z-index"), 10); 29857 if (!a) { 29858 a = this.getParentZIndex() 29859 } 29860 return (a || 12000) + 5 29861 }, 29862 initList : function() { 29863 if (!this.list) { 29864 var a = "x-combo-list", c = Ext.getDom(this.getListParent() 29865 || Ext.getBody()); 29866 this.list = new Ext.Layer({ 29867 parentEl : c, 29868 shadow : this.shadow, 29869 cls : [a, this.listClass].join(" "), 29870 constrain : false, 29871 zindex : this.getZIndex(c) 29872 }); 29873 var b = this.listWidth 29874 || Math.max(this.wrap.getWidth(), this.minListWidth); 29875 this.list.setSize(b, 0); 29876 this.list.swallowEvent("mousewheel"); 29877 this.assetHeight = 0; 29878 if (this.syncFont !== false) { 29879 this.list.setStyle("font-size", this.el.getStyle("font-size")) 29880 } 29881 if (this.title) { 29882 this.header = this.list.createChild({ 29883 cls : a + "-hd", 29884 html : this.title 29885 }); 29886 this.assetHeight += this.header.getHeight() 29887 } 29888 this.innerList = this.list.createChild({ 29889 cls : a + "-inner" 29890 }); 29891 this.mon(this.innerList, "mouseover", this.onViewOver, this); 29892 this.mon(this.innerList, "mousemove", this.onViewMove, this); 29893 this.innerList.setWidth(b - this.list.getFrameWidth("lr")); 29894 if (this.pageSize) { 29895 this.footer = this.list.createChild({ 29896 cls : a + "-ft" 29897 }); 29898 this.pageTb = new Ext.PagingToolbar({ 29899 store : this.store, 29900 pageSize : this.pageSize, 29901 renderTo : this.footer 29902 }); 29903 this.assetHeight += this.footer.getHeight() 29904 } 29905 if (!this.tpl) { 29906 this.tpl = '<tpl for="."><div class="' + a + '-item">{' 29907 + this.displayField + "}</div></tpl>" 29908 } 29909 this.view = new Ext.DataView({ 29910 applyTo : this.innerList, 29911 tpl : this.tpl, 29912 singleSelect : true, 29913 selectedClass : this.selectedClass, 29914 itemSelector : this.itemSelector || "." + a + "-item", 29915 emptyText : this.listEmptyText, 29916 deferEmptyText : false 29917 }); 29918 this.mon(this.view, { 29919 containerclick : this.onViewClick, 29920 click : this.onViewClick, 29921 scope : this 29922 });
29923 this.bindStore(this.store, true); 29924 if (this.resizable) { 29925 this.resizer = new Ext.Resizable(this.list, { 29926 pinned : true, 29927 handles : "se" 29928 }); 29929 this.mon(this.resizer, "resize", function(g, d, e) { 29930 this.maxHeight = e - this.handleHeight 29931 - this.list.getFrameWidth("tb") 29932 - this.assetHeight; 29933 this.listWidth = d; 29934 this.innerList.setWidth(d 29935 - this.list.getFrameWidth("lr")); 29936 this.restrictHeight() 29937 }, this); 29938 this[this.pageSize ? "footer" : "innerList"].setStyle( 29939 "margin-bottom", this.handleHeight + "px") 29940 } 29941 } 29942 }, 29943 getListParent : function() { 29944 return document.body 29945 }, 29946 getStore : function() { 29947 return this.store 29948 }, 29949 bindStore : function(a, b) { 29950 if (this.store && !b) { 29951 if (this.store !== a && this.store.autoDestroy) { 29952 this.store.destroy() 29953 } else { 29954 this.store.un("beforeload", this.onBeforeLoad, this); 29955 this.store.un("load", this.onLoad, this); 29956 this.store.un("exception", this.collapse, this) 29957 } 29958 if (!a) { 29959 this.store = null; 29960 if (this.view) { 29961 this.view.bindStore(null) 29962 } 29963 if (this.pageTb) { 29964 this.pageTb.bindStore(null) 29965 } 29966 } 29967 } 29968 if (a) { 29969 if (!b) { 29970 this.lastQuery = null; 29971 if (this.pageTb) { 29972 this.pageTb.bindStore(a) 29973 } 29974 } 29975 this.store = Ext.StoreMgr.lookup(a); 29976 this.store.on({ 29977 scope : this, 29978 beforeload : this.onBeforeLoad, 29979 load : this.onLoad, 29980 exception : this.collapse 29981 }); 29982 if (this.view) { 29983 this.view.bindStore(a) 29984 } 29985 } 29986 }, 29987 reset : function() { 29988 if (this.clearFilterOnReset && this.mode == "local") { 29989 this.store.clearFilter() 29990 } 29991 Ext.form.ComboBox.superclass.reset.call(this) 29992 }, 29993 initEvents : function() { 29994 Ext.form.ComboBox.superclass.initEvents.call(this); 29995 this.keyNav = new Ext.KeyNav(this.el, { 29996 up : function(a) { 29997 this.inKeyMode = true; 29998 this.selectPrev() 29999 }, 30000 down : function(a) { 30001 if (!this.isExpanded()) { 30002 this.onTriggerClick() 30003 } else { 30004 this.inKeyMode = true; 30005 this.selectNext() 30006 } 30007 }, 30008 enter : function(a) { 30009 this.onViewClick() 30010 }, 30011 esc : function(a) { 30012 this.collapse() 30013 }, 30014 tab : function(a) { 30015 if (this.forceSelection === true) { 30016 this.collapse() 30017 } else { 30018 this.onViewClick(false) 30019 } 30020 return true 30021 }, 30022 scope : this, 30023 doRelay : function(c, b, a) { 30024 if (a == "down" || this.scope.isExpanded()) { 30025 var d = Ext.KeyNav.prototype.doRelay.apply(this, arguments); 30026 if (!Ext.isIE && Ext.EventManager.useKeydown) { 30027 this.scope.fireKey(c) 30028 } 30029 return d 30030 } 30031 return true 30032 }, 30033 forceKeyDown : true, 30034 defaultEventAction : "stopEvent" 30035 }); 30036 this.queryDelay = Math.max(this.queryDelay || 10, this.mode == "local" 30037 ? 10 30038 : 250); 30039 this.dqTask = new Ext.util.DelayedTask(this.initQuery, this); 30040 if (this.typeAhead) { 30041 this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this) 30042 } 30043 if (!this.enableKeyEvents) { 30044 this.mon(this.el, "keyup", this.onKeyUp, this) 30045 } 30046 }, 30047 onDestroy : function() { 30048 if (this.dqTask) { 30049 this.dqTask.cancel(); 30050 this.dqTask = null 30051 } 30052 this.bindStore(null); 30053 Ext.destroy(this.resizer, this.view, this.pageTb, this.list); 30054 Ext.destroyMembers(this, "hiddenField"); 30055 Ext.form.ComboBox.superclass.onDestroy.call(this) 30056 }, 30057 fireKey : function(a) { 30058 if (!this.isExpanded()) { 30059 Ext.form.ComboBox.superclass.fireKey.call(this, a) 30060 } 30061 }, 30062 onResize : function(a, b) { 30063 Ext.form.ComboBox.superclass.onResize.apply(this, arguments); 30064 if (!isNaN(a) && this.isVisible() && this.list) { 30065 this.doResize(a) 30066 } else { 30067 this.bufferSize = a 30068 } 30069 }, 30070 doResize : function(a) { 30071 if (!Ext.isDefined(this.listWidth)) { 30072 var b = Math.max(a, this.minListWidth); 30073 this.list.setWidth(b); 30074 this.innerList.setWidth(b - this.list.getFrameWidth("lr")) 30075 } 30076 }, 30077 onEnable : function() { 30078 Ext.form.ComboBox.superclass.onEnable.apply(this, arguments); 30079 if (this.hiddenField) { 30080 this.hiddenField.disabled = false 30081 } 30082 }, 30083 onDisable : function() { 30084 Ext.form.ComboBox.superclass.onDisable.apply(this, arguments); 30085 if (this.hiddenField) { 30086 this.hiddenField.disabled = true 30087 } 30088 }, 30089 onBeforeLoad : function() { 30090 if (!this.hasFocus) { 30091 return 30092 } 30093 this.innerList.update(this.loadingText 30094 ? '<div class="loading-indicator">' + this.loadingText 30095 + "</div>" 30096 : ""); 30097 this.restrictHeight(); 30098 this.selectedIndex = -1 30099 }, 30100 onLoad : function() { 30101 if (!this.hasFocus) { 30102 return 30103 } 30104 if (this.store.getCount() > 0 || this.listEmptyText) { 30105 this.expand(); 30106 this.restrictHeight(); 30107 if (this.lastQuery == this.allQuery) { 30108 if (this.editable) { 30109 this.el.dom.select() 30110 } 30111 if (this.autoSelect !== false 30112 && !this.selectByValue(this.value, true)) { 30113 this.select(0, true) 30114 } 30115 } else { 30116 if (this.autoSelect !== false) { 30117 this.selectNext() 30118 }
30119 if (this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE 30120 && this.lastKey != Ext.EventObject.DELETE) { 30121 this.taTask.delay(this.typeAheadDelay) 30122 } 30123 } 30124 } else { 30125 this.collapse() 30126 } 30127 }, 30128 onTypeAhead : function() { 30129 if (this.store.getCount() > 0) { 30130 var b = this.store.getAt(0); 30131 var c = b.data[this.displayField]; 30132 var a = c.length; 30133 var d = this.getRawValue().length; 30134 if (d != a) { 30135 this.setRawValue(c); 30136 this.selectText(d, c.length) 30137 } 30138 } 30139 }, 30140 assertValue : function() { 30141 var b = this.getRawValue(), a; 30142 if (this.valueField && Ext.isDefined(this.value)) { 30143 a = this.findRecord(this.valueField, this.value) 30144 } 30145 if (!a || a.get(this.displayField) != b) { 30146 a = this.findRecord(this.displayField, b) 30147 } 30148 if (!a && this.forceSelection) { 30149 if (b.length > 0 && b != this.emptyText) { 30150 this.el.dom.value = Ext.value(this.lastSelectionText, ""); 30151 this.applyEmptyText() 30152 } else { 30153 this.clearValue() 30154 } 30155 } else { 30156 if (a && this.valueField) { 30157 if (this.value == b) { 30158 return 30159 } 30160 b = a.get(this.valueField || this.displayField) 30161 } 30162 this.setValue(b) 30163 } 30164 }, 30165 onSelect : function(a, b) { 30166 if (this.fireEvent("beforeselect", this, a, b) !== false) { 30167 this.setValue(a.data[this.valueField || this.displayField]); 30168 this.collapse(); 30169 this.fireEvent("select", this, a, b) 30170 } 30171 }, 30172 getName : function() { 30173 var a = this.hiddenField; 30174 return a && a.name ? a.name : this.hiddenName 30175 || Ext.form.ComboBox.superclass.getName.call(this) 30176 }, 30177 getValue : function() { 30178 if (this.valueField) { 30179 return Ext.isDefined(this.value) ? this.value : "" 30180 } else { 30181 return Ext.form.ComboBox.superclass.getValue.call(this) 30182 } 30183 }, 30184 clearValue : function() { 30185 if (this.hiddenField) { 30186 this.hiddenField.value = "" 30187 } 30188 this.setRawValue(""); 30189 this.lastSelectionText = ""; 30190 this.applyEmptyText(); 30191 this.value = "" 30192 }, 30193 setValue : function(a) { 30194 var c = a; 30195 if (this.valueField) { 30196 var b = this.findRecord(this.valueField, a); 30197 if (b) { 30198 c = b.data[this.displayField] 30199 } else { 30200 if (Ext.isDefined(this.valueNotFoundText)) { 30201 c = this.valueNotFoundText 30202 } 30203 } 30204 } 30205 this.lastSelectionText = c; 30206 if (this.hiddenField) { 30207 this.hiddenField.value = Ext.value(a, "") 30208 } 30209 Ext.form.ComboBox.superclass.setValue.call(this, c); 30210 this.value = a; 30211 return this 30212 }, 30213 findRecord : function(c, b) { 30214 var a; 30215 if (this.store.getCount() > 0) { 30216 this.store.each(function(d) { 30217 if (d.data[c] == b) { 30218 a = d; 30219 return false 30220 } 30221 }) 30222 } 30223 return a 30224 }, 30225 onViewMove : function(b, a) { 30226 this.inKeyMode = false 30227 }, 30228 onViewOver : function(d, b) { 30229 if (this.inKeyMode) { 30230 return 30231 } 30232 var c = this.view.findItemFromChild(b); 30233 if (c) { 30234 var a = this.view.indexOf(c); 30235 this.select(a, false) 30236 } 30237 }, 30238 onViewClick : function(b) { 30239 var a = this.view.getSelectedIndexes()[0], c = this.store, d = c 30240 .getAt(a); 30241 if (d) { 30242 this.onSelect(d, a) 30243 } else { 30244 this.collapse() 30245 } 30246 if (b !== false) { 30247 this.el.focus() 30248 } 30249 }, 30250 restrictHeight : function() { 30251 this.innerList.dom.style.height = ""; 30252 var b = this.innerList.dom, e = this.list.getFrameWidth("tb") 30253 + (this.resizable ? this.handleHeight : 0) + this.assetHeight, c = Math 30254 .max(b.clientHeight, b.offsetHeight, b.scrollHeight), a = this 30255 .getPosition()[1] 30256 - Ext.getBody().getScroll().top, g = Ext.lib.Dom 30257 .getViewHeight() 30258 - a - this.getSize().height, d = Math.max(a, g, this.minHeight 30259 || 0) 30260 - this.list.shadowOffset - e - 5; 30261 c = Math.min(c, d, this.maxHeight); 30262 this.innerList.setHeight(c); 30263 this.list.beginUpdate(); 30264 this.list.setHeight(c + e); 30265 this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign)); 30266 this.list.endUpdate() 30267 }, 30268 isExpanded : function() { 30269 return this.list && this.list.isVisible() 30270 }, 30271 selectByValue : function(a, c) { 30272 if (!Ext.isEmpty(a, true)) { 30273 var b = this.findRecord(this.valueField || this.displayField, a); 30274 if (b) { 30275 this.select(this.store.indexOf(b), c); 30276 return true 30277 } 30278 } 30279 return false 30280 }, 30281 select : function(a, c) { 30282 this.selectedIndex = a; 30283 this.view.select(a); 30284 if (c !== false) { 30285 var b = this.view.getNode(a); 30286 if (b) { 30287 this.innerList.scrollChildIntoView(b, false) 30288 } 30289 } 30290 }, 30291 selectNext : function() { 30292 var a = this.store.getCount(); 30293 if (a > 0) { 30294 if (this.selectedIndex == -1) { 30295 this.select(0) 30296 } else { 30297 if (this.selectedIndex < a - 1) { 30298 this.select(this.selectedIndex + 1) 30299 } 30300 } 30301 } 30302 }, 30303 selectPrev : function() { 30304 var a = this.store.getCount(); 30305 if (a > 0) { 30306 if (this.selectedIndex == -1) { 30307 this.select(0) 30308 } else { 30309 if (this.selectedIndex !== 0) { 30310 this.select(this.selectedIndex - 1) 30311 } 30312 } 30313 } 30314 }, 30315 onKeyUp : function(b) { 30316 var a = b.getKey(); 30317 if (this.editable !== false && this.readOnly !== true 30318 && (a == b.BACKSPACE || !b.isSpecialKey())) { 30319 this.lastKey = a; 30320 this.dqTask.delay(this.queryDelay) 30321 } 30322 Ext.form.ComboBox.superclass.onKeyUp.call(this, b) 30323 }, 30324 validateBlur : function() { 30325 return !this.list || !this.list.isVisible() 30326 }, 30327 initQuery : function() { 30328 this.doQuery(this.getRawValue()) 30329 }, 30330 beforeBlur : function() { 30331 this.assertValue() 30332 }, 30333 postBlur : function() { 30334 Ext.form.ComboBox.superclass.postBlur.call(this); 30335 this.collapse(); 30336 this.inKeyMode = false 30337 }, 30338 doQuery : function(c, b) { 30339 c = Ext.isEmpty(c) ? "" : c; 30340 var a = { 30341 query : c, 30342 forceAll : b, 30343 combo : this, 30344 cancel : false 30345 }; 30346 if (this.fireEvent("beforequery", a) === false || a.cancel) { 30347 return false 30348 } 30349 c = a.query; 30350 b = a.forceAll; 30351 if (b === true || (c.length >= this.minChars)) { 30352 if (this.lastQuery !== c) { 30353 this.lastQuery = c; 30354 if (this.mode == "local") { 30355 this.selectedIndex = -1; 30356 if (b) { 30357 this.store.clearFilter() 30358 } else { 30359 this.store.filter(this.displayField, c) 30360 } 30361 this.onLoad() 30362 } else { 30363 this.store.baseParams[this.queryParam] = c; 30364 this.store.load({ 30365 params : this.getParams(c) 30366 });
30367 this.expand() 30368 } 30369 } else { 30370 this.selectedIndex = -1; 30371 this.onLoad() 30372 } 30373 } 30374 }, 30375 getParams : function(a) { 30376 var b = {}, c = this.store.paramNames; 30377 if (this.pageSize) { 30378 b[c.start] = 0; 30379 b[c.limit] = this.pageSize 30380 } 30381 return b 30382 }, 30383 collapse : function() { 30384 if (!this.isExpanded()) { 30385 return 30386 } 30387 this.list.hide(); 30388 Ext.getDoc().un("mousewheel", this.collapseIf, this); 30389 Ext.getDoc().un("mousedown", this.collapseIf, this); 30390 this.fireEvent("collapse", this) 30391 }, 30392 collapseIf : function(a) { 30393 if (!this.isDestroyed && !a.within(this.wrap) && !a.within(this.list)) { 30394 this.collapse() 30395 } 30396 }, 30397 expand : function() { 30398 if (this.isExpanded() || !this.hasFocus) { 30399 return 30400 } 30401 if (this.title || this.pageSize) { 30402 this.assetHeight = 0; 30403 if (this.title) { 30404 this.assetHeight += this.header.getHeight() 30405 } 30406 if (this.pageSize) { 30407 this.assetHeight += this.footer.getHeight() 30408 } 30409 } 30410 if (this.bufferSize) { 30411 this.doResize(this.bufferSize); 30412 delete this.bufferSize 30413 } 30414 this.list.alignTo.apply(this.list, [this.el].concat(this.listAlign)); 30415 this.list.setZIndex(this.getZIndex()); 30416 this.list.show(); 30417 if (Ext.isGecko2) { 30418 this.innerList.setOverflow("auto") 30419 } 30420 this.mon(Ext.getDoc(), { 30421 scope : this, 30422 mousewheel : this.collapseIf, 30423 mousedown : this.collapseIf 30424 }); 30425 this.fireEvent("expand", this) 30426 }, 30427 onTriggerClick : function() { 30428 if (this.readOnly || this.disabled) { 30429 return 30430 } 30431 if (this.isExpanded()) { 30432 this.collapse(); 30433 this.el.focus() 30434 } else { 30435 this.onFocus({}); 30436 if (this.triggerAction == "all") { 30437 this.doQuery(this.allQuery, true) 30438 } else { 30439 this.doQuery(this.getRawValue()) 30440 } 30441 this.el.focus() 30442 } 30443 } 30444}); 30445Ext.reg("combo", Ext.form.ComboBox); 30446Ext.form.CompositeField = Ext.extend(Ext.form.Field, { 30447 defaultMargins : "0 5 0 0", 30448 skipLastItemMargin : true, 30449 isComposite : true, 30450 combineErrors : true, 30451 labelConnector : ", ", 30452 initComponent : function() { 30453 var g = [], b = this.items, e; 30454 for (var d = 0, c = b.length; d < c; d++) { 30455 e = b[d]; 30456 if (!Ext.isEmpty(e.ref)) { 30457 e.ref = "../" + e.ref 30458 } 30459 g.push(e.fieldLabel); 30460 Ext.applyIf(e, this.defaults); 30461 if (!(d == c - 1 && this.skipLastItemMargin)) { 30462 Ext.applyIf(e, { 30463 margins : this.defaultMargins 30464 }) 30465 } 30466 } 30467 this.fieldLabel = this.fieldLabel || this.buildLabel(g); 30468 this.fieldErrors = new Ext.util.MixedCollection(true, function(h) { 30469 return h.field 30470 }); 30471 this.fieldErrors.on({ 30472 scope : this, 30473 add : this.updateInvalidMark, 30474 remove : this.updateInvalidMark, 30475 replace : this.updateInvalidMark 30476 }); 30477 Ext.form.CompositeField.superclass.initComponent.apply(this, arguments); 30478 this.innerCt = new Ext.Container({ 30479 layout : "hbox", 30480 items : this.items, 30481 cls : "x-form-composite", 30482 defaultMargins : "0 3 0 0", 30483 ownerCt : this 30484 }); 30485 this.innerCt.ownerCt = undefined; 30486 var a = this.innerCt.findBy(function(h) { 30487 return h.isFormField 30488 }, this); 30489 this.items = new Ext.util.MixedCollection(); 30490 this.items.addAll(a) 30491 }, 30492 onRender : function(c, a) { 30493 if (!this.el) { 30494 var d = this.innerCt; 30495 d.render(c);
30496 this.el = d.getEl(); 30497 if (this.combineErrors) { 30498 this.eachItem(function(e) { 30499 Ext.apply(e, { 30500 markInvalid : this.onFieldMarkInvalid 30501 .createDelegate(this, [e], 0), 30502 clearInvalid : this.onFieldClearInvalid 30503 .createDelegate(this, [e], 0) 30504 }) 30505 }) 30506 } 30507 var b = this.el.parent().parent().child("label", true); 30508 if (b) { 30509 b.setAttribute("for", this.items.items[0].id) 30510 } 30511 } 30512 Ext.form.CompositeField.superclass.onRender.apply(this, arguments) 30513 }, 30514 onFieldMarkInvalid : function(d, c) { 30515 var b = d.getName(), a = { 30516 field : b, 30517 errorName : d.fieldLabel || b, 30518 error : c 30519 }; 30520 this.fieldErrors.replace(b, a); 30521 if (!d.preventMark) { 30522 d.el.addClass(d.invalidClass) 30523 } 30524 }, 30525 onFieldClearInvalid : function(a) { 30526 this.fieldErrors.removeKey(a.getName()); 30527 a.el.removeClass(a.invalidClass) 30528 }, 30529 updateInvalidMark : function() { 30530 var a = Ext.isIE6 && Ext.isStrict; 30531 if (this.fieldErrors.length == 0) { 30532 this.clearInvalid(); 30533 if (a) { 30534 this.clearInvalid.defer(50, this) 30535 } 30536 } else { 30537 var b = this.buildCombinedErrorMessage(this.fieldErrors.items); 30538 this.sortErrors(); 30539 this.markInvalid(b); 30540 if (a) { 30541 this.markInvalid(b) 30542 } 30543 } 30544 }, 30545 validateValue : function(c, a) { 30546 var b = true; 30547 this.eachItem(function(d) { 30548 if (!d.isValid(a)) { 30549 b = false 30550 } 30551 }); 30552 return b 30553 }, 30554 buildCombinedErrorMessage : function(e) { 30555 var d = [], b; 30556 for (var c = 0, a = e.length; c < a; c++) { 30557 b = e[c]; 30558 d.push(String.format("{0}: {1}", b.errorName, b.error)) 30559 } 30560 return d.join("<br />") 30561 }, 30562 sortErrors : function() { 30563 var a = this.items; 30564 this.fieldErrors.sort("ASC", function(g, d) { 30565 var c = function(b) { 30566 return function(i) { 30567 return i.getName() == b 30568 } 30569 }; 30570 var h = a.findIndexBy(c(g.field)), e = a 30571 .findIndexBy(c(d.field)); 30572 return h < e ? -1 : 1 30573 }) 30574 }, 30575 reset : function() { 30576 this.eachItem(function(a) { 30577 a.reset() 30578 }); 30579(function() { 30580 this.clearInvalid() 30581 }).defer(50, this) 30582 }, 30583 clearInvalidChildren : function() { 30584 this.eachItem(function(a) { 30585 a.clearInvalid() 30586 }) 30587 }, 30588 buildLabel : function(a) { 30589 return Ext.clean(a).join(this.labelConnector) 30590 }, 30591 isDirty : function() { 30592 if (this.disabled || !this.rendered) { 30593 return false 30594 } 30595 var a = false; 30596 this.eachItem(function(b) { 30597 if (b.isDirty()) { 30598 a = true; 30599 return false 30600 } 30601 }); 30602 return a 30603 }, 30604 eachItem : function(b, a) { 30605 if (this.items && this.items.each) { 30606 this.items.each(b, a || this) 30607 } 30608 }, 30609 onResize : function(e, c, a, d) { 30610 var b = this.innerCt; 30611 if (this.rendered && b.rendered) { 30612 b.setSize(e, c) 30613 } 30614 Ext.form.CompositeField.superclass.onResize.apply(this, arguments) 30615 }, 30616 doLayout : function(c, b) { 30617 if (this.rendered) { 30618 var a = this.innerCt; 30619 a.forceLayout = this.ownerCt.forceLayout; 30620 a.doLayout(c, b) 30621 } 30622 }, 30623 beforeDestroy : function() { 30624 Ext.destroy(this.innerCt); 30625 Ext.form.CompositeField.superclass.beforeDestroy.call(this) 30626 }, 30627 setReadOnly : function(a) { 30628 if (a == undefined) { 30629 a = true 30630 } 30631 a = !!a; 30632 if (this.rendered) { 30633 this.eachItem(function(b) { 30634 b.setReadOnly(a) 30635 }) 30636 } 30637 this.readOnly = a 30638 }, 30639 onShow : function() { 30640 Ext.form.CompositeField.superclass.onShow.call(this); 30641 this.doLayout() 30642 }, 30643 onDisable : function() { 30644 this.eachItem(function(a) { 30645 a.disable() 30646 }) 30647 }, 30648 onEnable : function() { 30649 this.eachItem(function(a) { 30650 a.enable() 30651 }) 30652 } 30653}); 30654Ext.reg("compositefield", Ext.form.CompositeField); 30655 30656Ext.form.BasicForm = Ext.extend(Ext.util.Observable, { 30657 constructor : function(b, a) { 30658 Ext.apply(this, a); 30659 if (Ext.isString(this.paramOrder)) { 30660 this.paramOrder = this.paramOrder.split(/[\s,|]/) 30661 } 30662 this.items = new Ext.util.MixedCollection(false, function(c) { 30663 return c.getItemId() 30664 }); 30665 this 30666 .addEvents("beforeaction", "actionfailed", 30667 "actioncomplete"); 30668 if (b) { 30669 this.initEl(b) 30670 } 30671 Ext.form.BasicForm.superclass.constructor.call(this) 30672 }, 30673 timeout : 30, 30674 paramOrder : undefined, 30675 paramsAsHash : false, 30676 waitTitle : "Please Wait...", 30677 activeAction : null, 30678 trackResetOnLoad : false, 30679 initEl : function(a) { 30680 this.el = Ext.get(a); 30681 this.id = this.el.id || Ext.id(); 30682 if (!this.standardSubmit) { 30683 this.el.on("submit", this.onSubmit, this) 30684 } 30685 this.el.addClass("x-form") 30686 }, 30687 getEl : function() { 30688 return this.el 30689 }, 30690 onSubmit : function(a) { 30691 a.stopEvent() 30692 }, 30693 destroy : function(a) { 30694 if (a !== true) { 30695 this.items.each(function(b) { 30696 Ext.destroy(b) 30697 });
30698 Ext.destroy(this.el) 30699 } 30700 this.items.clear(); 30701 this.purgeListeners() 30702 }, 30703 isValid : function() { 30704 var a = true; 30705 this.items.each(function(b) { 30706 if (!b.validate()) { 30707 a = false 30708 } 30709 }); 30710 return a 30711 }, 30712 isDirty : function() { 30713 var a = false; 30714 this.items.each(function(b) { 30715 if (b.isDirty()) { 30716 a = true; 30717 return false 30718 } 30719 }); 30720 return a 30721 }, 30722 doAction : function(b, a) { 30723 if (Ext.isString(b)) { 30724 b = new Ext.form.Action.ACTION_TYPES[b](this, a) 30725 } 30726 if (this.fireEvent("beforeaction", this, b) !== false) { 30727 this.beforeAction(b); 30728 b.run.defer(100, b) 30729 } 30730 return this 30731 }, 30732 submit : function(b) { 30733 b = b || {}; 30734 if (this.standardSubmit) { 30735 var a = b.clientValidation === false || this.isValid(); 30736 if (a) { 30737 var c = this.el.dom; 30738 if (this.url && Ext.isEmpty(c.action)) { 30739 c.action = this.url 30740 } 30741 c.submit() 30742 } 30743 return a 30744 } 30745 var d = String.format("{0}submit", this.api ? "direct" : ""); 30746 this.doAction(d, b); 30747 return this 30748 }, 30749 load : function(a) { 30750 var b = String.format("{0}load", this.api ? "direct" : ""); 30751 this.doAction(b, a); 30752 return this 30753 }, 30754 updateRecord : function(b) { 30755 b.beginEdit(); 30756 var a = b.fields, d, c; 30757 a.each(function(e) { 30758 d = this.findField(e.name); 30759 if (d) { 30760 c = d.getValue(); 30761 if (Ext.type(c) !== false && c.getGroupValue) { 30762 c = c.getGroupValue() 30763 } else { 30764 if (d.eachItem) { 30765 c = []; 30766 d.eachItem(function(g) { 30767 c.push(g.getValue()) 30768 }) 30769 } 30770 } 30771 b.set(e.name, c) 30772 } 30773 }, this); 30774 b.endEdit(); 30775 return this 30776 }, 30777 loadRecord : function(a) { 30778 this.setValues(a.data); 30779 return this 30780 }, 30781 beforeAction : function(a) { 30782 this.items.each(function(c) { 30783 if (c.isFormField && c.syncValue) { 30784 c.syncValue() 30785 } 30786 }); 30787 var b = a.options; 30788 if (b.waitMsg) { 30789 if (this.waitMsgTarget === true) { 30790 this.el.mask(b.waitMsg, "x-mask-loading") 30791 } else { 30792 if (this.waitMsgTarget) { 30793 this.waitMsgTarget = Ext.get(this.waitMsgTarget); 30794 this.waitMsgTarget 30795 .mask(b.waitMsg, "x-mask-loading") 30796 } else { 30797 Ext.MessageBox.wait(b.waitMsg, b.waitTitle 30798 || this.waitTitle) 30799 } 30800 } 30801 } 30802 }, 30803 afterAction : function(a, c) { 30804 this.activeAction = null; 30805 var b = a.options; 30806 if (b.waitMsg) { 30807 if (this.waitMsgTarget === true) { 30808 this.el.unmask() 30809 } else { 30810 if (this.waitMsgTarget) { 30811 this.waitMsgTarget.unmask() 30812 } else { 30813 Ext.MessageBox.updateProgress(1); 30814 Ext.MessageBox.hide() 30815 } 30816 } 30817 } 30818 if (c) { 30819 if (b.reset) { 30820 this.reset() 30821 } 30822 Ext.callback(b.success, b.scope, [this, a]); 30823 this.fireEvent("actioncomplete", this, a) 30824 } else { 30825 Ext.callback(b.failure, b.scope, [this, a]); 30826 this.fireEvent("actionfailed", this, a) 30827 } 30828 }, 30829 findField : function(c) { 30830 var b = this.items.get(c); 30831 if (!Ext.isObject(b)) { 30832 var a = function(d) { 30833 if (d.isFormField) { 30834 if (d.dataIndex == c || d.id == c 30835 || d.getName() == c) { 30836 b = d; 30837 return false 30838 } else { 30839 if (d.isComposite) { 30840 return d.items.each(a) 30841 } else { 30842 if (d instanceof Ext.form.CheckboxGroup 30843 && d.rendered) { 30844 return d.eachItem(a) 30845 } 30846 } 30847 } 30848 } 30849 }; 30850 this.items.each(a) 30851 } 30852 return b || null 30853 }, 30854 markInvalid : function(h) { 30855 if (Ext.isArray(h)) { 30856 for (var c = 0, a = h.length; c < a; c++) { 30857 var b = h[c]; 30858 var d = this.findField(b.id); 30859 if (d) { 30860 d.markInvalid(b.msg) 30861 } 30862 } 30863 } else { 30864 var e, g; 30865 for (g in h) { 30866 if (!Ext.isFunction(h[g]) && (e = this.findField(g))) { 30867 e.markInvalid(h[g]) 30868 } 30869 } 30870 } 30871 return this 30872 }, 30873 setValues : function(c) { 30874 if (Ext.isArray(c)) { 30875 for (var d = 0, a = c.length; d < a; d++) { 30876 var b = c[d]; 30877 var e = this.findField(b.id); 30878 if (e) { 30879 e.setValue(b.value); 30880 if (this.trackResetOnLoad) { 30881 e.originalValue = e.getValue() 30882 } 30883 } 30884 } 30885 } else { 30886 var g, h; 30887 for (h in c) { 30888 if (!Ext.isFunction(c[h]) && (g = this.findField(h))) { 30889 g.setValue(c[h]); 30890 if (this.trackResetOnLoad) { 30891 g.originalValue = g.getValue() 30892 } 30893 } 30894 } 30895 } 30896 return this 30897 }, 30898 getValues : function(b) { 30899 var a = Ext.lib.Ajax.serializeForm(this.el.dom); 30900 if (b === true) { 30901 return a 30902 } 30903 return Ext.urlDecode(a) 30904 }, 30905 getFieldValues : function(a) { 30906 var d = {}, e, b, c; 30907 this.items.each(function(g) { 30908 if (!g.disabled && (a !== true || g.isDirty())) { 30909 e = g.getName(); 30910 b = d[e]; 30911 c = g.getValue(); 30912 if (Ext.isDefined(b)) { 30913 if (Ext.isArray(b)) { 30914 d[e].push(c) 30915 } else { 30916 d[e] = [b, c] 30917 } 30918 } else { 30919 d[e] = c 30920 } 30921 } 30922 });
30923 return d 30924 }, 30925 clearInvalid : function() { 30926 this.items.each(function(a) { 30927 a.clearInvalid() 30928 }); 30929 return this 30930 }, 30931 reset : function() { 30932 this.items.each(function(a) { 30933 a.reset() 30934 }); 30935 return this 30936 }, 30937 add : function() { 30938 this.items.addAll(Array.prototype.slice.call(arguments, 0)); 30939 return this 30940 }, 30941 remove : function(a) { 30942 this.items.remove(a); 30943 return this 30944 }, 30945 cleanDestroyed : function() { 30946 this.items.filterBy(function(a) { 30947 return !!a.isDestroyed 30948 }).each(this.remove, this) 30949 }, 30950 render : function() { 30951 this.items.each(function(a) { 30952 if (a.isFormField && !a.rendered 30953 && document.getElementById(a.id)) { 30954 a.applyToMarkup(a.id) 30955 } 30956 }); 30957 return this 30958 }, 30959 applyToFields : function(a) { 30960 this.items.each(function(b) { 30961 Ext.apply(b, a) 30962 }); 30963 return this 30964 }, 30965 applyIfToFields : function(a) { 30966 this.items.each(function(b) { 30967 Ext.applyIf(b, a) 30968 }); 30969 return this 30970 }, 30971 callFieldMethod : function(b, a) { 30972 a = a || []; 30973 this.items.each(function(c) { 30974 if (Ext.isFunction(c[b])) { 30975 c[b].apply(c, a) 30976 } 30977 }); 30978 return this 30979 } 30980 }); 30981Ext.BasicForm = Ext.form.BasicForm; 30982Ext.FormPanel = Ext.extend(Ext.Panel, { 30983 minButtonWidth : 75, 30984 labelAlign : "left", 30985 monitorValid : false, 30986 monitorPoll : 200, 30987 layout : "form", 30988 initComponent : function() { 30989 this.form = this.createForm(); 30990 Ext.FormPanel.superclass.initComponent.call(this); 30991 this.bodyCfg = { 30992 tag : "form", 30993 cls : this.baseCls + "-body", 30994 method : this.method || "POST", 30995 id : this.formId || Ext.id() 30996 }; 30997 if (this.fileUpload) { 30998 this.bodyCfg.enctype = "multipart/form-data" 30999 } 31000 this.initItems(); 31001 this.addEvents("clientvalidation"); 31002 this.relayEvents(this.form, ["beforeaction", "actionfailed", 31003 "actioncomplete"]) 31004 }, 31005 createForm : function() { 31006 var a = Ext.applyIf({ 31007 listeners : {} 31008 }, this.initialConfig); 31009 return new Ext.form.BasicForm(null, a) 31010 }, 31011 initFields : function() { 31012 var c = this.form; 31013 var a = this; 31014 var b = function(d) { 31015 if (a.isField(d)) { 31016 c.add(d) 31017 } else { 31018 if (d.findBy && d != a) { 31019 a.applySettings(d); 31020 if (d.items && d.items.each) { 31021 d.items.each(b, this) 31022 } 31023 } 31024 } 31025 }; 31026 this.items.each(b, this) 31027 }, 31028 applySettings : function(b) { 31029 var a = b.ownerCt; 31030 Ext.applyIf(b, { 31031 labelAlign : a.labelAlign, 31032 labelWidth : a.labelWidth, 31033 itemCls : a.itemCls 31034 }) 31035 }, 31036 getLayoutTarget : function() { 31037 return this.form.el 31038 }, 31039 getForm : function() { 31040 return this.form 31041 }, 31042 onRender : function(b, a) { 31043 this.initFields(); 31044 Ext.FormPanel.superclass.onRender.call(this, b, a); 31045 this.form.initEl(this.body) 31046 }, 31047 beforeDestroy : function() { 31048 this.stopMonitoring(); 31049 this.form.destroy(true); 31050 Ext.FormPanel.superclass.beforeDestroy.call(this) 31051 }, 31052 isField : function(a) { 31053 return !!a.setValue && !!a.getValue && !!a.markInvalid 31054 && !!a.clearInvalid 31055 }, 31056 initEvents : function() { 31057 Ext.FormPanel.superclass.initEvents.call(this); 31058 this.on({ 31059 scope : this, 31060 add : this.onAddEvent, 31061 remove : this.onRemoveEvent 31062 }); 31063 if (this.monitorValid) { 31064 this.startMonitoring() 31065 } 31066 }, 31067 onAdd : function(a) { 31068 Ext.FormPanel.superclass.onAdd.call(this, a); 31069 this.processAdd(a) 31070 }, 31071 onAddEvent : function(a, b) { 31072 if (a !== this) { 31073 this.processAdd(b) 31074 } 31075 }, 31076 processAdd : function(a) { 31077 if (this.isField(a)) { 31078 this.form.add(a) 31079 } else { 31080 if (a.findBy) { 31081 this.applySettings(a); 31082 this.form.add.apply(this.form, a.findBy(this.isField)) 31083 } 31084 } 31085 }, 31086 onRemove : function(a) { 31087 Ext.FormPanel.superclass.onRemove.call(this, a); 31088 this.processRemove(a) 31089 }, 31090 onRemoveEvent : function(a, b) { 31091 if (a !== this) { 31092 this.processRemove(b) 31093 } 31094 }, 31095 processRemove : function(a) { 31096 if (!this.destroying) { 31097 if (this.isField(a)) { 31098 this.form.remove(a) 31099 } else { 31100 if (a.findBy) { 31101 Ext.each(a.findBy(this.isField), this.form.remove, 31102 this.form); 31103 this.form.cleanDestroyed() 31104 } 31105 } 31106 } 31107 }, 31108 startMonitoring : function() { 31109 if (!this.validTask) { 31110 this.validTask = new Ext.util.TaskRunner(); 31111 this.validTask.start({ 31112 run : this.bindHandler, 31113 interval : this.monitorPoll || 200, 31114 scope : this 31115 }) 31116 } 31117 }, 31118 stopMonitoring : function() { 31119 if (this.validTask) { 31120 this.validTask.stopAll(); 31121 this.validTask = null 31122 } 31123 }, 31124 load : function() { 31125 this.form.load.apply(this.form, arguments) 31126 }, 31127 onDisable : function() { 31128 Ext.FormPanel.superclass.onDisable.call(this); 31129 if (this.form) { 31130 this.form.items.each(function() { 31131 this.disable() 31132 }) 31133 } 31134 }, 31135 onEnable : function() { 31136 Ext.FormPanel.superclass.onEnable.call(this); 31137 if (this.form) { 31138 this.form.items.each(function() { 31139 this.enable() 31140 }) 31141 } 31142 }, 31143 bindHandler : function() { 31144 var e = true; 31145 this.form.items.each(function(g) { 31146 if (!g.isValid(true)) { 31147 e = false; 31148 return false 31149 } 31150 });
31151 if (this.fbar) { 31152 var b = this.fbar.items.items; 31153 for (var d = 0, a = b.length; d < a; d++) { 31154 var c = b[d]; 31155 if (c.formBind === true && c.disabled === e) { 31156 c.setDisabled(!e) 31157 } 31158 } 31159 } 31160 this.fireEvent("clientvalidation", this, e) 31161 } 31162 }); 31163Ext.reg("form", Ext.FormPanel); 31164Ext.form.FormPanel = Ext.FormPanel; 31165Ext.form.Action = function(b, a) { 31166 this.form = b; 31167 this.options = a || {} 31168}; 31169Ext.form.Action.CLIENT_INVALID = "client"; 31170Ext.form.Action.SERVER_INVALID = "server"; 31171Ext.form.Action.CONNECT_FAILURE = "connect"; 31172Ext.form.Action.LOAD_FAILURE = "load"; 31173Ext.form.Action.prototype = { 31174 type : "default", 31175 run : function(a) { 31176 }, 31177 success : function(a) { 31178 }, 31179 handleResponse : function(a) { 31180 }, 31181 failure : function(a) { 31182 this.response = a; 31183 this.failureType = Ext.form.Action.CONNECT_FAILURE; 31184 this.form.afterAction(this, false) 31185 }, 31186 processResponse : function(a) { 31187 this.response = a; 31188 if (!a.responseText && !a.responseXML) { 31189 return true 31190 } 31191 this.result = this.handleResponse(a); 31192 return this.result 31193 }, 31194 decodeResponse : function(a) { 31195 try { 31196 return Ext.decode(a.responseText) 31197 } catch (b) { 31198 return false 31199 } 31200 }, 31201 getUrl : function(c) { 31202 var a = this.options.url || this.form.url || this.form.el.dom.action; 31203 if (c) { 31204 var b = this.getParams(); 31205 if (b) { 31206 a = Ext.urlAppend(a, b) 31207 } 31208 } 31209 return a 31210 }, 31211 getMethod : function() { 31212 return (this.options.method || this.form.method 31213 || this.form.el.dom.method || "POST").toUpperCase() 31214 }, 31215 getParams : function() { 31216 var a = this.form.baseParams; 31217 var b = this.options.params; 31218 if (b) { 31219 if (typeof b == "object") { 31220 b = Ext.urlEncode(Ext.applyIf(b, a)) 31221 } else { 31222 if (typeof b == "string" && a) { 31223 b += "&" + Ext.urlEncode(a) 31224 } 31225 } 31226 } else { 31227 if (a) { 31228 b = Ext.urlEncode(a) 31229 } 31230 } 31231 return b 31232 }, 31233 createCallback : function(a) { 31234 var a = a || {}; 31235 return { 31236 success : this.success, 31237 failure : this.failure, 31238 scope : this, 31239 timeout : (a.timeout * 1000) || (this.form.timeout * 1000), 31240 upload : this.form.fileUpload ? this.success : undefined 31241 } 31242 } 31243}; 31244Ext.form.Action.Submit = function(b, a) { 31245 Ext.form.Action.Submit.superclass.constructor.call(this, b, a) 31246}; 31247Ext.extend(Ext.form.Action.Submit, Ext.form.Action, { 31248 type : "submit", 31249 run : function() { 31250 var e = this.options, g = this.getMethod(), d = g == "GET"; 31251 if (e.clientValidation === false || this.form.isValid()) { 31252 if (e.submitEmptyText === false) { 31253 var a = this.form.items, c = [], b = function(h) { 31254 if (h.el.getValue() == h.emptyText) { 31255 c.push(h); 31256 h.el.dom.value = "" 31257 } 31258 if (h.isComposite && h.rendered) { 31259 h.items.each(b) 31260 } 31261 }; 31262 a.each(b) 31263 } 31264 Ext.Ajax.request(Ext.apply(this.createCallback(e), { 31265 form : this.form.el.dom, 31266 url : this.getUrl(d), 31267 method : g, 31268 headers : e.headers, 31269 params : !d ? this.getParams() : null, 31270 isUpload : this.form.fileUpload 31271 })); 31272 if (e.submitEmptyText === false) { 31273 Ext.each(c, function(h) { 31274 if (h.applyEmptyText) { 31275 h.applyEmptyText() 31276 } 31277 }) 31278 } 31279 } else { 31280 if (e.clientValidation !== false) { 31281 this.failureType = Ext.form.Action.CLIENT_INVALID; 31282 this.form.afterAction(this, false) 31283 } 31284 } 31285 }, 31286 success : function(b) { 31287 var a = this.processResponse(b); 31288 if (a === true || a.success) { 31289 this.form.afterAction(this, true); 31290 return 31291 } 31292 if (a.errors) { 31293 this.form.markInvalid(a.errors) 31294 } 31295 this.failureType = Ext.form.Action.SERVER_INVALID; 31296 this.form.afterAction(this, false) 31297 }, 31298 handleResponse : function(c) { 31299 if (this.form.errorReader) { 31300 var b = this.form.errorReader.read(c); 31301 var g = []; 31302 if (b.records) { 31303 for (var d = 0, a = b.records.length; d < a; d++) { 31304 var e = b.records[d]; 31305 g[d] = e.data 31306 } 31307 } 31308 if (g.length < 1) { 31309 g = null 31310 } 31311 return { 31312 success : b.success, 31313 errors : g 31314 } 31315 } 31316 return this.decodeResponse(c) 31317 } 31318 }); 31319Ext.form.Action.Load = function(b, a) { 31320 Ext.form.Action.Load.superclass.constructor.call(this, b, a); 31321 this.reader = this.form.reader 31322}; 31323Ext.extend(Ext.form.Action.Load, Ext.form.Action, { 31324 type : "load", 31325 run : function() { 31326 Ext.Ajax.request(Ext.apply(this.createCallback(this.options), { 31327 method : this.getMethod(), 31328 url : this.getUrl(false), 31329 headers : this.options.headers, 31330 params : this.getParams() 31331 })) 31332 }, 31333 success : function(b) { 31334 var a = this.processResponse(b); 31335 if (a === true || !a.success || !a.data) { 31336 this.failureType = Ext.form.Action.LOAD_FAILURE; 31337 this.form.afterAction(this, false); 31338 return 31339 } 31340 this.form.clearInvalid(); 31341 this.form.setValues(a.data); 31342 this.form.afterAction(this, true) 31343 }, 31344 handleResponse : function(b) { 31345 if (this.form.reader) { 31346 var a = this.form.reader.read(b); 31347 var c = a.records && a.records[0] 31348 ? a.records[0].data 31349 : null; 31350 return { 31351 success : a.success, 31352 data : c 31353 } 31354 } 31355 return this.decodeResponse(b) 31356 } 31357 }); 31358Ext.form.Action.DirectLoad = Ext.extend(Ext.form.Action.Load, { 31359 constructor : function(b, a) { 31360 Ext.form.Action.DirectLoad.superclass.constructor.call(this, b, 31361 a) 31362 }, 31363 type : "directload", 31364 run : function() { 31365 var a = this.getParams(); 31366 a.push(this.success, this); 31367 this.form.api.load.apply(window, a) 31368 }, 31369 getParams : function() { 31370 var c = [], h = {}; 31371 var e = this.form.baseParams; 31372 var g = this.options.params; 31373 Ext.apply(h, g, e); 31374 var b = this.form.paramOrder; 31375 if (b) { 31376 for (var d = 0, a = b.length; d < a; d++) { 31377 c.push(h[b[d]]) 31378 } 31379 } else { 31380 if (this.form.paramsAsHash) { 31381 c.push(h) 31382 } 31383 } 31384 return c 31385 }, 31386 processResponse : function(a) { 31387 this.result = a; 31388 return a 31389 }, 31390 success : function(a, b) { 31391 if (b.type == Ext.Direct.exceptions.SERVER) { 31392 a = {} 31393 } 31394 Ext.form.Action.DirectLoad.superclass.success.call(this, a) 31395 } 31396 }); 31397Ext.form.Action.DirectSubmit = Ext.extend(Ext.form.Action.Submit, { 31398 constructor : function(b, a) { 31399 Ext.form.Action.DirectSubmit.superclass.constructor.call(this, 31400 b, a) 31401 }, 31402 type : "directsubmit", 31403 run : function() { 31404 var a = this.options; 31405 if (a.clientValidation === false || this.form.isValid()) { 31406 this.success.params = this.getParams(); 31407 this.form.api.submit(this.form.el.dom, this.success, this) 31408 } else { 31409 if (a.clientValidation !== false) { 31410 this.failureType = Ext.form.Action.CLIENT_INVALID; 31411 this.form.afterAction(this, false) 31412 } 31413 } 31414 }, 31415 getParams : function() { 31416 var c = {}; 31417 var a = this.form.baseParams; 31418 var b = this.options.params; 31419 Ext.apply(c, b, a); 31420 return c 31421 }, 31422 processResponse : function(a) { 31423 this.result = a; 31424 return a 31425 }, 31426 success : function(a, b) { 31427 if (b.type == Ext.Direct.exceptions.SERVER) { 31428 a = {} 31429 } 31430 Ext.form.Action.DirectSubmit.superclass.success.call(this, a) 31431 } 31432 }); 31433Ext.form.Action.ACTION_TYPES = { 31434 load : Ext.form.Action.Load, 31435 submit : Ext.form.Action.Submit, 31436 directload : Ext.form.Action.DirectLoad, 31437 directsubmit : Ext.form.Action.DirectSubmit 31438}; 31439Ext.form.VTypes = function() { 31440 var c = /^[a-zA-Z_]+$/, d = /^[a-zA-Z0-9_]+$/, 31441 b = /^([a-zA-Z0-9_\.\-])+([a-zA-Z0-9_\-])\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ 31442 a = /(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; 31443 return { 31444 email : function(e) { 31445 return b.test(e) 31446 }, 31447 emailText : 'This field should be an e-mail address in the format "[email protected]"', 31448 emailMask : /[a-z0-9_\.\-\+\'@]/i, 31449 url : function(e) { 31450 return a.test(e) 31451 }, 31452 urlText : 'This field should be a URL in the format "http://www.example.com"', 31453 alpha : function(e) { 31454 return c.test(e) 31455 }, 31456 alphaText : "This field should only contain letters and _", 31457 alphaMask : /[a-z_]/i, 31458 alphanum : function(e) { 31459 return d.test(e) 31460 }, 31461 alphanumText : "This field should only contain letters, numbers and _", 31462 alphanumMask : /[a-z0-9_]/i 31463 } 31464}(); 31465Ext.grid.GridPanel = Ext.extend(Ext.Panel, { 31466 autoExpandColumn : false, 31467 autoExpandMax : 2000, 31468 autoExpandMin : 50, 31469 columnLines : false, 31470 ddText : "{0} selected row", 31471 deferRowRender : true, 31472 enableColumnHide : true, 31473 enableColumnMove : true, 31474 enableDragDrop : false, 31475 enableHdMenu : true, 31476 loadMask : false, 31477 minColumnWidth : 25, 31478 stripeRows : false, 31479 trackMouseOver : true, 31480 stateEvents : ["columnmove", "columnresize", "sortchange", "groupchange"], 31481 view : null, 31482 bubbleEvents : [], 31483 rendered : false, 31484 viewReady : false, 31485 initComponent : function() { 31486 Ext.grid.GridPanel.superclass.initComponent.call(this); 31487 if (this.columnLines) { 31488 this.cls = (this.cls || "") + " x-grid-with-col-lines" 31489 } 31490 this.autoScroll = false; 31491 this.autoWidth = false; 31492 if (Ext.isArray(this.columns)) { 31493 this.colModel = new Ext.grid.ColumnModel(this.columns); 31494 delete this.columns 31495 } 31496 if (this.ds) { 31497 this.store = this.ds; 31498 delete this.ds 31499 } 31500 if (this.cm) { 31501 this.colModel = this.cm; 31502 delete this.cm
31503 } 31504 if (this.sm) { 31505 this.selModel = this.sm; 31506 delete this.sm 31507 } 31508 this.store = Ext.StoreMgr.lookup(this.store); 31509 this.addEvents("click", "dblclick", "contextmenu", "mousedown", 31510 "mouseup", "mouseover", "mouseout", "keypress", "keydown", 31511 "cellmousedown", "rowmousedown", "headermousedown", 31512 "groupmousedown", "rowbodymousedown", "containermousedown", 31513 "cellclick", "celldblclick", "rowclick", "rowdblclick", 31514 "headerclick", "headerdblclick", "groupclick", "groupdblclick", 31515 "containerclick", "containerdblclick", "rowbodyclick", 31516 "rowbodydblclick", "rowcontextmenu", "cellcontextmenu", 31517 "headercontextmenu", "groupcontextmenu", 31518 "containercontextmenu", "rowbodycontextmenu", "bodyscroll", 31519 "columnresize", "columnmove", "sortchange", "groupchange", 31520 "reconfigure", "viewready") 31521 }, 31522 onRender : function(d, a) { 31523 Ext.grid.GridPanel.superclass.onRender.apply(this, arguments); 31524 var e = this.getGridEl(); 31525 this.el.addClass("x-grid-panel"); 31526 this.mon(e, { 31527 scope : this, 31528 mousedown : this.onMouseDown, 31529 click : this.onClick, 31530 dblclick : this.onDblClick, 31531 contextmenu : this.onContextMenu 31532 }); 31533 this.relayEvents(e, ["mousedown", "mouseup", "mouseover", "mouseout", 31534 "keypress", "keydown"]); 31535 var b = this.getView(); 31536 b.init(this); 31537 b.render(); 31538 this.getSelectionModel().init(this) 31539 }, 31540 initEvents : function() { 31541 Ext.grid.GridPanel.superclass.initEvents.call(this); 31542 if (this.loadMask) { 31543 this.loadMask = new Ext.LoadMask(this.bwrap, Ext.apply({ 31544 store : this.store 31545 }, this.loadMask)) 31546 } 31547 }, 31548 initStateEvents : function() { 31549 Ext.grid.GridPanel.superclass.initStateEvents.call(this); 31550 this.mon(this.colModel, "hiddenchange", this.saveState, this, { 31551 delay : 100 31552 }) 31553 }, 31554 applyState : function(a) { 31555 var k = this.colModel, g = a.columns, j = this.store, m, h, l; 31556 if (g) { 31557 for (var d = 0, e = g.length; d < e; d++) { 31558 m = g[d]; 31559 h = k.getColumnById(m.id); 31560 if (h) { 31561 l = k.getIndexById(m.id); 31562 k.setState(l, { 31563 hidden : m.hidden, 31564 width : m.width, 31565 sortable : m.sortable 31566 }); 31567 if (l != d) { 31568 k.moveColumn(l, d) 31569 } 31570 } 31571 } 31572 } 31573 if (j) { 31574 m = a.sort; 31575 if (m) { 31576 j[j.remoteSort ? "setDefaultSort" : "sort"](m.field, 31577 m.direction) 31578 } 31579 m = a.group; 31580 if (j.groupBy) { 31581 if (m) { 31582 j.groupBy(m) 31583 } else { 31584 j.clearGrouping() 31585 } 31586 } 31587 } 31588 var b = Ext.apply({}, a); 31589 delete b.columns; 31590 delete b.sort; 31591 Ext.grid.GridPanel.superclass.applyState.call(this, b) 31592 }, 31593 getState : function() { 31594 var g = { 31595 columns : [] 31596 }, b = this.store, e, a; 31597 for (var d = 0, h;
31597 (h = this.colModel.config[d]); d++) { 31598 g.columns[d] = { 31599 id : h.id, 31600 width : h.width 31601 }; 31602 if (h.hidden) { 31603 g.columns[d].hidden = true 31604 } 31605 if (h.sortable) { 31606 g.columns[d].sortable = true 31607 } 31608 } 31609 if (b) { 31610 e = b.getSortState(); 31611 if (e) { 31612 g.sort = e 31613 } 31614 if (b.getGroupState) { 31615 a = b.getGroupState(); 31616 if (a) { 31617 g.group = a 31618 } 31619 } 31620 } 31621 return g 31622 }, 31623 afterRender : function() { 31624 Ext.grid.GridPanel.superclass.afterRender.call(this); 31625 var a = this.view; 31626 this.on("bodyresize", a.layout, a); 31627 a.layout(true); 31628 if (this.deferRowRender) { 31629 if (!this.deferRowRenderTask) { 31630 this.deferRowRenderTask = new Ext.util.DelayedTask( 31631 a.afterRender, this.view) 31632 } 31633 this.deferRowRenderTask.delay(10) 31634 } else { 31635 a.afterRender() 31636 } 31637 this.viewReady = true 31638 }, 31639 reconfigure : function(a, b) { 31640 var c = this.rendered; 31641 if (c) { 31642 if (this.loadMask) { 31643 this.loadMask.destroy(); 31644 this.loadMask = new Ext.LoadMask(this.bwrap, Ext.apply({}, { 31645 store : a 31646 }, this.initialConfig.loadMask)) 31647 } 31648 } 31649 if (this.view) { 31650 this.view.initData(a, b) 31651 } 31652 this.store = a; 31653 this.colModel = b; 31654 if (c) { 31655 this.view.refresh(true) 31656 } 31657 this.fireEvent("reconfigure", this, a, b) 31658 }, 31659 onDestroy : function() { 31660 if (this.deferRowRenderTask && this.deferRowRenderTask.cancel) { 31661 this.deferRowRenderTask.cancel() 31662 } 31663 if (this.rendered) { 31664 Ext.destroy(this.view, this.loadMask) 31665 } else { 31666 if (this.store && this.store.autoDestroy) { 31667 this.store.destroy() 31668 } 31669 } 31670 Ext.destroy(this.colModel, this.selModel); 31671 this.store = this.selModel = this.colModel = this.view = this.loadMask = null; 31672 Ext.grid.GridPanel.superclass.onDestroy.call(this) 31673 }, 31674 processEvent : function(a, b) { 31675 this.view.processEvent(a, b) 31676 }, 31677 onClick : function(a) { 31678 this.processEvent("click", a) 31679 }, 31680 onMouseDown : function(a) { 31681 this.processEvent("mousedown", a) 31682 }, 31683 onContextMenu : function(b, a) { 31684 this.processEvent("contextmenu", b) 31685 }, 31686 onDblClick : function(a) { 31687 this.processEvent("dblclick", a) 31688 }, 31689 walkCells : function(k, c, b, e, j) { 31690 var i = this.colModel, g = i.getColumnCount(), a = this.store, h = a 31691 .getCount(), d = true; 31692 if (b < 0) { 31693 if (c < 0) { 31694 k--; 31695 d = false 31696 } 31697 while (k >= 0) { 31698 if (!d) { 31699 c = g - 1 31700 } 31701 d = false; 31702 while (c >= 0) { 31703 if (e.call(j || this, k, c, i) === true) { 31704 return [k, c] 31705 } 31706 c-- 31707 } 31708 k-- 31709 } 31710 } else { 31711 if (c >= g) { 31712 k++; 31713 d = false 31714 } 31715 while (k < h) { 31716 if (!d) { 31717 c = 0 31718 } 31719 d = false; 31720 while (c < g) { 31721 if (e.call(j || this, k, c, i) === true) { 31722 return [k, c] 31723 } 31724 c++ 31725 } 31726 k++ 31727 } 31728 } 31729 return null 31730 }, 31731 getGridEl : function() { 31732 return this.body 31733 }, 31734 stopEditing : Ext.emptyFn, 31735 getSelectionModel : function() { 31736 if (!this.selModel) { 31737 this.selModel = new Ext.grid.RowSelectionModel(this.disableSelection 31738 ? { 31739 selectRow : Ext.emptyFn 31740 } 31741 : null) 31742 } 31743 return this.selModel 31744 }, 31745 getStore : function() { 31746 return this.store 31747 }, 31748 getColumnModel : function() { 31749 return this.colModel 31750 }, 31751 getView : function() { 31752 if (!this.view) { 31753 this.view = new Ext.grid.GridView(this.viewConfig) 31754 } 31755 return this.view 31756 }, 31757 getDragDropText : function() { 31758 var a = this.selModel.getCount(); 31759 return String.format(this.ddText, a, a == 1 ? "" : "s") 31760 } 31761}); 31762Ext.reg("grid", Ext.grid.GridPanel); 31763Ext.grid.GridView = Ext.extend(Ext.util.Observable, { 31764 deferEmptyText : true, 31765 scrollOffset : undefined, 31766 autoFill : false, 31767 forceFit : false, 31768 sortClasses : ["sort-asc", "sort-desc"], 31769 sortAscText : "Sort Ascending", 31770 sortDescText : "Sort Descending", 31771 columnsText : "Columns", 31772 selectedRowClass : "x-grid3-row-selected", 31773 borderWidth : 2, 31774 tdClass : "x-grid3-cell", 31775 hdCls : "x-grid3-hd", 31776 markDirty : true, 31777 cellSelectorDepth : 4, 31778 rowSelectorDepth : 10, 31779 rowBodySelectorDepth : 10, 31780 cellSelector : "td.x-grid3-cell", 31781 rowSelector : "div.x-grid3-row", 31782 rowBodySelector : "div.x-grid3-row-body", 31783 firstRowCls : "x-grid3-row-first", 31784 lastRowCls : "x-grid3-row-last", 31785 rowClsRe : /(?:^|\s+)x-grid3-row-(first|last|alt)(?:\s+|$)/g, 31786 headerMenuOpenCls : "x-grid3-hd-menu-open", 31787 rowOverCls : "x-grid3-row-over", 31788 constructor : function(a) { 31789 Ext.apply(this, a); 31790 this.addEvents("beforerowremoved", "beforerowsinserted", 31791 "beforerefresh", "rowremoved", "rowsinserted", "rowupdated", 31792 "refresh"); 31793 Ext.grid.GridView.superclass.constructor.call(this) 31794 }, 31795 masterTpl : new Ext.Template( 31796 '<div class="x-grid3" hidefocus="true">', 31797 '<div class="x-grid3-viewport">', 31798 '<div class="x-grid3-header">', 31799 '<div class="x-grid3-header-inner">', 31800 '<div class="x-grid3-header-offset" style="{ostyle}">{header}</div>', 31801 "</div>", '<div class="x-clear"></div>', "</div>", 31802 '<div class="x-grid3-scroller">', 31803 '<div class="x-grid3-body" style="{bstyle}">{body}</div>', 31804 '<a href="#" class="x-grid3-focus" tabIndex="-1"></a>', "</div>", 31805 "</div>", '<div class="x-grid3-resize-marker"> </div>', 31806 '<div class="x-grid3-resize-proxy"> </div>', "</div>"), 31807 headerTpl : new Ext.Template( 31808 '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">', 31809 "<thead>", '<tr class="x-grid3-hd-row">{cells}</tr>', "</thead>", 31810 "</table>"), 31811 bodyTpl : new Ext.Template("{rows}"), 31812 cellTpl : new Ext.Template( 31813 '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>', 31814 '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr} {tabIndex}>{value}</div>', 31815 "</td>"), 31816 initTemplates : function() { 31817 var c = this.templates || {}, d, b, g = new Ext.Template( 31818 '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id} {css}" style="{style}">', 31819 '<div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', 31820 this.grid.enableHdMenu 31821 ? '<a class="x-grid3-hd-btn" href="#"></a>' 31822 : "", "{value}", 31823 '<img alt="" class="x-grid3-sort-icon" src="', 31824 Ext.BLANK_IMAGE_URL, '" />', "</div>", "</td>"), a = [ 31825 '<tr class="x-grid3-row-body-tr" style="{bodyStyle}">', 31826 '<td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on">', 31827 '<div class="x-grid3-row-body">{body}</div>', "</td>", "</tr>"] 31828 .join(""), e = [ 31829 '<table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">', 31830 "<tbody>", "<tr>{cells}</tr>", this.enableRowBody ? a : "", 31831 "</tbody>", "</table>"].join(""); 31832 Ext.applyIf(c, { 31833 hcell : g, 31834 cell : this.cellTpl, 31835 body : this.bodyTpl, 31836 header : this.headerTpl, 31837 master : this.masterTpl, 31838 row : new Ext.Template('<div class="x-grid3-row {alt}" style="{tstyle}">' 31839 + e + "</div>"), 31840 rowInner : new Ext.Template(e) 31841 }); 31842 for (b in c) { 31843 d = c[b]; 31844 if (d && Ext.isFunction(d.compile) && !d.compiled) { 31845 d.disableFormats = true; 31846 d.compile() 31847 } 31848 } 31849 this.templates = c; 31850 this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "") 31851 }, 31852 fly : function(a) { 31853 if (!this._flyweight) { 31854 this._flyweight = new Ext.Element.Flyweight(document.body) 31855 } 31856 this._flyweight.dom = a; 31857 return this._flyweight 31858 }, 31859 getEditorParent : function() { 31860 return this.scroller.dom 31861 }, 31862 initElements : function() { 31863 var b = Ext.Element, d = Ext.get(this.grid.getGridEl().dom.firstChild), e = new b(d 31864 .child("div.x-grid3-viewport")), c = new b(e 31865 .child("div.x-grid3-header")), a = new b(e 31866 .child("div.x-grid3-scroller")); 31867 if (this.grid.hideHeaders) { 31868 c.setDisplayed(false) 31869 } 31870 if (this.forceFit) { 31871 a.setStyle("overflow-x", "hidden") 31872 } 31873 Ext.apply(this, { 31874 el : d, 31875 mainWrap : e, 31876 scroller : a,
31877 mainHd : c, 31878 innerHd : c.child("div.x-grid3-header-inner").dom, 31879 mainBody : new b(b.fly(a).child("div.x-grid3-body")), 31880 focusEl : new b(b.fly(a).child("a")), 31881 resizeMarker : new b(d.child("div.x-grid3-resize-marker")), 31882 resizeProxy : new b(d.child("div.x-grid3-resize-proxy")) 31883 }); 31884 this.focusEl.swallowEvent("click", true) 31885 }, 31886 getRows : function() { 31887 return this.hasRows() ? this.mainBody.dom.childNodes : [] 31888 }, 31889 findCell : function(a) { 31890 if (!a) { 31891 return false 31892 } 31893 return this.fly(a) 31894 .findParent(this.cellSelector, this.cellSelectorDepth) 31895 }, 31896 findCellIndex : function(d, c) { 31897 var b = this.findCell(d), a; 31898 if (b) { 31899 a = this.fly(b).hasClass(c); 31900 if (!c || a) { 31901 return this.getCellIndex(b) 31902 } 31903 } 31904 return false 31905 }, 31906 getCellIndex : function(b) { 31907 if (b) { 31908 var a = b.className.match(this.colRe); 31909 if (a && a[1]) { 31910 return this.cm.getIndexById(a[1]) 31911 } 31912 } 31913 return false 31914 }, 31915 findHeaderCell : function(b) { 31916 var a = this.findCell(b); 31917 return a && this.fly(a).hasClass(this.hdCls) ? a : null 31918 }, 31919 findHeaderIndex : function(a) { 31920 return this.findCellIndex(a, this.hdCls) 31921 }, 31922 findRow : function(a) { 31923 if (!a) { 31924 return false 31925 } 31926 return this.fly(a).findParent(this.rowSelector, this.rowSelectorDepth) 31927 }, 31928 findRowIndex : function(a) { 31929 var b = this.findRow(a); 31930 return b ? b.rowIndex : false 31931 }, 31932 findRowBody : function(a) { 31933 if (!a) { 31934 return false 31935 } 31936 return this.fly(a).findParent(this.rowBodySelector, 31937 this.rowBodySelectorDepth) 31938 }, 31939 getRow : function(a) { 31940 return this.getRows()[a] 31941 }, 31942 getCell : function(b, a) { 31943 return Ext.fly(this.getRow(b)).query(this.cellSelector)[a] 31944 }, 31945 getHeaderCell : function(a) { 31946 return this.mainHd.dom.getElementsByTagName("td")[a] 31947 }, 31948 addRowClass : function(b, a) { 31949 var c = this.getRow(b); 31950 if (c) { 31951 this.fly(c).addClass(a) 31952 } 31953 }, 31954 removeRowClass : function(c, a) { 31955 var b = this.getRow(c); 31956 if (b) { 31957 this.fly(b).removeClass(a) 31958 } 31959 }, 31960 removeRow : function(a) { 31961 Ext.removeNode(this.getRow(a)); 31962 this.syncFocusEl(a) 31963 }, 31964 removeRows : function(c, a) { 31965 var b = this.mainBody.dom, d; 31966 for (d = c; d <= a; d++) { 31967 Ext.removeNode(b.childNodes[c]) 31968 } 31969 this.syncFocusEl(c) 31970 }, 31971 getScrollState : function() { 31972 var a = this.scroller.dom; 31973 return { 31974 left : a.scrollLeft, 31975 top : a.scrollTop 31976 } 31977 }, 31978 restoreScroll : function(a) { 31979 var b = this.scroller.dom; 31980 b.scrollLeft = a.left; 31981 b.scrollTop = a.top 31982 }, 31983 scrollToTop : function() { 31984 var a = this.scroller.dom; 31985 a.scrollTop = 0; 31986 a.scrollLeft = 0 31987 }, 31988 syncScroll : function() { 31989 this.syncHeaderScroll(); 31990 var a = this.scroller.dom; 31991 this.grid.fireEvent("bodyscroll", a.scrollLeft, a.scrollTop) 31992 }, 31993 syncHeaderScroll : function() { 31994 var a = this.innerHd, b = this.scroller.dom.scrollLeft; 31995 a.scrollLeft = b; 31996 a.scrollLeft = b 31997 }, 31998 updateSortIcon : function(d, c) { 31999 var a = this.sortClasses, b = a[c == "DESC" ? 1 : 0], e = this.mainHd 32000 .select("td").removeClass(a); 32001 e.item(d).addClass(b) 32002 }, 32003 updateAllColumnWidths : function() { 32004 var e = this.getTotalWidth(), k = this.cm.getColumnCount(), m = this 32005 .getRows(), g = m.length, b = [], l, a, h, d, c; 32006 for (d = 0; d < k; d++) { 32007 b[d] = this.getColumnWidth(d); 32008 this.getHeaderCell(d).style.width = b[d] 32009 } 32010 this.updateHeaderWidth(); 32011 for (d = 0; d < g; d++) { 32012 l = m[d]; 32013 l.style.width = e; 32014 a = l.firstChild; 32015 if (a) { 32016 a.style.width = e; 32017 h = a.rows[0]; 32018 for (c = 0; c < k; c++) { 32019 h.childNodes[c].style.width = b[c] 32020 } 32021 } 32022 } 32023 this.onAllColumnWidthsUpdated(b, e) 32024 }, 32025 updateColumnWidth : function(d, b) { 32026 var c = this.getColumnWidth(d), j = this.getTotalWidth(), h = this 32027 .getHeaderCell(d), a = this.getRows(), e = a.length, l, g, k; 32028 this.updateHeaderWidth(); 32029 h.style.width = c; 32030 for (g = 0; g < e; g++) { 32031 l = a[g]; 32032 k = l.firstChild; 32033 l.style.width = j; 32034 if (k) { 32035 k.style.width = j; 32036 k.rows[0].childNodes[d].style.width = c 32037 } 32038 }
32039 this.onColumnWidthUpdated(d, c, j) 32040 }, 32041 updateColumnHidden : function(b, j) { 32042 var h = this.getTotalWidth(), k = j ? "none" : "", g = this 32043 .getHeaderCell(b), a = this.getRows(), d = a.length, l, c, e; 32044 this.updateHeaderWidth(); 32045 g.style.display = k; 32046 for (e = 0; e < d; e++) { 32047 l = a[e]; 32048 l.style.width = h; 32049 c = l.firstChild; 32050 if (c) { 32051 c.style.width = h; 32052 c.rows[0].childNodes[b].style.display = k 32053 } 32054 } 32055 this.onColumnHiddenUpdated(b, j, h); 32056 delete this.lastViewWidth; 32057 this.layout() 32058 }, 32059 doRender : function(d, v, m, a, r, t) { 32060 var h = this.templates, c = h.cell, y = h.row, o = r - 1, b = "width:" 32061 + this.getTotalWidth() + ";", k = [], l = [], n = { 32062 tstyle : b 32063 }, q = {}, w = v.length, x, g, e, u, s, p, tabIndex = this.grid.tabIndex; 32064 for (s = 0; s < w; s++) { 32065 e = v[s]; 32066 l = []; 32067 p = s + a; 32068 for (u = 0; u < r; u++) { 32069 g = d[u]; 32070 q.id = g.id; 32071 q.css = u === 0 ? "x-grid3-cell-first " : (u == o 32072 ? "x-grid3-cell-last " 32073 : ""); 32074 q.attr = q.cellAttr = ""; 32075 q.style = g.style; 32076 32077 /* 32078 * ch197cm 07.13 ì¹ ì ê·¼ì±ì ê³ ë ¤íì¬ tabindex ì¶ê° 32079 */ 32080 if (this.cm && this.cm.columns && this.cm.columns[u] && this.cm.columns[u].useTabIndex) { 32081 q.tabIndex = 'tabindex="'+tabIndex+'"'; 32082 } else { 32083 q.tabIndex = null; 32084 } 32085 q.value = g.renderer.call(g.scope, e.data[g.name], q, e, p, u, 32086 m); 32087 if (Ext.isEmpty(q.value)) { 32088 q.value = " " 32089 } 32090 if (this.markDirty && e.dirty 32091 && typeof e.modified[g.name] != "undefined") { 32092 q.css += " x-grid3-dirty-cell" 32093 } 32094 l[l.length] = c.apply(q) 32095 } 32096 x = []; 32097 if (t && ((p + 1) % 2 === 0)) { 32098 x[0] = "x-grid3-row-alt" 32099 } 32100 if (e.dirty) { 32101 x[1] = " x-grid3-dirty-row" 32102 } 32103 n.cols = r; 32104 if (this.getRowClass) { 32105 x[2] = this.getRowClass(e, p, n, m) 32106 } 32107 n.alt = x.join(" "); 32108 n.cells = l.join(""); 32109 k[k.length] = y.apply(n) 32110 } 32111 return k.join("") 32112 }, 32113 processRows : function(a, g) { 32114 if (!this.ds || this.ds.getCount() < 1) { 32115 return 32116 } 32117 var d = this.getRows(), c = d.length, e, b; 32118 g = g || !this.grid.stripeRows; 32119 a = a || 0; 32120 for (b = 0; b < c; b++) { 32121 e = d[b]; 32122 if (e) { 32123 e.rowIndex = b; 32124 if (!g) { 32125 e.className = e.className.replace(this.rowClsRe, " "); 32126 if ((b + 1) % 2 === 0) { 32127 e.className += " x-grid3-row-alt" 32128 } 32129 } 32130 } 32131 } 32132 if (a === 0) { 32133 Ext.fly(d[0]).addClass(this.firstRowCls) 32134 } 32135 Ext.fly(d[c - 1]).addClass(this.lastRowCls) 32136 }, 32137 afterRender : function() { 32138 if (!this.ds || !this.cm) { 32139 return 32140 } 32141 this.mainBody.dom.innerHTML = this.renderBody() || " "; 32142 this.processRows(0, true); 32143 if (this.deferEmptyText !== true) { 32144 this.applyEmptyText() 32145 } 32146 this.grid.fireEvent("viewready", this.grid) 32147 }, 32148 afterRenderUI : function() { 32149 var a = this.grid; 32150 this.initElements(); 32151 Ext.fly(this.innerHd).on("click", this.handleHdDown, this); 32152 this.mainHd.on({ 32153 scope : this, 32154 mouseover : this.handleHdOver, 32155 mouseout : this.handleHdOut, 32156 mousemove : this.handleHdMove 32157 }); 32158 this.scroller.on("scroll", this.syncScroll, this); 32159 if (a.enableColumnResize !== false) { 32160 this.splitZone = new Ext.grid.GridView.SplitDragZone(a, 32161 this.mainHd.dom) 32162 } 32163 if (a.enableColumnMove) { 32164 this.columnDrag = new Ext.grid.GridView.ColumnDragZone(a, 32165 this.innerHd); 32166 this.columnDrop = new Ext.grid.HeaderDropZone(a, this.mainHd.dom) 32167 } 32168 if (a.enableHdMenu !== false) { 32169 this.hmenu = new Ext.menu.Menu({ 32170 id : a.id + "-hctx" 32171 }); 32172 this.hmenu.add({ 32173 itemId : "asc", 32174 text : this.sortAscText, 32175 cls : "xg-hmenu-sort-asc" 32176 }, { 32177 itemId : "desc", 32178 text : this.sortDescText, 32179 cls : "xg-hmenu-sort-desc" 32180 }); 32181 if (a.enableColumnHide !== false) { 32182 this.colMenu = new Ext.menu.Menu({ 32183 id : a.id + "-hcols-menu" 32184 }); 32185 this.colMenu.on({ 32186 scope : this, 32187 beforeshow : this.beforeColMenuShow, 32188 itemclick : this.handleHdMenuClick 32189 });
32190 this.hmenu.add("-", { 32191 itemId : "columns", 32192 hideOnClick : false, 32193 text : this.columnsText, 32194 menu : this.colMenu, 32195 iconCls : "x-cols-icon" 32196 }) 32197 } 32198 this.hmenu.on("itemclick", this.handleHdMenuClick, this) 32199 } 32200 if (a.trackMouseOver) { 32201 this.mainBody.on({ 32202 scope : this, 32203 mouseover : this.onRowOver, 32204 mouseout : this.onRowOut 32205 }) 32206 } 32207 if (a.enableDragDrop || a.enableDrag) { 32208 /* add : lilo : 2015.10.29 */ 32209 // ìµì ì ìí´ ìëì¼ë¡ ìì±ëë StatusProxyì dropNotAllowed, dropAllowed ìµì ì ì©í기 ìí´ ì»¤ì¤í°ë§ì´ì§ 32210 /* 32211 this.dragZone = new Ext.grid.GridDragZone(a, { 32212 ddGroup : a.ddGroup || "GridDD" 32213 }) 32214 */ 32215 var b = { 32216 ddGroup : a.ddGroup || "GridDD" 32217 }; 32218 32219 if(a && a.dropNotAllowed) { 32220 b.dropNotAllowed = a.dropNotAllowed; 32221 } 32222 if(a && a.dropAllowed) { 32223 b.dropAllowed = a.dropAllowed; 32224 } 32225 this.dragZone = new Ext.grid.GridDragZone(a, b) 32226 // ì¬ê¸°ê¹ì§ 커ì¤í°ë§ì´ì§ 32227 } 32228 this.updateHeaderSortState() 32229 }, 32230 renderUI : function() { 32231 var a = this.templates; 32232 return a.master.apply({ 32233 body : a.body.apply({
32234 rows : " " 32235 }), 32236 header : this.renderHeaders(), 32237 ostyle : "width:" + this.getOffsetWidth() + ";", 32238 bstyle : "width:" + this.getTotalWidth() + ";" 32239 }) 32240 }, 32241 processEvent : function(b, h) { 32242 var i = h.getTarget(), a = this.grid, d = this.findHeaderIndex(i), k, j, c, g; 32243 a.fireEvent(b, h); 32244 if (d !== false) { 32245 a.fireEvent("header" + b, a, d, h) 32246 } else { 32247 k = this.findRowIndex(i); 32248 if (k !== false) { 32249 j = this.findCellIndex(i); 32250 if (j !== false) { 32251 c = a.colModel.getColumnAt(j); 32252 if (a.fireEvent("cell" + b, a, k, j, h) !== false) { 32253 if (!c 32254 || (c.processEvent && (c.processEvent(b, h, a, 32255 k, j) !== false))) { 32256 a.fireEvent("row" + b, a, k, h) 32257 } 32258 } 32259 } else { 32260 if (a.fireEvent("row" + b, a, k, h) !== false) { 32261 (g = this.findRowBody(i)) 32262 && a.fireEvent("rowbody" + b, a, k, h) 32263 } 32264 } 32265 } else { 32266 a.fireEvent("container" + b, a, h) 32267 } 32268 } 32269 }, 32270 layout : function(j) { 32271 if (!this.mainBody) { 32272 return 32273 } 32274 var a = this.grid, d = a.getGridEl(), c = d.getSize(true), i = c.width, b = c.height, h = this.scroller, g, e, k; 32275 if (i < 20 || b < 20) { 32276 return 32277 } 32278 if (a.autoHeight) { 32279 g = h.dom.style; 32280 g.overflow = "visible"; 32281 if (Ext.isWebKit) { 32282 g.position = "static" 32283 } 32284 } else { 32285 this.el.setSize(i, b); 32286 e = this.mainHd.getHeight(); 32287 k = b - e; 32288 h.setSize(i, k); 32289 if (this.innerHd) { 32290 this.innerHd.style.width = (i) + "px" 32291 } 32292 } 32293 if (this.forceFit || (j === true && this.autoFill)) { 32294 if (this.lastViewWidth != i) { 32295 this.fitColumns(false, false); 32296 this.lastViewWidth = i 32297 } 32298 } else { 32299 this.autoExpand(); 32300 this.syncHeaderScroll() 32301 } 32302 this.onLayout(i, k) 32303 }, 32304 onLayout : function(a, b) { 32305 }, 32306 onColumnWidthUpdated : function(c, a, b) { 32307 }, 32308 onAllColumnWidthsUpdated : function(a, b) { 32309 }, 32310 onColumnHiddenUpdated : function(b, c, a) { 32311 }, 32312 updateColumnText : function(a, b) { 32313 }, 32314 afterMove : function(a) { 32315 }, 32316 init : function(a) { 32317 this.grid = a; 32318 this.initTemplates(); 32319 this.initData(a.store, a.colModel); 32320 this.initUI(a) 32321 }, 32322 getColumnId : function(a) { 32323 return this.cm.getColumnId(a) 32324 }, 32325 getOffsetWidth : function() { 32326 return (this.cm.getTotalWidth() + this.getScrollOffset()) + "px" 32327 }, 32328 getScrollOffset : function() { 32329 return Ext.num(this.scrollOffset, Ext.getScrollBarWidth()) 32330 }, 32331 renderHeaders : function() { 32332 var e = this.cm, g = this.templates, a = g.hcell, d = {}, h = e 32333 .getColumnCount(), j = h - 1, k = [], c, b; 32334 for (c = 0; c < h; c++) { 32335 if (c == 0) { 32336 b = "x-grid3-cell-first " 32337 } else { 32338 b = c == j ? "x-grid3-cell-last " : "" 32339 } 32340 d = { 32341 id : e.getColumnId(c), 32342 value : e.getColumnHeader(c) || "", 32343 style : this.getColumnStyle(c, true), 32344 css : b, 32345 tooltip : this.getColumnTooltip(c) 32346 }; 32347 if (e.config[c].align == "right") { 32348 d.istyle = "padding-right: 16px;" 32349 } else { 32350 delete d.istyle 32351 } 32352 k[c] = a.apply(d) 32353 } 32354 return g.header.apply({ 32355 cells : k.join(""), 32356 tstyle : String.format("width: {0};", this.getTotalWidth()) 32357 }) 32358 }, 32359 getColumnTooltip : function(a) { 32360 var b = this.cm.getColumnTooltip(a); 32361 if (b) { 32362 if (Ext.QuickTips.isEnabled()) { 32363 return 'ext:qtip="' + b + '"' 32364 } else { 32365 return 'title="' + b + '"' 32366 } 32367 } 32368 return "" 32369 }, 32370 beforeUpdate : function() { 32371 this.grid.stopEditing(true) 32372 }, 32373 updateHeaders : function() { 32374 this.innerHd.firstChild.innerHTML = this.renderHeaders(); 32375 this.updateHeaderWidth(false) 32376 }, 32377 updateHeaderWidth : function(c) { 32378 var b = this.innerHd.firstChild, a = this.getTotalWidth(); 32379 b.style.width = this.getOffsetWidth(); 32380 b.firstChild.style.width = a; 32381 if (c !== false) { 32382 this.mainBody.dom.style.width = a 32383 } 32384 }, 32385 focusRow : function(a) { 32386 this.focusCell(a, 0, false) 32387 }, 32388 focusCell : function(d, b, c) { 32389 this.syncFocusEl(this.ensureVisible(d, b, c)); 32390 var a = this.focusEl; 32391 if (Ext.isGecko) { 32392 a.focus() 32393 } else { 32394 a.focus.defer(1, a) 32395 } 32396 },
32397 resolveCell : function(h, d, g) { 32398 if (!Ext.isNumber(h)) { 32399 h = h.rowIndex 32400 } 32401 if (!this.ds) { 32402 return null 32403 } 32404 if (h < 0 || h >= this.ds.getCount()) { 32405 return null 32406 } 32407 d = (d !== undefined ? d : 0); 32408 var c = this.getRow(h), b = this.cm, e = b.getColumnCount(), a; 32409 if (!(g === false && d === 0)) { 32410 while (d < e && b.isHidden(d)) { 32411 d++ 32412 } 32413 a = this.getCell(h, d) 32414 } 32415 return { 32416 row : c, 32417 cell : a 32418 } 32419 }, 32420 getResolvedXY : function(b) { 32421 if (!b) { 32422 return null 32423 } 32424 var a = b.cell, c = b.row; 32425 if (a) { 32426 return Ext.fly(a).getXY() 32427 } else { 32428 return [this.el.getX(), Ext.fly(c).getY()] 32429 } 32430 }, 32431 syncFocusEl : function(d, a, c) { 32432 var b = d; 32433 if (!Ext.isArray(b)) { 32434 d = Math.min(d, Math.max(0, this.getRows().length - 1)); 32435 if (isNaN(d)) { 32436 return 32437 } 32438 b = this.getResolvedXY(this.resolveCell(d, a, c)) 32439 } 32440 this.focusEl.setXY(b || this.scroller.getXY()) 32441 }, 32442 ensureVisible : function(t, g, e) { 32443 var r = this.resolveCell(t, g, e); 32444 if (!r || !r.row) { 32445 return null 32446 } 32447 var k = r.row, h = r.cell, n = this.scroller.dom, d = k, s = 0, o = this.el.dom; 32448 while (d && d != o) { 32449 s += d.offsetTop; 32450 d = d.offsetParent 32451 } 32452 s -= this.mainHd.dom.offsetHeight; 32453 o = parseInt(n.scrollTop, 10); 32454 var q = s + k.offsetHeight, a = n.clientHeight, m = o + a; 32455 if (s < o) { 32456 n.scrollTop = s 32457 } else { 32458 if (q > m) { 32459 n.scrollTop = q - a 32460 } 32461 } 32462 if (e !== false) { 32463 var l = parseInt(h.offsetLeft, 10), j = l + h.offsetWidth, i = parseInt( 32464 n.scrollLeft, 10), b = i + n.clientWidth; 32465 if (l < i) { 32466 n.scrollLeft = l 32467 } else { 32468 if (j > b) { 32469 n.scrollLeft = j - n.clientWidth 32470 } 32471 } 32472 } 32473 return this.getResolvedXY(r) 32474 }, 32475 insertRows : function(a, i, e, h) { 32476 var d = a.getCount() - 1; 32477 if (!h && i === 0 && e >= d) { 32478 this.fireEvent("beforerowsinserted", this, i, e); 32479 this.refresh(); 32480 this.fireEvent("rowsinserted", this, i, e) 32481 } else { 32482 if (!h) { 32483 this.fireEvent("beforerowsinserted", this, i, e) 32484 } 32485 var b = this.renderRows(i, e), g = this.getRow(i); 32486 if (g) { 32487 if (i === 0) { 32488 Ext.fly(this.getRow(0)).removeClass(this.firstRowCls) 32489 } 32490 Ext.DomHelper.insertHtml("beforeBegin", g, b) 32491 } else { 32492 var c = this.getRow(d - 1); 32493 if (c) { 32494 Ext.fly(c).removeClass(this.lastRowCls) 32495 } 32496 Ext.DomHelper.insertHtml("beforeEnd", this.mainBody.dom, b) 32497 } 32498 if (!h) { 32499 this.processRows(i); 32500 this.fireEvent("rowsinserted", this, i, e) 32501 } else { 32502 if (i === 0 || i >= d) { 32503 Ext.fly(this.getRow(i)).addClass(i === 0 32504 ? this.firstRowCls 32505 : this.lastRowCls) 32506 } 32507 } 32508 } 32509 this.syncFocusEl(i) 32510 }, 32511 deleteRows : function(a, c, b) { 32512 if (a.getRowCount() < 1) { 32513 this.refresh() 32514 } else { 32515 this.fireEvent("beforerowsdeleted", this, c, b); 32516 this.removeRows(c, b); 32517 this.processRows(c); 32518 this.fireEvent("rowsdeleted", this, c, b) 32519 } 32520 }, 32521 getColumnStyle : function(b, d) { 32522 var a = this.cm, g = a.config, c = d ? "" : g[b].css || "", e = g[b].align; 32523 c += String.format("width: {0};", this.getColumnWidth(b)); 32524 if (a.isHidden(b)) { 32525 c += "display: none; " 32526 } 32527 if (e) { 32528 c += String.format("text-align: {0};", e) 32529 } 32530 return c 32531 }, 32532 getColumnWidth : function(b) { 32533 var c = this.cm.getColumnWidth(b), a = this.borderWidth; 32534 if (Ext.isNumber(c)) { 32535 if (Ext.isBorderBox || (Ext.isWebKit && !Ext.isSafari2)) { 32536 return c + "px" 32537 } else { 32538 return Math.max(c - a, 0) + "px" 32539 } 32540 } else { 32541 return c 32542 } 32543 }, 32544 getTotalWidth : function() { 32545 return this.cm.getTotalWidth() + "px" 32546 }, 32547 fitColumns : function(g, j, h) { 32548 var a = this.grid, l = this.cm, s = l.getTotalWidth(false), q = this 32549 .getGridInnerWidth(), r = q - s, c = [], o = 0, n = 0, u, d, p; 32550 if (q < 20 || r === 0) { 32551 return false 32552 } 32553 var e = l.getColumnCount(true), m = l.getColumnCount(false), b = e 32554 - (Ext.isNumber(h) ? 1 : 0); 32555 if (b === 0) { 32556 b = 1; 32557 h = undefined 32558 } 32559 for (p = 0; p < m; p++) { 32560 if (!l.isFixed(p) && p !== h) { 32561 u = l.getColumnWidth(p); 32562 c.push(p, u); 32563 if (!l.isHidden(p)) { 32564 o = p; 32565 n += u 32566 } 32567 } 32568 } 32569 d = (q - l.getTotalWidth()) / n; 32570 while (c.length) { 32571 u = c.pop(); 32572 p = c.pop(); 32573 l.setColumnWidth(p, Math.max(a.minColumnWidth, Math 32574 .floor(u + u * d)), true) 32575 } 32576 s = l.getTotalWidth(false); 32577 if (s > q) { 32578 var t = (b == e) ? o : h, k = Math.max(1, l.getColumnWidth(t) 32579 - (s - q)); 32580 l.setColumnWidth(t, k, true) 32581 } 32582 if (g !== true) { 32583 this.updateAllColumnWidths() 32584 } 32585 return true 32586 }, 32587 autoExpand : function(k) { 32588 var a = this.grid, i = this.cm, e = this.getGridInnerWidth(), c = i 32589 .getTotalWidth(false), g = a.autoExpandColumn; 32590 if (!this.userResized && g) { 32591 if (e != c) { 32592 var j = i.getIndexById(g), b = i.getColumnWidth(j), h = e - c 32593 + b, d = Math.min(Math.max(h, a.autoExpandMin), 32594 a.autoExpandMax); 32595 if (b != d) { 32596 i.setColumnWidth(j, d, true); 32597 if (k !== true) { 32598 this.updateColumnWidth(j, d) 32599 } 32600 } 32601 } 32602 } 32603 }, 32604 getGridInnerWidth : function() {
32605 return this.grid.getGridEl().getWidth(true) - this.getScrollOffset() 32606 }, 32607 getColumnData : function() { 32608 var e = [], c = this.cm, g = c.getColumnCount(), a = this.ds.fields, d, b; 32609 for (d = 0; d < g; d++) { 32610 b = c.getDataIndex(d); 32611 e[d] = { 32612 name : Ext.isDefined(b) ? b : (a.get(d) 32613 ? a.get(d).name 32614 : undefined), 32615 renderer : c.getRenderer(d), 32616 scope : c.getRendererScope(d), 32617 id : c.getColumnId(d), 32618 style : this.getColumnStyle(d) 32619 } 32620 } 32621 return e 32622 }, 32623 renderRows : function(i, c) { 32624 var a = this.grid, g = a.store, j = a.stripeRows, e = a.colModel, h = e 32625 .getColumnCount(), d = g.getCount(), b; 32626 if (d < 1) { 32627 return "" 32628 } 32629 i = i || 0; 32630 c = Ext.isDefined(c) ? c : d - 1; 32631 b = g.getRange(i, c); 32632 return this.doRender(this.getColumnData(), b, g, i, h, j) 32633 }, 32634 renderBody : function() { 32635 var a = this.renderRows() || " "; 32636 return this.templates.body.apply({ 32637 rows : a 32638 }) 32639 }, 32640 refreshRow : function(g) { 32641 var l = this.ds, m = this.cm.getColumnCount(), c = this.getColumnData(), n = m 32642 - 1, p = ["x-grid3-row"], e = { 32643 tstyle : String.format("width: {0};", this.getTotalWidth()) 32644 }, a = [], k = this.templates.cell, j, q, b, o, h, d; 32645 if (Ext.isNumber(g)) { 32646 j = g; 32647 g = l.getAt(j) 32648 } else { 32649 j = l.indexOf(g) 32650 } 32651 if (!g || j < 0) { 32652 return 32653 } 32654 for (d = 0; d < m; d++) { 32655 b = c[d]; 32656 if (d == 0) { 32657 h = "x-grid3-cell-first" 32658 } else { 32659 h = (d == n) ? "x-grid3-cell-last " : "" 32660 } 32661 o = { 32662 id : b.id, 32663 style : b.style, 32664 css : h, 32665 attr : "", 32666 cellAttr : "" 32667 }; 32668 o.value = b.renderer.call(b.scope, g.data[b.name], o, g, j, d, l); 32669 if (Ext.isEmpty(o.value)) { 32670 o.value = " " 32671 } 32672 if (this.markDirty && g.dirty 32673 && typeof g.modified[b.name] != "undefined") { 32674 o.css += " x-grid3-dirty-cell" 32675 } 32676 a[d] = k.apply(o) 32677 } 32678 q = this.getRow(j); 32679 q.className = ""; 32680 if (this.grid.stripeRows && ((j + 1) % 2 === 0)) { 32681 p.push("x-grid3-row-alt") 32682 } 32683 if (this.getRowClass) { 32684 e.cols = m; 32685 p.push(this.getRowClass(g, j, e, l)) 32686 } 32687 this.fly(q).addClass(p).setStyle(e.tstyle); 32688 e.cells = a.join(""); 32689 q.innerHTML = this.templates.rowInner.apply(e); 32690 this.fireEvent("rowupdated", this, j, g) 32691 }, 32692 refresh : function(b) { 32693 this.fireEvent("beforerefresh", this); 32694 this.grid.stopEditing(true); 32695 var a = this.renderBody(); 32696 this.mainBody.update(a).setWidth(this.getTotalWidth()); 32697 if (b === true) { 32698 this.updateHeaders(); 32699 this.updateHeaderSortState() 32700 } 32701 this.processRows(0, true); 32702 this.layout(); 32703 this.applyEmptyText(); 32704 this.fireEvent("refresh", this) 32705 }, 32706 applyEmptyText : function() { 32707 if (this.emptyText && !this.hasRows()) { 32708 this.mainBody.update('<div class="x-grid-empty">' + this.emptyText 32709 + "</div>") 32710 } 32711 }, 32712 updateHeaderSortState : function() { 32713 var b = this.ds.getSortState(); 32714 if (!b) { 32715 return 32716 } 32717 if (!this.sortState 32718 || (this.sortState.field != b.field || this.sortState.direction != b.direction)) { 32719 this.grid.fireEvent("sortchange", this.grid, b) 32720 } 32721 this.sortState = b; 32722 var c = this.cm.findColumnIndex(b.field); 32723 if (c != -1) { 32724 var a = b.direction; 32725 this.updateSortIcon(c, a) 32726 } 32727 }, 32728 clearHeaderSortState : function() { 32729 if (!this.sortState) { 32730 return 32731 } 32732 this.grid.fireEvent("sortchange", this.grid, null); 32733 this.mainHd.select("td").removeClass(this.sortClasses); 32734 delete this.sortState 32735 }, 32736 destroy : function() { 32737 var j = this, a = j.grid, d = a.getGridEl(), i = j.dragZone, g = j.splitZone, h = j.columnDrag, e = j.columnDrop, k = j.scrollToTopTask, c, b; 32738 if (k && k.cancel) { 32739 k.cancel() 32740 } 32741 Ext.destroyMembers(j, "colMenu", "hmenu"); 32742 j.initData(null, null); 32743 j.purgeListeners(); 32744 Ext.fly(j.innerHd).un("click", j.handleHdDown, j); 32745 if (a.enableColumnMove) { 32746 c = h.dragData; 32747 b = h.proxy; 32748 Ext.destroy(h.el, b.ghost, b.el, e.el, e.proxyTop, e.proxyBottom, 32749 c.ddel, c.header); 32750 if (b.anim) { 32751 Ext.destroy(b.anim) 32752 } 32753 delete b.ghost; 32754 delete c.ddel; 32755 delete c.header; 32756 h.destroy(); 32757 delete Ext.dd.DDM.locationCache[h.id]; 32758 delete h._domRef; 32759 delete e.proxyTop; 32760 delete e.proxyBottom; 32761 e.destroy(); 32762 delete Ext.dd.DDM.locationCache["gridHeader" + d.id]; 32763 delete e._domRef; 32764 delete Ext.dd.DDM.ids[e.ddGroup] 32765 } 32766 if (g) { 32767 g.destroy(); 32768 delete g._domRef; 32769 delete Ext.dd.DDM.ids["gridSplitters" + d.id] 32770 } 32771 Ext.fly(j.innerHd).removeAllListeners(); 32772 Ext.removeNode(j.innerHd); 32773 delete j.innerHd; 32774 Ext.destroy(j.el, j.mainWrap, j.mainHd, j.scroller, j.mainBody, 32775 j.focusEl, j.resizeMarker, j.resizeProxy, j.activeHdBtn, 32776 j._flyweight, i, g); 32777 delete a.container; 32778 if (i) { 32779 i.destroy() 32780 } 32781 Ext.dd.DDM.currentTarget = null; 32782 delete Ext.dd.DDM.locationCache[d.id]; 32783 Ext.EventManager.removeResizeListener(j.onWindowResize, j) 32784 }, 32785 onDenyColumnHide : function() { 32786 }, 32787 render : function() { 32788 if (this.autoFill) { 32789 var a = this.grid.ownerCt; 32790 if (a && a.getLayout()) { 32791 a.on("afterlayout", function() { 32792 this.fitColumns(true, true); 32793 this.updateHeaders(); 32794 this.updateHeaderSortState() 32795 }, this, { 32796 single : true 32797 }) 32798 } 32799 } else { 32800 if (this.forceFit) { 32801 this.fitColumns(true, false) 32802 } else { 32803 if (this.grid.autoExpandColumn) { 32804 this.autoExpand(true) 32805 } 32806 } 32807 } 32808 this.grid.getGridEl().dom.innerHTML = this.renderUI(); 32809 this.afterRenderUI() 32810 }, 32811 initData : function(a, e) { 32812 var b = this; 32813 if (b.ds) { 32814 var d = b.ds; 32815 d.un("add", b.onAdd, b); 32816 d.un("load", b.onLoad, b); 32817 d.un("clear", b.onClear, b); 32818 d.un("remove", b.onRemove, b); 32819 d.un("update", b.onUpdate, b); 32820 d.un("datachanged", b.onDataChange, b); 32821 if (d !== a && d.autoDestroy) { 32822 d.destroy() 32823 } 32824 } 32825 if (a) { 32826 a.on({ 32827 scope : b, 32828 load : b.onLoad, 32829 add : b.onAdd, 32830 remove : b.onRemove, 32831 update : b.onUpdate, 32832 clear : b.onClear, 32833 datachanged : b.onDataChange 32834 }) 32835 } 32836 if (b.cm) { 32837 var c = b.cm; 32838 c.un("configchange", b.onColConfigChange, b); 32839 c.un("widthchange", b.onColWidthChange, b); 32840 c.un("headerchange", b.onHeaderChange, b); 32841 c.un("hiddenchange", b.onHiddenChange, b); 32842 c.un("columnmoved", b.onColumnMove, b) 32843 } 32844 if (e) { 32845 delete b.lastViewWidth; 32846 e.on({ 32847 scope : b, 32848 configchange : b.onColConfigChange, 32849 widthchange : b.onColWidthChange, 32850 headerchange : b.onHeaderChange, 32851 hiddenchange : b.onHiddenChange, 32852 columnmoved : b.onColumnMove 32853 }) 32854 } 32855 b.ds = a; 32856 b.cm = e 32857 }, 32858 onDataChange : function() { 32859 this.refresh(true); 32860 this.updateHeaderSortState(); 32861 this.syncFocusEl(0) 32862 }, 32863 onClear : function() { 32864 this.refresh();
32865 this.syncFocusEl(0) 32866 }, 32867 onUpdate : function(b, a) { 32868 this.refreshRow(a) 32869 }, 32870 onAdd : function(b, a, c) { 32871 this.insertRows(b, c, c + (a.length - 1)) 32872 }, 32873 onRemove : function(b, a, c, d) { 32874 if (d !== true) { 32875 this.fireEvent("beforerowremoved", this, c, a) 32876 } 32877 this.removeRow(c); 32878 if (d !== true) { 32879 this.processRows(c); 32880 this.applyEmptyText(); 32881 this.fireEvent("rowremoved", this, c, a) 32882 } 32883 }, 32884 onLoad : function() { 32885 if (Ext.isGecko) { 32886 if (!this.scrollToTopTask) { 32887 this.scrollToTopTask = new Ext.util.DelayedTask( 32888 this.scrollToTop, this) 32889 } 32890 this.scrollToTopTask.delay(1) 32891 } else { 32892 this.scrollToTop() 32893 } 32894 }, 32895 onColWidthChange : function(a, b, c) { 32896 this.updateColumnWidth(b, c) 32897 }, 32898 onHeaderChange : function(a, b, c) { 32899 this.updateHeaders() 32900 }, 32901 onHiddenChange : function(a, b, c) { 32902 this.updateColumnHidden(b, c) 32903 }, 32904 onColumnMove : function(a, c, b) { 32905 this.indexMap = null; 32906 this.refresh(true); 32907 this.restoreScroll(this.getScrollState()); 32908 this.afterMove(b); 32909 this.grid.fireEvent("columnmove", c, b) 32910 }, 32911 onColConfigChange : function() { 32912 delete this.lastViewWidth; 32913 this.indexMap = null; 32914 this.refresh(true) 32915 }, 32916 initUI : function(a) { 32917 a.on("headerclick", this.onHeaderClick, this) 32918 }, 32919 initEvents : Ext.emptyFn, 32920 onHeaderClick : function(b, a) { 32921 if (this.headersDisabled || !this.cm.isSortable(a)) { 32922 return 32923 } 32924 b.stopEditing(true); 32925 b.store.sort(this.cm.getDataIndex(a)) 32926 }, 32927 onRowOver : function(b, a) { 32928 var c = this.findRowIndex(a); 32929 if (c !== false) { 32930 this.addRowClass(c, this.rowOverCls) 32931 } 32932 }, 32933 onRowOut : function(b, a) { 32934 var c = this.findRowIndex(a); 32935 if (c !== false && !b.within(this.getRow(c), true)) { 32936 this.removeRowClass(c, this.rowOverCls) 32937 } 32938 }, 32939 onRowSelect : function(a) { 32940 this.addRowClass(a, this.selectedRowClass) 32941 }, 32942 onRowDeselect : function(a) { 32943 this.removeRowClass(a, this.selectedRowClass) 32944 }, 32945 onCellSelect : function(c, b) { 32946 var a = this.getCell(c, b); 32947 if (a) { 32948 this.fly(a).addClass("x-grid3-cell-selected") 32949 } 32950 }, 32951 onCellDeselect : function(c, b) { 32952 var a = this.getCell(c, b); 32953 if (a) { 32954 this.fly(a).removeClass("x-grid3-cell-selected") 32955 } 32956 }, 32957 handleWheel : function(a) { 32958 a.stopPropagation() 32959 }, 32960 onColumnSplitterMoved : function(a, b) { 32961 this.userResized = true; 32962 this.grid.colModel.setColumnWidth(a, b, true); 32963 if (this.forceFit) { 32964 this.fitColumns(true, false, a); 32965 this.updateAllColumnWidths() 32966 } else { 32967 this.updateColumnWidth(a, b); 32968 this.syncHeaderScroll() 32969 } 32970 this.grid.fireEvent("columnresize", a, b) 32971 }, 32972 beforeColMenuShow : function() { 32973 var b = this.cm, d = b.getColumnCount(), a = this.colMenu, c; 32974 a.removeAll(); 32975 for (c = 0; c < d; c++) { 32976 if (b.config[c].hideable !== false) { 32977 a.add(new Ext.menu.CheckItem({ 32978 text : b.getColumnHeader(c), 32979 itemId : "col-" + b.getColumnId(c), 32980 checked : !b.isHidden(c), 32981 disabled : b.config[c].hideable === false, 32982 hideOnClick : false 32983 })) 32984 } 32985 } 32986 }, 32987 handleHdMenuClick : function(c) { 32988 var a = this.ds, b = this.cm.getDataIndex(this.hdCtxIndex); 32989 switch (c.getItemId()) { 32990 case "asc" : 32991 a.sort(b, "ASC"); 32992 break; 32993 case "desc" : 32994 a.sort(b, "DESC"); 32995 break; 32996 default : 32997 this.handleHdMenuClickDefault(c) 32998 } 32999 return true 33000 }, 33001 handleHdMenuClickDefault : function(c) { 33002 var b = this.cm, d = c.getItemId(), a = b.getIndexById(d.substr(4)); 33003 if (a != -1) { 33004 if (c.checked 33005 && b.getColumnsBy(this.isHideableColumn, this).length <= 1) { 33006 this.onDenyColumnHide(); 33007 return 33008 } 33009 b.setHidden(a, c.checked) 33010 } 33011 }, 33012 handleHdDown : function(i, j) { 33013 if (Ext.fly(j).hasClass("x-grid3-hd-btn")) { 33014 i.stopEvent(); 33015 var k = this.cm, g = this.findHeaderCell(j), h = this 33016 .getCellIndex(g), d = k.isSortable(h), c = this.hmenu, b = c.items, a = this.headerMenuOpenCls; 33017 this.hdCtxIndex = h; 33018 Ext.fly(g).addClass(a); 33019 b.get("asc").setDisabled(!d); 33020 b.get("desc").setDisabled(!d); 33021 c.on("hide", function() { 33022 Ext.fly(g).removeClass(a) 33023 }, this, { 33024 single : true 33025 });
33026 c.show(j, "tl-bl?") 33027 } 33028 }, 33029 handleHdMove : function(k) { 33030 var i = this.findHeaderCell(this.activeHdRef); 33031 if (i && !this.headersDisabled) { 33032 var l = this.splitHandleWidth || 5, j = this.activeHdRegion, p = i.style, m = this.cm, o = "", g = k 33033 .getPageX(); 33034 if (this.grid.enableColumnResize !== false) { 33035 var a = this.activeHdIndex, b = this.getPreviousVisible(a), n = m 33036 .isResizable(a), c = b && m.isResizable(b), d = g 33037 - j.left <= l, h = j.right - g <= (!this.activeHdBtn 33038 ? l 33039 : 2); 33040 if (d && c) { 33041 o = Ext.isAir ? "move" : Ext.isWebKit 33042 ? "e-resize" 33043 : "col-resize" 33044 } else { 33045 if (h && n) { 33046 o = Ext.isAir ? "move" : Ext.isWebKit 33047 ? "w-resize" 33048 : "col-resize" 33049 } 33050 } 33051 } 33052 p.cursor = o 33053 } 33054 }, 33055 getPreviousVisible : function(a) { 33056 while (a > 0) { 33057 if (!this.cm.isHidden(a - 1)) { 33058 return a 33059 } 33060 a-- 33061 } 33062 return undefined 33063 }, 33064 handleHdOver : function(c, b) { 33065 var d = this.findHeaderCell(b); 33066 if (d && !this.headersDisabled) { 33067 var a = this.fly(d); 33068 this.activeHdRef = b; 33069 this.activeHdIndex = this.getCellIndex(d); 33070 this.activeHdRegion = a.getRegion(); 33071 if (!this.isMenuDisabled(this.activeHdIndex, a)) { 33072 a.addClass("x-grid3-hd-over"); 33073 this.activeHdBtn = a.child(".x-grid3-hd-btn"); 33074 if (this.activeHdBtn) { 33075 this.activeHdBtn.dom.style.height = (d.firstChild.offsetHeight - 1) 33076 + "px" 33077 } 33078 } 33079 } 33080 }, 33081 handleHdOut : function(b, a) { 33082 var c = this.findHeaderCell(a); 33083 if (c && (!Ext.isIE || !b.within(c, true))) { 33084 this.activeHdRef = null; 33085 this.fly(c).removeClass("x-grid3-hd-over"); 33086 c.style.cursor = "" 33087 } 33088 }, 33089 isMenuDisabled : function(a, b) { 33090 return this.cm.isMenuDisabled(a) 33091 }, 33092 hasRows : function() { 33093 var a = this.mainBody.dom.firstChild; 33094 return a && a.nodeType == 1 && a.className != "x-grid-empty" 33095 }, 33096 isHideableColumn : function(a) { 33097 return !a.hidden 33098 }, 33099 bind : function(a, b) { 33100 this.initData(a, b) 33101 } 33102}); 33103Ext.grid.GridView.SplitDragZone = Ext.extend(Ext.dd.DDProxy, { 33104 constructor : function(a, b) { 33105 this.grid = a; 33106 this.view = a.getView(); 33107 this.marker = this.view.resizeMarker; 33108 this.proxy = this.view.resizeProxy; 33109 Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, b, 33110 "gridSplitters" + this.grid.getGridEl().id, { 33111 dragElId : Ext.id(this.proxy.dom), 33112 resizeFrame : false 33113 }); 33114 this.scroll = false; 33115 this.hw = this.view.splitHandleWidth || 5 33116 }, 33117 b4StartDrag : function(a, e) { 33118 this.dragHeadersDisabled = this.view.headersDisabled; 33119 this.view.headersDisabled = true; 33120 var d = this.view.mainWrap.getHeight(); 33121 this.marker.setHeight(d); 33122 this.marker.show(); 33123 this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), "tl-tl", [ 33124 -2, 0]); 33125 this.proxy.setHeight(d); 33126 var b = this.cm.getColumnWidth(this.cellIndex), c = Math.max(b 33127 - this.grid.minColumnWidth, 0); 33128 this.resetConstraints(); 33129 this.setXConstraint(c, 1000); 33130 this.setYConstraint(0, 0); 33131 this.minX = a - c; 33132 this.maxX = a + 1000; 33133 this.startPos = a; 33134 Ext.dd.DDProxy.prototype.b4StartDrag.call(this, a, e) 33135 }, 33136 allowHeaderDrag : function(a) { 33137 return true 33138 }, 33139 handleMouseDown : function(a) { 33140 var h = this.view.findHeaderCell(a.getTarget()); 33141 if (h && this.allowHeaderDrag(a)) { 33142 var k = this.view.fly(h).getXY(), c = k[0], i = a.getXY(), b = i[0], g = h.offsetWidth, d = false; 33143 if ((b - c) <= this.hw) { 33144 d = -1 33145 } else { 33146 if ((c + g) - b <= this.hw) { 33147 d = 0 33148 } 33149 } 33150 if (d !== false) { 33151 this.cm = this.grid.colModel; 33152 var j = this.view.getCellIndex(h); 33153 if (d == -1) { 33154 if (j + d < 0) { 33155 return 33156 } 33157 while (this.cm.isHidden(j + d)) { 33158 --d; 33159 if (j + d < 0) { 33160 return 33161 } 33162 } 33163 } 33164 this.cellIndex = j + d; 33165 this.split = h.dom; 33166 if (this.cm.isResizable(this.cellIndex) 33167 && !this.cm.isFixed(this.cellIndex)) { 33168 Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown 33169 .apply(this, arguments) 33170 } 33171 } else { 33172 if (this.view.columnDrag) { 33173 this.view.columnDrag.callHandleMouseDown(a) 33174 } 33175 } 33176 } 33177 }, 33178 endDrag : function(g) { 33179 this.marker.hide(); 33180 var a = this.view, c = Math.max(this.minX, g.getPageX()), d = c 33181 - this.startPos, b = this.dragHeadersDisabled; 33182 a.onColumnSplitterMoved(this.cellIndex, this.cm
33183 .getColumnWidth(this.cellIndex) 33184 + d); 33185 setTimeout(function() { 33186 a.headersDisabled = b 33187 }, 50) 33188 }, 33189 autoOffset : function() { 33190 this.setDelta(0, 0) 33191 } 33192}); 33193 33194Ext.grid.HeaderDragZone = Ext.extend(Ext.dd.DragZone, { 33195 maxDragWidth : 120, 33196 constructor : function(a, c, b) { 33197 this.grid = a; 33198 this.view = a.getView(); 33199 this.ddGroup = "gridHeader" + this.grid.getGridEl().id; 33200 Ext.grid.HeaderDragZone.superclass.constructor.call(this, c); 33201 if (b) { 33202 this.setHandleElId(Ext.id(c)); 33203 this.setOuterHandleElId(Ext.id(b)) 33204 } 33205 this.scroll = false 33206 }, 33207 getDragData : function(c) { 33208 var a = Ext.lib.Event.getTarget(c), b = this.view 33209 .findHeaderCell(a); 33210 if (b) { 33211 return { 33212 ddel : b.firstChild, 33213 header : b 33214 } 33215 } 33216 return false 33217 }, 33218 onInitDrag : function(a) { 33219 this.dragHeadersDisabled = this.view.headersDisabled; 33220 this.view.headersDisabled = true; 33221 var b = this.dragData.ddel.cloneNode(true); 33222 b.id = Ext.id(); 33223 b.style.width = Math.min(this.dragData.header.offsetWidth, 33224 this.maxDragWidth) 33225 + "px"; 33226 this.proxy.update(b); 33227 return true 33228 }, 33229 afterValidDrop : function() { 33230 this.completeDrop() 33231 }, 33232 afterInvalidDrop : function() { 33233 this.completeDrop() 33234 }, 33235 completeDrop : function() { 33236 var a = this.view, b = this.dragHeadersDisabled; 33237 setTimeout(function() { 33238 a.headersDisabled = b 33239 }, 50) 33240 } 33241 }); 33242Ext.grid.HeaderDropZone = Ext.extend(Ext.dd.DropZone, { 33243 proxyOffsets : [-4, -9], 33244 fly : Ext.Element.fly, 33245 constructor : function(a, c, b) { 33246 this.grid = a; 33247 this.view = a.getView(); 33248 this.proxyTop = Ext.DomHelper.append(document.body, { 33249 cls : "col-move-top", 33250 html : " " 33251 }, true); 33252 this.proxyBottom = Ext.DomHelper.append(document.body, { 33253 cls : "col-move-bottom", 33254 html : " " 33255 }, true); 33256 this.proxyTop.hide = this.proxyBottom.hide = function() { 33257 this.setLeftTop(-100, -100); 33258 this.setStyle("visibility", "hidden") 33259 }; 33260 this.ddGroup = "gridHeader" + this.grid.getGridEl().id; 33261 Ext.grid.HeaderDropZone.superclass.constructor.call(this, 33262 a.getGridEl().dom) 33263 }, 33264 getTargetFromEvent : function(c) { 33265 var a = Ext.lib.Event.getTarget(c), b = this.view.findCellIndex(a); 33266 if (b !== false) { 33267 return this.view.getHeaderCell(b) 33268 } 33269 }, 33270 nextVisible : function(c) { 33271 var b = this.view, a = this.grid.colModel; 33272 c = c.nextSibling; 33273 while (c) { 33274 if (!a.isHidden(b.getCellIndex(c))) { 33275 return c 33276 } 33277 c = c.nextSibling 33278 } 33279 return null 33280 }, 33281 prevVisible : function(c) { 33282 var b = this.view, a = this.grid.colModel; 33283 c = c.prevSibling; 33284 while (c) { 33285 if (!a.isHidden(b.getCellIndex(c))) { 33286 return c 33287 } 33288 c = c.prevSibling 33289 } 33290 return null 33291 }, 33292 positionIndicator : function(d, k, j) { 33293 var a = Ext.lib.Event.getPageX(j), g = Ext.lib.Dom 33294 .getRegion(k.firstChild), c, i, b = g.top 33295 + this.proxyOffsets[1]; 33296 if ((g.right - a) <= (g.right - g.left) / 2) { 33297 c = g.right + this.view.borderWidth; 33298 i = "after" 33299 } else { 33300 c = g.left; 33301 i = "before" 33302 } 33303 if (this.grid.colModel.isFixed(this.view.getCellIndex(k))) { 33304 return false 33305 } 33306 c += this.proxyOffsets[0]; 33307 this.proxyTop.setLeftTop(c, b); 33308 this.proxyTop.show(); 33309 if (!this.bottomOffset) { 33310 this.bottomOffset = this.view.mainHd.getHeight() 33311 } 33312 this.proxyBottom.setLeftTop(c, b + this.proxyTop.dom.offsetHeight 33313 + this.bottomOffset); 33314 this.proxyBottom.show(); 33315 return i 33316 }, 33317 onNodeEnter : function(d, a, c, b) { 33318 if (b.header != d) { 33319 this.positionIndicator(b.header, d, c) 33320 } 33321 }, 33322 onNodeOver : function(g, b, d, c) { 33323 var a = false; 33324 if (c.header != g) { 33325 a = this.positionIndicator(c.header, g, d) 33326 } 33327 if (!a) { 33328 this.proxyTop.hide(); 33329 this.proxyBottom.hide() 33330 } 33331 return a ? this.dropAllowed : this.dropNotAllowed 33332 }, 33333 onNodeOut : function(d, a, c, b) { 33334 this.proxyTop.hide(); 33335 this.proxyBottom.hide() 33336 }, 33337 onNodeDrop : function(b, m, g, c) { 33338 var d = c.header; 33339 if (d != b) { 33340 var k = this.grid.colModel, j = Ext.lib.Event.getPageX(g), a = Ext.lib.Dom 33341 .getRegion(b.firstChild), o = (a.right - j) <= ((a.right - a.left) / 2) 33342 ? "after" 33343 : "before", i = this.view.getCellIndex(d), l = this.view 33344 .getCellIndex(b); 33345 if (o == "after") {
33346 l++ 33347 } 33348 if (i < l) { 33349 l-- 33350 } 33351 k.moveColumn(i, l); 33352 return true 33353 } 33354 return false 33355 } 33356}); 33357Ext.grid.GridView.ColumnDragZone = Ext.extend(Ext.grid.HeaderDragZone, { 33358 constructor : function(a, b) { 33359 Ext.grid.GridView.ColumnDragZone.superclass.constructor.call( 33360 this, a, b, null); 33361 this.proxy.el.addClass("x-grid3-col-dd") 33362 }, 33363 handleMouseDown : function(a) { 33364 }, 33365 callHandleMouseDown : function(a) { 33366 Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown 33367 .call(this, a) 33368 } 33369 }); 33370Ext.grid.SplitDragZone = Ext.extend(Ext.dd.DDProxy, { 33371 fly : Ext.Element.fly, 33372 constructor : function(a, c, b) { 33373 this.grid = a; 33374 this.view = a.getView(); 33375 this.proxy = this.view.resizeProxy; 33376 Ext.grid.SplitDragZone.superclass.constructor.call(this, c, 33377 "gridSplitters" + this.grid.getGridEl().id, { 33378 dragElId : Ext.id(this.proxy.dom), 33379 resizeFrame : false 33380 }); 33381 this.setHandleElId(Ext.id(c)); 33382 this.setOuterHandleElId(Ext.id(b)); 33383 this.scroll = false 33384 }, 33385 b4StartDrag : function(a, d) { 33386 this.view.headersDisabled = true; 33387 this.proxy.setHeight(this.view.mainWrap.getHeight()); 33388 var b = this.cm.getColumnWidth(this.cellIndex); 33389 var c = Math.max(b - this.grid.minColumnWidth, 0); 33390 this.resetConstraints(); 33391 this.setXConstraint(c, 1000); 33392 this.setYConstraint(0, 0); 33393 this.minX = a - c; 33394 this.maxX = a + 1000; 33395 this.startPos = a; 33396 Ext.dd.DDProxy.prototype.b4StartDrag.call(this, a, d) 33397 }, 33398 handleMouseDown : function(c) { 33399 var b = Ext.EventObject.setEvent(c); 33400 var a = this.fly(b.getTarget()); 33401 if (a.hasClass("x-grid-split")) { 33402 this.cellIndex = this.view.getCellIndex(a.dom); 33403 this.split = a.dom; 33404 this.cm = this.grid.colModel; 33405 if (this.cm.isResizable(this.cellIndex) 33406 && !this.cm.isFixed(this.cellIndex)) { 33407 Ext.grid.SplitDragZone.superclass.handleMouseDown 33408 .apply(this, arguments) 33409 } 33410 } 33411 }, 33412 endDrag : function(c) { 33413 this.view.headersDisabled = false; 33414 var a = Math.max(this.minX, Ext.lib.Event.getPageX(c)); 33415 var b = a - this.startPos; 33416 this.view.onColumnSplitterMoved(this.cellIndex, this.cm 33417 .getColumnWidth(this.cellIndex) 33418 + b) 33419 }, 33420 autoOffset : function() { 33421 this.setDelta(0, 0) 33422 } 33423 }); 33424Ext.grid.GridDragZone = function(b, a) { 33425 this.view = b.getView(); 33426 Ext.grid.GridDragZone.superclass.constructor.call(this, 33427 this.view.mainBody.dom, a); 33428 this.scroll = false; 33429 this.grid = b; 33430 this.ddel = document.createElement("div"); 33431 this.ddel.className = "x-grid-dd-wrap" 33432}; 33433Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, { 33434 ddGroup : "GridDD", 33435 getDragData : function(b) { 33436 var a = Ext.lib.Event.getTarget(b); 33437 var d = this.view.findRowIndex(a); 33438 if (d !== false) { 33439 var c = this.grid.selModel; 33440 if (!c.isSelected(d) || b.hasModifier()) { 33441 c.handleMouseDown(this.grid, d, b) 33442 } 33443 return { 33444 grid : this.grid, 33445 ddel : this.ddel, 33446 rowIndex : d, 33447 selections : c.getSelections() 33448 } 33449 } 33450 return false 33451 }, 33452 onInitDrag : function(b) { 33453 var a = this.dragData; 33454 this.ddel.innerHTML = this.grid.getDragDropText(); 33455 this.proxy.update(this.ddel) 33456 }, 33457 afterRepair : function() { 33458 this.dragging = false 33459 }, 33460 getRepairXY : function(b, a) { 33461 return false 33462 }, 33463 onEndDrag : function(a, b) { 33464 }, 33465 onValidDrop : function(a, b, c) { 33466 this.hideProxy() 33467 }, 33468 beforeInvalidDrop : function(a, b) { 33469 } 33470 }); 33471Ext.grid.ColumnModel = Ext.extend(Ext.util.Observable, { 33472 defaultWidth : 100, 33473 defaultSortable : false, 33474 constructor : function(a) { 33475 if (a.columns) { 33476 Ext.apply(this, a); 33477 this.setConfig(a.columns, true) 33478 } else { 33479 this.setConfig(a, true) 33480 } 33481 this.addEvents("widthchange", "headerchange", "hiddenchange", 33482 "columnmoved", "configchange"); 33483 Ext.grid.ColumnModel.superclass.constructor.call(this) 33484 }, 33485 getColumnId : function(a) { 33486 return this.config[a].id 33487 }, 33488 getColumnAt : function(a) { 33489 return this.config[a] 33490 }, 33491 setConfig : function(d, b) { 33492 var e, h, a; 33493 if (!b) { 33494 delete this.totalWidth; 33495 for (e = 0, a = this.config.length; e < a; e++) { 33496 h = this.config[e]; 33497 if (h.setEditor) { 33498 h.setEditor(null) 33499 } 33500 } 33501 } 33502 this.defaults = Ext.apply({
33503 width : this.defaultWidth, 33504 sortable : this.defaultSortable 33505 }, this.defaults); 33506 this.config = d; 33507 this.lookup = {}; 33508 for (e = 0, a = d.length; e < a; e++) { 33509 h = Ext.applyIf(d[e], this.defaults); 33510 if (Ext.isEmpty(h.id)) { 33511 h.id = e 33512 } 33513 if (!h.isColumn) { 33514 var g = Ext.grid.Column.types[h.xtype || "gridcolumn"]; 33515 h = new g(h); 33516 d[e] = h 33517 } 33518 this.lookup[h.id] = h 33519 } 33520 if (!b) { 33521 this.fireEvent("configchange", this) 33522 } 33523 }, 33524 getColumnById : function(a) { 33525 return this.lookup[a] 33526 }, 33527 getIndexById : function(c) { 33528 for (var b = 0, a = this.config.length; b < a; b++) { 33529 if (this.config[b].id == c) { 33530 return b 33531 } 33532 } 33533 return -1 33534 }, 33535 moveColumn : function(e, b) { 33536 var a = this.config, d = a[e]; 33537 a.splice(e, 1); 33538 a.splice(b, 0, d); 33539 this.dataMap = null; 33540 this.fireEvent("columnmoved", this, e, b) 33541 }, 33542 getColumnCount : function(b) { 33543 var d = this.config.length, e = 0, a; 33544 if (b === true) { 33545 for (a = 0; a < d; a++) { 33546 if (!this.isHidden(a)) { 33547 e++ 33548 } 33549 } 33550 return e 33551 } 33552 return d 33553 }, 33554 getColumnsBy : function(g, e) { 33555 var b = this.config, h = b.length, a = [], d, j; 33556 for (d = 0; d < h; d++) { 33557 j = b[d]; 33558 if (g.call(e || this, j, d) === true) { 33559 a[a.length] = j 33560 } 33561 } 33562 return a 33563 }, 33564 isSortable : function(a) { 33565 return !!this.config[a].sortable 33566 }, 33567 isMenuDisabled : function(a) { 33568 return !!this.config[a].menuDisabled 33569 }, 33570 getRenderer : function(a) { 33571 return this.config[a].renderer 33572 || Ext.grid.ColumnModel.defaultRenderer 33573 }, 33574 getRendererScope : function(a) { 33575 return this.config[a].scope 33576 }, 33577 setRenderer : function(a, b) { 33578 this.config[a].renderer = b 33579 }, 33580 getColumnWidth : function(a) { 33581 var b = this.config[a].width; 33582 if (typeof b != "number") { 33583 b = this.defaultWidth 33584 } 33585 return b 33586 }, 33587 setColumnWidth : function(b, c, a) { 33588 this.config[b].width = c; 33589 this.totalWidth = null; 33590 if (!a) { 33591 this.fireEvent("widthchange", this, b, c) 33592 } 33593 }, 33594 getTotalWidth : function(b) { 33595 if (!this.totalWidth) { 33596 this.totalWidth = 0; 33597 for (var c = 0, a = this.config.length; c < a; c++) { 33598 if (b || !this.isHidden(c)) { 33599 this.totalWidth += this.getColumnWidth(c) 33600 } 33601 } 33602 } 33603 return this.totalWidth 33604 }, 33605 getColumnHeader : function(a) { 33606 return this.config[a].header 33607 }, 33608 setColumnHeader : function(a, b) { 33609 this.config[a].header = b; 33610 this.fireEvent("headerchange", this, a, b) 33611 }, 33612 getColumnTooltip : function(a) { 33613 return this.config[a].tooltip 33614 }, 33615 setColumnTooltip : function(a, b) { 33616 this.config[a].tooltip = b 33617 }, 33618 getDataIndex : function(a) { 33619 return this.config[a].dataIndex 33620 }, 33621 setDataIndex : function(a, b) { 33622 this.config[a].dataIndex = b 33623 }, 33624 findColumnIndex : function(d) { 33625 var e = this.config; 33626 for (var b = 0, a = e.length; b < a; b++) { 33627 if (e[b].dataIndex == d) { 33628 return b 33629 } 33630 } 33631 return -1 33632 }, 33633 isCellEditable : function(b, e) { 33634 var d = this.config[b], a = d.editable; 33635 return !!(a || (!Ext.isDefined(a) && d.editor)) 33636 }, 33637 getCellEditor : function(a, b) { 33638 return this.config[a].getCellEditor(b) 33639 }, 33640 setEditable : function(a, b) { 33641 this.config[a].editable = b 33642 }, 33643 isHidden : function(a) { 33644 return !!this.config[a].hidden 33645 }, 33646 isFixed : function(a) { 33647 return !!this.config[a].fixed 33648 }, 33649 isResizable : function(a) { 33650 return a >= 0 && this.config[a].resizable !== false 33651 && this.config[a].fixed !== true 33652 }, 33653 setHidden : function(a, b) { 33654 var d = this.config[a]; 33655 if (d.hidden !== b) { 33656 d.hidden = b; 33657 this.totalWidth = null; 33658 this.fireEvent("hiddenchange", this, a, b) 33659 } 33660 }, 33661 setEditor : function(a, b) { 33662 this.config[a].setEditor(b) 33663 }, 33664 destroy : function() { 33665 var b = this.config.length, a = 0; 33666 for (; a < b; a++) { 33667 this.config[a].destroy() 33668 } 33669 delete this.config; 33670 delete this.lookup; 33671 this.purgeListeners() 33672 }, 33673 setState : function(a, b) { 33674 b = Ext.applyIf(b, this.defaults); 33675 Ext.apply(this.config[a], b) 33676 } 33677 }); 33678Ext.grid.ColumnModel.defaultRenderer = function(a) { 33679 if (typeof a == "string" && a.length < 1) { 33680 return " " 33681 } 33682 return a 33683}; 33684Ext.grid.AbstractSelectionModel = Ext.extend(Ext.util.Observable, { 33685 constructor : function() { 33686 this.locked = false; 33687 Ext.grid.AbstractSelectionModel.superclass.constructor 33688 .call(this) 33689 }, 33690 init : function(a) { 33691 this.grid = a; 33692 if (this.lockOnInit) { 33693 delete this.lockOnInit; 33694 this.locked = false; 33695 this.lock() 33696 } 33697 this.initEvents() 33698 }, 33699 lock : function() { 33700 if (!this.locked) { 33701 this.locked = true; 33702 var a = this.grid; 33703 if (a) { 33704 a.getView().on({ 33705 scope : this, 33706 beforerefresh : this.sortUnLock, 33707 refresh : this.sortLock 33708 }) 33709 } else { 33710 this.lockOnInit = true 33711 } 33712 } 33713 }, 33714 sortLock : function() { 33715 this.locked = true 33716 }, 33717 sortUnLock : function() { 33718 this.locked = false 33719 }, 33720 unlock : function() { 33721 if (this.locked) { 33722 this.locked = false; 33723 var a = this.grid, b; 33724 if (a) { 33725 b = a.getView(); 33726 b.un("beforerefresh", this.sortUnLock, this); 33727 b.un("refresh", this.sortLock, this) 33728 } else { 33729 delete this.lockOnInit 33730 } 33731 } 33732 }, 33733 isLocked : function() { 33734 return this.locked 33735 }, 33736 destroy : function() { 33737 this.unlock(); 33738 this.purgeListeners() 33739 } 33740 }); 33741Ext.grid.RowSelectionModel = Ext.extend(Ext.grid.AbstractSelectionModel, { 33742 singleSelect : false, 33743 constructor : function(a) { 33744 Ext.apply(this, a); 33745 this.selections = new Ext.util.MixedCollection(false, function(b) { 33746 return b.id 33747 }); 33748 this.last = false; 33749 this.lastActive = false; 33750 this.addEvents("selectionchange", "beforerowselect", "rowselect", 33751 "rowdeselect"); 33752 Ext.grid.RowSelectionModel.superclass.constructor.call(this) 33753 }, 33754 initEvents : function() { 33755 if (!this.grid.enableDragDrop && !this.grid.enableDrag) { 33756 this.grid.on("rowmousedown", this.handleMouseDown, this) 33757 } 33758 this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), { 33759 up : this.onKeyPress, 33760 down : this.onKeyPress, 33761 enter : this.onEnter, 33762 scope : this 33763 }); 33764 this.grid.getView().on({ 33765 scope : this, 33766 refresh : this.onRefresh, 33767 rowupdated : this.onRowUpdated, 33768 rowremoved : this.onRemove 33769 }) 33770 }, 33771 onEnter : function(g, b) { 33772 /* 33773 * ch197cm 07.13 ì¹ ì ê·¼ì±ì ê³ ë ¤íì¬ tabindex ì¶ê° 33774 */ 33775 var t = Ext.lib.Event.getTarget(g); 33776 if (t.onclick) { 33777 t.onclick.call(); 33778 } else { 33779 this.handleMouseDown('enter', -1, g); 33780 } 33781 }, 33782 onKeyPress : function(g, b) { 33783 var a = b == "up", h = a ? "selectPrevious" : "selectNext", d = a 33784 ? -1 33785 : 1, c; 33786 if (!g.shiftKey || this.singleSelect) { 33787 this[h](false) 33788 } else { 33789 if (this.last !== false && this.lastActive !== false) { 33790 c = this.last; 33791 this.selectRange(this.last, this.lastActive + d); 33792 this.grid.getView().focusRow(this.lastActive); 33793 if (c !== false) { 33794 this.last = c 33795 } 33796 } else { 33797 this.selectFirstRow() 33798 } 33799 } 33800 }, 33801 onRefresh : function() {
33802 var g = this.grid.store, d = this.getSelections(), c = 0, a = d.length, b, e; 33803 this.silent = true; 33804 this.clearSelections(true); 33805 for (; c < a; c++) { 33806 e = d[c]; 33807 if ((b = g.indexOfId(e.id)) != -1) { 33808 this.selectRow(b, true) 33809 } 33810 } 33811 if (d.length != this.selections.getCount()) { 33812 this.fireEvent("selectionchange", this) 33813 } 33814 this.silent = false 33815 }, 33816 onRemove : function(a, b, c) { 33817 if (this.selections.remove(c) !== false) { 33818 this.fireEvent("selectionchange", this) 33819 } 33820 }, 33821 onRowUpdated : function(a, b, c) { 33822 if (this.isSelected(c)) { 33823 a.onRowSelect(b) 33824 } 33825 }, 33826 selectRecords : function(b, e) { 33827 if (!e) { 33828 this.clearSelections() 33829 } 33830 var d = this.grid.store, c = 0, a = b.length; 33831 for (; c < a; c++) { 33832 this.selectRow(d.indexOf(b[c]), true) 33833 } 33834 }, 33835 getCount : function() { 33836 return this.selections.length 33837 }, 33838 selectFirstRow : function() { 33839 this.selectRow(0) 33840 }, 33841 selectLastRow : function(a) { 33842 this.selectRow(this.grid.store.getCount() - 1, a) 33843 }, 33844 selectNext : function(a) { 33845 if (this.hasNext()) { 33846 this.selectRow(this.last + 1, a); 33847 this.grid.getView().focusRow(this.last); 33848 return true 33849 } 33850 return false 33851 }, 33852 selectPrevious : function(a) { 33853 if (this.hasPrevious()) { 33854 this.selectRow(this.last - 1, a); 33855 this.grid.getView().focusRow(this.last); 33856 return true 33857 } 33858 return false 33859 }, 33860 hasNext : function() { 33861 return this.last !== false 33862 && (this.last + 1) < this.grid.store.getCount() 33863 }, 33864 hasPrevious : function() { 33865 return !!this.last 33866 }, 33867 getSelections : function() { 33868 return [].concat(this.selections.items) 33869 }, 33870 getSelected : function() { 33871 return this.selections.itemAt(0) 33872 }, 33873 each : function(e, d) { 33874 var c = this.getSelections(), b = 0, a = c.length; 33875 for (; b < a; b++) { 33876 if (e.call(d || this, c[b], b) === false) { 33877 return false 33878 } 33879 } 33880 return true 33881 }, 33882 clearSelections : function(a) { 33883 if (this.isLocked()) { 33884 return 33885 } 33886 if (a !== true) { 33887 var c = this.grid.store, b = this.selections; 33888 b.each(function(d) { 33889 this.deselectRow(c.indexOfId(d.id)) 33890 }, this); 33891 b.clear() 33892 } else { 33893 this.selections.clear() 33894 } 33895 this.last = false 33896 }, 33897 selectAll : function() { 33898 if (this.isLocked()) { 33899 return 33900 } 33901 this.selections.clear(); 33902 for (var b = 0, a = this.grid.store.getCount(); b < a; b++) { 33903 this.selectRow(b, true) 33904 } 33905 }, 33906 hasSelection : function() { 33907 return this.selections.length > 0 33908 }, 33909 isSelected : function(a) { 33910 var b = Ext.isNumber(a) ? this.grid.store.getAt(a) : a; 33911 return (b && this.selections.key(b.id) ? true : false) 33912 }, 33913 isIdSelected : function(a) { 33914 return (this.selections.key(a) ? true : false) 33915 }, 33916 handleMouseDown : function(d, i, h) { 33917 if (h.button !== 0 || this.isLocked()) { 33918 return 33919 } 33920 var a = this.grid.getView(); 33921 if (h.shiftKey && !this.singleSelect && this.last !== false) { 33922 var c = this.last; 33923 this.selectRange(c, i, h.ctrlKey); 33924 this.last = c; 33925 a.focusRow(i) 33926 } else { 33927 var b = this.isSelected(i); 33928 if (h.ctrlKey && b) { 33929 this.deselectRow(i) 33930 } else { 33931 if (!b || this.getCount() > 1) { 33932 this.selectRow(i, h.ctrlKey || h.shiftKey); 33933 a.focusRow(i) 33934 } 33935 } 33936 } 33937 }, 33938 selectRows : function(c, d) { 33939 if (!d) { 33940 this.clearSelections() 33941 } 33942 for (var b = 0, a = c.length; b < a; b++) { 33943 this.selectRow(c[b], true) 33944 } 33945 }, 33946 selectRange : function(b, a, d) { 33947 var c; 33948 if (this.isLocked()) { 33949 return 33950 } 33951 if (!d) { 33952 this.clearSelections() 33953 } 33954 if (b <= a) { 33955 for (c = b; c <= a; c++) { 33956 this.selectRow(c, true) 33957 } 33958 } else { 33959 for (c = b; c >= a; c--) { 33960 this.selectRow(c, true) 33961 } 33962 } 33963 }, 33964 deselectRange : function(c, b, a) { 33965 if (this.isLocked()) { 33966 return 33967 } 33968 for (var d = c; d <= b; d++) { 33969 this.deselectRow(d, a) 33970 } 33971 }, 33972 selectRow : function(b, d, a) { 33973 if (this.isLocked() || (b < 0 || b >= this.grid.store.getCount()) 33974 || (d && this.isSelected(b))) { 33975 return 33976 } 33977 var c = this.grid.store.getAt(b); 33978 if (c && this.fireEvent("beforerowselect", this, b, d, c) !== false) { 33979 if (!d || this.singleSelect) { 33980 this.clearSelections() 33981 } 33982 this.selections.add(c); 33983 this.last = this.lastActive = b; 33984 if (!a) { 33985 this.grid.getView().onRowSelect(b) 33986 } 33987 if (!this.silent) { 33988 this.fireEvent("rowselect", this, b, c); 33989 this.fireEvent("selectionchange", this) 33990 } 33991 } 33992 }, 33993 deselectRow : function(b, a) { 33994 if (this.isLocked()) { 33995 return 33996 } 33997 if (this.last == b) { 33998 this.last = false 33999 } 34000 if (this.lastActive == b) { 34001 this.lastActive = false 34002 } 34003 var c = this.grid.store.getAt(b); 34004 if (c) { 34005 this.selections.remove(c); 34006 if (!a) { 34007 this.grid.getView().onRowDeselect(b) 34008 } 34009 this.fireEvent("rowdeselect", this, b, c); 34010 this.fireEvent("selectionchange", this) 34011 } 34012 }, 34013 acceptsNav : function(c, b, a) { 34014 return !a.isHidden(b) && a.isCellEditable(b, c) 34015 }, 34016 onEditorKey : function(n, l) { 34017 var d = l.getKey(), h, i = this.grid, p = i.lastEdit, j = i.activeEditor, b = l.shiftKey, o, p, a, m; 34018 if (d == l.TAB) { 34019 l.stopEvent(); 34020 j.completeEdit(); 34021 if (b) { 34022 h = i.walkCells(j.row, j.col - 1, -1, this.acceptsNav, this) 34023 } else { 34024 h = i.walkCells(j.row, j.col + 1, 1, this.acceptsNav, this) 34025 } 34026 } else { 34027 if (d == l.ENTER) { 34028 if (this.moveEditorOnEnter !== false) { 34029 if (b) { 34030 h = i.walkCells(p.row - 1, p.col, -1, this.acceptsNav, 34031 this) 34032 } else { 34033 h = i.walkCells(p.row + 1, p.col, 1, this.acceptsNav, 34034 this) 34035 } 34036 } 34037 } 34038 } 34039 if (h) { 34040 a = h[0]; 34041 m = h[1]; 34042 this.onEditorSelect(a, p.row); 34043 if (i.isEditor && i.editing) { 34044 o = i.activeEditor; 34045 if (o && o.field.triggerBlur) { 34046 o.field.triggerBlur() 34047 } 34048 } 34049 i.startEditing(a, m) 34050 } 34051 }, 34052 onEditorSelect : function(b, a) { 34053 if (a != b) { 34054 this.selectRow(b) 34055 } 34056 }, 34057 destroy : function() { 34058 Ext.destroy(this.rowNav); 34059 this.rowNav = null; 34060 Ext.grid.RowSelectionModel.superclass.destroy.call(this) 34061 } 34062}); 34063Ext.grid.Column = Ext.extend(Ext.util.Observable, { 34064 isColumn : true,
34065 constructor : function(b) { 34066 Ext.apply(this, b); 34067 if (Ext.isString(this.renderer)) { 34068 this.renderer = Ext.util.Format[this.renderer] 34069 } else { 34070 if (Ext.isObject(this.renderer)) { 34071 this.scope = this.renderer.scope; 34072 this.renderer = this.renderer.fn 34073 } 34074 } 34075 if (!this.scope) { 34076 this.scope = this 34077 } 34078 var a = this.editor; 34079 delete this.editor; 34080 this.setEditor(a); 34081 this.addEvents("click", "contextmenu", "dblclick", "mousedown"); 34082 Ext.grid.Column.superclass.constructor.call(this) 34083 }, 34084 processEvent : function(b, d, c, g, a) { 34085 return this.fireEvent(b, this, c, g, d) 34086 }, 34087 destroy : function() { 34088 if (this.setEditor) { 34089 this.setEditor(null) 34090 } 34091 this.purgeListeners() 34092 }, 34093 renderer : function(a) { 34094 return a 34095 }, 34096 getEditor : function(a) { 34097 return this.editable !== false ? this.editor : null 34098 }, 34099 setEditor : function(b) { 34100 var a = this.editor; 34101 if (a) { 34102 if (a.gridEditor) { 34103 a.gridEditor.destroy(); 34104 delete a.gridEditor 34105 } else { 34106 a.destroy() 34107 } 34108 } 34109 this.editor = null; 34110 if (b) { 34111 if (!b.isXType) { 34112 b = Ext.create(b, "textfield") 34113 } 34114 this.editor = b 34115 } 34116 }, 34117 getCellEditor : function(b) { 34118 var a = this.getEditor(b); 34119 if (a) { 34120 if (!a.startEdit) { 34121 if (!a.gridEditor) { 34122 a.gridEditor = new Ext.grid.GridEditor(a) 34123 } 34124 a = a.gridEditor 34125 } 34126 } 34127 return a 34128 } 34129 }); 34130Ext.grid.BooleanColumn = Ext.extend(Ext.grid.Column, { 34131 trueText : "true", 34132 falseText : "false", 34133 undefinedText : " ", 34134 constructor : function(a) { 34135 Ext.grid.BooleanColumn.superclass.constructor.call(this, a); 34136 var c = this.trueText, d = this.falseText, b = this.undefinedText; 34137 this.renderer = function(e) { 34138 if (e === undefined) { 34139 return b 34140 } 34141 if (!e || e === "false") { 34142 return d 34143 } 34144 return c 34145 } 34146 } 34147 }); 34148Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, { 34149 format : "0,000.00", 34150 constructor : function(a) { 34151 Ext.grid.NumberColumn.superclass.constructor.call(this, a); 34152 this.renderer = Ext.util.Format.numberRenderer(this.format) 34153 } 34154 }); 34155Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, { 34156 format : "m/d/Y", 34157 constructor : function(a) { 34158 Ext.grid.DateColumn.superclass.constructor.call(this, a); 34159 this.renderer = Ext.util.Format.dateRenderer(this.format) 34160 } 34161 }); 34162Ext.grid.TemplateColumn = Ext.extend(Ext.grid.Column, { 34163 constructor : function(a) { 34164 Ext.grid.TemplateColumn.superclass.constructor.call(this, a); 34165 var b = (!Ext.isPrimitive(this.tpl) && this.tpl.compile) 34166 ? this.tpl 34167 : new Ext.XTemplate(this.tpl); 34168 this.renderer = function(d, e, c) { 34169 return b.apply(c.data) 34170 }; 34171 this.tpl = b 34172 } 34173 }); 34174Ext.grid.ActionColumn = Ext.extend(Ext.grid.Column, { 34175 header : " ", 34176 actionIdRe : /x-action-col-(\d+)/, 34177 altText : "", 34178 constructor : function(b) { 34179 var g = this, c = b.items || (g.items = [g]), a = c.length, d, e; 34180 Ext.grid.ActionColumn.superclass.constructor.call(g, b); 34181 g.renderer = function(h, i) { 34182 h = Ext.isFunction(b.renderer) ? b.renderer.apply(this, 34183 arguments) 34184 || "" : ""; 34185 i.css += " x-action-col-cell"; 34186 for (d = 0; d < a; d++) { 34187 e = c[d]; 34188 h += '<img alt="' 34189 + (e.altText || g.altText) 34190 + '" src="' 34191 + (e.icon || Ext.BLANK_IMAGE_URL) 34192 + '" class="x-action-col-icon x-action-col-' 34193 + String(d) 34194 + " " 34195 + (e.iconCls || "") 34196 + " " 34197 + (Ext.isFunction(e.getClass) ? e.getClass 34198 .apply(e.scope || this.scope || this, 34199 arguments) : "") 34200 + '"' 34201 + ((e.tooltip) ? ' ext:qtip="' + e.tooltip 34202 + '"' : "") + " />" 34203 } 34204 return h 34205 } 34206 }, 34207 destroy : function() { 34208 delete this.items; 34209 delete this.renderer; 34210 return Ext.grid.ActionColumn.superclass.destroy.apply(this, 34211 arguments) 34212 }, 34213 processEvent : function(c, i, d, j, b) { 34214 var a = i.getTarget().className.match(this.actionIdRe), h, g; 34215 if (a && (h = this.items[parseInt(a[1], 10)])) { 34216 if (c == "click") { 34217 (g = h.handler || this.handler) 34218 && g.call(h.scope || this.scope || this, d, j, 34219 b, h, i) 34220 } else { 34221 if ((c == "mousedown") && (h.stopSelection !== false)) { 34222 return false 34223 } 34224 } 34225 } 34226 return Ext.grid.ActionColumn.superclass.processEvent.apply( 34227 this, arguments) 34228 } 34229 }); 34230Ext.grid.Column.types = { 34231 gridcolumn : Ext.grid.Column, 34232 booleancolumn : Ext.grid.BooleanColumn, 34233 numbercolumn : Ext.grid.NumberColumn, 34234 datecolumn : Ext.grid.DateColumn, 34235 templatecolumn : Ext.grid.TemplateColumn, 34236 actioncolumn : Ext.grid.ActionColumn 34237}; 34238Ext.grid.RowNumberer = Ext.extend(Object, { 34239 header : "", 34240 width : 23, 34241 sortable : false, 34242 constructor : function(a) { 34243 Ext.apply(this, a); 34244 if (this.rowspan) { 34245 this.renderer = this.renderer.createDelegate(this) 34246 } 34247 }, 34248 fixed : true, 34249 hideable : false, 34250 menuDisabled : true, 34251 dataIndex : "", 34252 id : "numberer", 34253 rowspan : undefined, 34254 renderer : function(b, c, a, d) { 34255 if (this.rowspan) { 34256 c.cellAttr = 'rowspan="' + this.rowspan + '"' 34257 } 34258 return d + 1 34259 } 34260 }); 34261Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, { 34262 header : '<div class="x-grid3-hd-checker"> </div>', 34263 width : 30, 34264 sortable : false, 34265 menuDisabled : true, 34266 fixed : true, 34267 hideable : false, 34268 dataIndex : "", 34269 id : "checker", 34270 isColumn : true,
34271 constructor : function() { 34272 Ext.grid.CheckboxSelectionModel.superclass.constructor.apply( 34273 this, arguments); 34274 if (this.checkOnly) { 34275 this.handleMouseDown = Ext.emptyFn 34276 } 34277 }, 34278 initEvents : function() { 34279 Ext.grid.CheckboxSelectionModel.superclass.initEvents 34280 .call(this); 34281 this.grid.on("render", function() { 34282 Ext.fly(this.grid.getView().innerHd).on( 34283 "mousedown", this.onHdMouseDown, this) 34284 }, this) 34285 }, 34286 processEvent : function(b, d, c, g, a) { 34287 if (b == "mousedown") { 34288 this.onMouseDown(d, d.getTarget()); 34289 return false 34290 } else { 34291 return Ext.grid.Column.prototype.processEvent.apply(this, 34292 arguments) 34293 } 34294 }, 34295 onMouseDown : function(c, b) { 34296 if (c.button === 0 && b.className == "x-grid3-row-checker") { 34297 c.stopEvent(); 34298 var d = c.getTarget(".x-grid3-row"); 34299 if (d) { 34300 var a = d.rowIndex; 34301 if (this.isSelected(a)) { 34302 this.deselectRow(a) 34303 } else { 34304 this.selectRow(a, true); 34305 this.grid.getView().focusRow(a) 34306 } 34307 } 34308 } 34309 }, 34310 onHdMouseDown : function(c, a) { 34311 if (a.className == "x-grid3-hd-checker") { 34312 c.stopEvent(); 34313 var b = Ext.fly(a.parentNode); 34314 var d = b.hasClass("x-grid3-hd-checker-on"); 34315 if (d) { 34316 b.removeClass("x-grid3-hd-checker-on"); 34317 this.clearSelections() 34318 } else { 34319 b.addClass("x-grid3-hd-checker-on"); 34320 this.selectAll() 34321 } 34322 } 34323 }, 34324 renderer : function(b, c, a) { 34325 return '<div class="x-grid3-row-checker"> </div>' 34326 }, 34327 onEditorSelect : function(b, a) { 34328 if (a != b && !this.checkOnly) { 34329 this.selectRow(b) 34330 } 34331 } 34332 }); 34333Ext.grid.CellSelectionModel = Ext.extend(Ext.grid.AbstractSelectionModel, { 34334 constructor : function(a) { 34335 Ext.apply(this, a); 34336 this.selection = null; 34337 this.addEvents("beforecellselect", "cellselect", "selectionchange"); 34338 Ext.grid.CellSelectionModel.superclass.constructor.call(this) 34339 }, 34340 initEvents : function() { 34341 this.grid.on("cellmousedown", this.handleMouseDown, this); 34342 this.grid.on(Ext.EventManager.getKeyEvent(), this.handleKeyDown, this); 34343 this.grid.getView().on({ 34344 scope : this, 34345 refresh : this.onViewChange, 34346 rowupdated : this.onRowUpdated, 34347 beforerowremoved : this.clearSelections, 34348 beforerowsinserted : this.clearSelections 34349 }); 34350 if (this.grid.isEditor) { 34351 this.grid.on("beforeedit", this.beforeEdit, this) 34352 } 34353 }, 34354 beforeEdit : function(a) { 34355 this.select(a.row, a.column, false, true, a.record) 34356 }, 34357 onRowUpdated : function(a, b, c) { 34358 if (this.selection && this.selection.record == c) { 34359 a.onCellSelect(b, this.selection.cell[1]) 34360 } 34361 }, 34362 onViewChange : function() { 34363 this.clearSelections(true) 34364 }, 34365 getSelectedCell : function() { 34366 return this.selection ? this.selection.cell : null 34367 }, 34368 clearSelections : function(b) { 34369 var a = this.selection; 34370 if (a) { 34371 if (b !== true) { 34372 this.grid.view.onCellDeselect(a.cell[0], a.cell[1]) 34373 } 34374 this.selection = null; 34375 this.fireEvent("selectionchange", this, null) 34376 } 34377 }, 34378 hasSelection : function() { 34379 return this.selection ? true : false 34380 }, 34381 handleMouseDown : function(b, d, a, c) { 34382 if (c.button !== 0 || this.isLocked()) { 34383 return 34384 } 34385 this.select(d, a) 34386 }, 34387 select : function(g, c, b, e, d) { 34388 if (this.fireEvent("beforecellselect", this, g, c) !== false) { 34389 this.clearSelections(); 34390 d = d || this.grid.store.getAt(g); 34391 this.selection = { 34392 record : d, 34393 cell : [g, c] 34394 }; 34395 if (!b) { 34396 var a = this.grid.getView(); 34397 a.onCellSelect(g, c); 34398 if (e !== true) { 34399 a.focusCell(g, c) 34400 } 34401 } 34402 this.fireEvent("cellselect", this, g, c); 34403 this.fireEvent("selectionchange", this, this.selection) 34404 } 34405 }, 34406 isSelectable : function(c, b, a) { 34407 return !a.isHidden(b) 34408 }, 34409 onEditorKey : function(b, a) { 34410 if (a.getKey() == a.TAB) { 34411 this.handleKeyDown(a) 34412 } 34413 }, 34414 handleKeyDown : function(j) { 34415 if (!j.isNavKeyPress()) { 34416 return 34417 } 34418 var d = j.getKey(), i = this.grid, p = this.selection, b = this, m = function( 34419 g, c, e) { 34420 return i.walkCells(g, c, e, i.isEditor && i.editing 34421 ? b.acceptsNav 34422 : b.isSelectable, b) 34423 }, o, h, a, l, n; 34424 switch (d) { 34425 case j.ESC : 34426 case j.PAGE_UP : 34427 case j.PAGE_DOWN : 34428 break; 34429 default : 34430 j.stopEvent(); 34431 break 34432 } 34433 if (!p) { 34434 o = m(0, 0, 1); 34435 if (o) { 34436 this.select(o[0], o[1]) 34437 } 34438 return 34439 } 34440 o = p.cell; 34441 a = o[0]; 34442 l = o[1]; 34443 switch (d) { 34444 case j.TAB : 34445 if (j.shiftKey) { 34446 h = m(a, l - 1, -1) 34447 } else { 34448 h = m(a, l + 1, 1) 34449 } 34450 break; 34451 case j.DOWN : 34452 h = m(a + 1, l, 1); 34453 break; 34454 case j.UP : 34455 h = m(a - 1, l, -1); 34456 break; 34457 case j.RIGHT : 34458 h = m(a, l + 1, 1); 34459 break; 34460 case j.LEFT : 34461 h = m(a, l - 1, -1);
34462 break; 34463 case j.ENTER : 34464 if (i.isEditor && !i.editing) { 34465 i.startEditing(a, l); 34466 return 34467 } 34468 break 34469 } 34470 if (h) { 34471 a = h[0]; 34472 l = h[1]; 34473 this.select(a, l); 34474 if (i.isEditor && i.editing) { 34475 n = i.activeEditor; 34476 if (n && n.field.triggerBlur) { 34477 n.field.triggerBlur() 34478 } 34479 i.startEditing(a, l) 34480 } 34481 } 34482 }, 34483 acceptsNav : function(c, b, a) { 34484 return !a.isHidden(b) && a.isCellEditable(b, c) 34485 } 34486}); 34487Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, { 34488 clicksToEdit : 2, 34489 forceValidation : false, 34490 isEditor : true, 34491 detectEdit : false, 34492 autoEncode : false, 34493 trackMouseOver : false, 34494 initComponent : function() { 34495 Ext.grid.EditorGridPanel.superclass.initComponent.call(this); 34496 if (!this.selModel) { 34497 this.selModel = new Ext.grid.CellSelectionModel() 34498 } 34499 this.activeEditor = null; 34500 this.addEvents("beforeedit", "afteredit", "validateedit") 34501 }, 34502 initEvents : function() { 34503 Ext.grid.EditorGridPanel.superclass.initEvents.call(this); 34504 this.getGridEl().on("mousewheel", 34505 this.stopEditing.createDelegate(this, [true]), this); 34506 this.on("columnresize", this.stopEditing, this, [true]); 34507 if (this.clicksToEdit == 1) { 34508 this.on("cellclick", this.onCellDblClick, this) 34509 } else { 34510 var a = this.getView(); 34511 if (this.clicksToEdit == "auto" && a.mainBody) { 34512 a.mainBody.on("mousedown", this.onAutoEditClick, this) 34513 } 34514 this.on("celldblclick", this.onCellDblClick, this) 34515 } 34516 }, 34517 onResize : function() { 34518 Ext.grid.EditorGridPanel.superclass.onResize.apply(this, arguments); 34519 var a = this.activeEditor; 34520 if (this.editing && a) { 34521 a.realign(true) 34522 } 34523 }, 34524 onCellDblClick : function(b, c, a) { 34525 this.startEditing(c, a) 34526 }, 34527 onAutoEditClick : function(c, b) { 34528 if (c.button !== 0) { 34529 return 34530 } 34531 var g = this.view.findRowIndex(b), a = this.view.findCellIndex(b); 34532 if (g !== false && a !== false) { 34533 this.stopEditing(); 34534 if (this.selModel.getSelectedCell) { 34535 var d = this.selModel.getSelectedCell(); 34536 if (d && d[0] === g && d[1] === a) { 34537 this.startEditing(g, a) 34538 } 34539 } else { 34540 if (this.selModel.isSelected(g)) { 34541 this.startEditing(g, a) 34542 } 34543 } 34544 } 34545 }, 34546 onEditComplete : function(b, d, a) { 34547 this.editing = false; 34548 this.lastActiveEditor = this.activeEditor; 34549 this.activeEditor = null; 34550 var c = b.record, h = this.colModel.getDataIndex(b.col); 34551 d = this.postEditValue(d, a, c, h); 34552 if (this.forceValidation === true || String(d) !== String(a)) { 34553 var g = { 34554 grid : this, 34555 record : c, 34556 field : h, 34557 originalValue : a, 34558 value : d, 34559 row : b.row, 34560 column : b.col, 34561 cancel : false 34562 }; 34563 if (this.fireEvent("validateedit", g) !== false && !g.cancel 34564 && String(d) !== String(a)) { 34565 c.set(h, g.value); 34566 delete g.cancel; 34567 this.fireEvent("afteredit", g) 34568 } 34569 } 34570 this.view.focusCell(b.row, b.col) 34571 }, 34572 startEditing : function(i, c) { 34573 this.stopEditing(); 34574 if (this.colModel.isCellEditable(c, i)) { 34575 this.view.ensureVisible(i, c, true); 34576 var d = this.store.getAt(i), h = this.colModel.getDataIndex(c), g = { 34577 grid : this, 34578 record : d, 34579 field : h, 34580 value : d.data[h], 34581 row : i, 34582 column : c, 34583 cancel : false 34584 }; 34585 if (this.fireEvent("beforeedit", g) !== false && !g.cancel) { 34586 this.editing = true; 34587 var b = this.colModel.getCellEditor(c, i); 34588 if (!b) { 34589 return 34590 } 34591 if (!b.rendered) { 34592 b.parentEl = this.view.getEditorParent(b); 34593 b.on({ 34594 scope : this, 34595 render : { 34596 fn : function(e) { 34597 e.field.focus(false, true) 34598 }, 34599 single : true, 34600 scope : this 34601 }, 34602 specialkey : function(k, j) { 34603 this.getSelectionModel().onEditorKey(k, j) 34604 }, 34605 complete : this.onEditComplete, 34606 canceledit : this.stopEditing.createDelegate( 34607 this, [true]) 34608 }) 34609 } 34610 Ext.apply(b, { 34611 row : i, 34612 col : c, 34613 record : d 34614 }); 34615 this.lastEdit = { 34616 row : i, 34617 col : c 34618 }; 34619 this.activeEditor = b; 34620 b.selectSameEditor = (this.activeEditor == this.lastActiveEditor); 34621 var a = this.preEditValue(d, h); 34622 b.startEdit(this.view.getCell(i, c).firstChild, Ext 34623 .isDefined(a) ? a : ""); 34624(function () { 34625 delete b.selectSameEditor 34626 }).defer(50) 34627 } 34628 } 34629 }, 34630 preEditValue : function(a, c) { 34631 var b = a.data[c];
34632 return this.autoEncode && Ext.isString(b) ? Ext.util.Format 34633 .htmlDecode(b) : b 34634 }, 34635 postEditValue : function(c, a, b, d) { 34636 return this.autoEncode && Ext.isString(c) ? Ext.util.Format 34637 .htmlEncode(c) : c 34638 }, 34639 stopEditing : function(b) { 34640 if (this.editing) { 34641 var a = this.lastActiveEditor = this.activeEditor; 34642 if (a) { 34643 a[b === true ? "cancelEdit" : "completeEdit"](); 34644 this.view.focusCell(a.row, a.col) 34645 } 34646 this.activeEditor = null 34647 } 34648 this.editing = false 34649 } 34650}); 34651Ext.reg("editorgrid", Ext.grid.EditorGridPanel); 34652Ext.grid.GridEditor = function(b, a) { 34653 Ext.grid.GridEditor.superclass.constructor.call(this, b, a); 34654 b.monitorTab = false 34655}; 34656Ext.extend(Ext.grid.GridEditor, Ext.Editor, { 34657 alignment : "tl-tl", 34658 autoSize : "width", 34659 hideEl : false, 34660 cls : "x-small-editor x-grid-editor", 34661 shim : false, 34662 shadow : false 34663 }); 34664Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, { 34665 groupByText : "Group By This Field", 34666 showGroupsText : "Show in Groups", 34667 hideGroupedColumn : false, 34668 showGroupName : true, 34669 startCollapsed : false, 34670 enableGrouping : true, 34671 enableGroupingMenu : true, 34672 enableNoGroups : true, 34673 emptyGroupText : "(None)", 34674 ignoreAdd : false, 34675 groupTextTpl : "{text}", 34676 groupMode : "value", 34677 cancelEditOnToggle : true, 34678 initTemplates : function() { 34679 Ext.grid.GroupingView.superclass.initTemplates.call(this); 34680 this.state = {}; 34681 var a = this.grid.getSelectionModel(); 34682 a.on(a.selectRow ? "beforerowselect" : "beforecellselect", 34683 this.onBeforeRowSelect, this); 34684 if (!this.startGroup) { 34685 this.startGroup = new Ext.XTemplate( 34686 '<div id="{groupId}" class="x-grid-group {cls}">', 34687 '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">', 34688 this.groupTextTpl, "</div></div>", 34689 '<div id="{groupId}-bd" class="x-grid-group-body">') 34690 } 34691 this.startGroup.compile(); 34692 if (!this.endGroup) { 34693 this.endGroup = "</div></div>" 34694 } 34695 }, 34696 findGroup : function(a) { 34697 return Ext.fly(a).up(".x-grid-group", this.mainBody.dom) 34698 }, 34699 getGroups : function() { 34700 return this.hasRows() ? this.mainBody.dom.childNodes : [] 34701 }, 34702 onAdd : function(d, a, b) { 34703 if (this.canGroup() && !this.ignoreAdd) { 34704 var c = this.getScrollState(); 34705 this.fireEvent("beforerowsinserted", d, b, b + (a.length - 1)); 34706 this.refresh(); 34707 this.restoreScroll(c); 34708 this.fireEvent("rowsinserted", d, b, b + (a.length - 1)) 34709 } else { 34710 if (!this.canGroup()) { 34711 Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments) 34712 } 34713 } 34714 }, 34715 onRemove : function(e, a, b, d) { 34716 Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments); 34717 var c = document.getElementById(a._groupId); 34718 if (c && c.childNodes[1].childNodes.length < 1) { 34719 Ext.removeNode(c) 34720 } 34721 this.applyEmptyText() 34722 }, 34723 refreshRow : function(a) { 34724 if (this.ds.getCount() == 1) { 34725 this.refresh() 34726 } else { 34727 this.isUpdating = true; 34728 Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments); 34729 this.isUpdating = false 34730 } 34731 }, 34732 beforeMenuShow : function() { 34733 var c, a = this.hmenu.items, b = this.cm.config[this.hdCtxIndex].groupable === false; 34734 if ((c = a.get("groupBy"))) { 34735 c.setDisabled(b) 34736 } 34737 if ((c = a.get("showGroups"))) { 34738 c.setDisabled(b); 34739 c.setChecked(this.canGroup(), true) 34740 } 34741 }, 34742 renderUI : function() { 34743 var a = Ext.grid.GroupingView.superclass.renderUI.call(this); 34744 if (this.enableGroupingMenu && this.hmenu) { 34745 this.hmenu.add("-", { 34746 itemId : "groupBy", 34747 text : this.groupByText, 34748 handler : this.onGroupByClick, 34749 scope : this, 34750 iconCls : "x-group-by-icon" 34751 }); 34752 if (this.enableNoGroups) { 34753 this.hmenu.add({ 34754 itemId : "showGroups", 34755 text : this.showGroupsText, 34756 checked : true, 34757 checkHandler : this.onShowGroupsClick, 34758 scope : this 34759 }) 34760 } 34761 this.hmenu.on("beforeshow", this.beforeMenuShow, this) 34762 } 34763 return a 34764 }, 34765 processEvent : function(b, i) { 34766 Ext.grid.GroupingView.superclass.processEvent.call(this, b, i);
34767 var h = i.getTarget(".x-grid-group-hd", this.mainBody); 34768 if (h) { 34769 var g = this.getGroupField(), d = this.getPrefix(g), a = h.id 34770 .substring(d.length), c = new RegExp("gp-" 34771 + Ext.escapeRe(g) + "--hd"); 34772 a = a.substr(0, a.length - 3); 34773 if (a || c.test(h.id)) { 34774 this.grid.fireEvent("group" + b, this.grid, g, a, i) 34775 } 34776 if (b == "mousedown" && i.button == 0) { 34777 this.toggleGroup(h.parentNode) 34778 } 34779 } 34780 }, 34781 onGroupByClick : function() { 34782 var a = this.grid; 34783 this.enableGrouping = true; 34784 a.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex)); 34785 a.fireEvent("groupchange", a, a.store.getGroupState()); 34786 this.beforeMenuShow(); 34787 this.refresh() 34788 }, 34789 onShowGroupsClick : function(a, b) { 34790 this.enableGrouping = b; 34791 if (b) { 34792 this.onGroupByClick() 34793 } else { 34794 this.grid.store.clearGrouping(); 34795 this.grid.fireEvent("groupchange", this, null) 34796 } 34797 }, 34798 toggleRowIndex : function(c, a) { 34799 if (!this.canGroup()) { 34800 return 34801 } 34802 var b = this.getRow(c); 34803 if (b) { 34804 this.toggleGroup(this.findGroup(b), a) 34805 } 34806 }, 34807 toggleGroup : function(c, b) { 34808 var a = Ext.get(c), d = Ext.util.Format.htmlEncode(a.id); 34809 b = Ext.isDefined(b) ? b : a.hasClass("x-grid-group-collapsed"); 34810 if (this.state[d] !== b) { 34811 if (this.cancelEditOnToggle !== false) { 34812 this.grid.stopEditing(true) 34813 } 34814 this.state[d] = b; 34815 a[b ? "removeClass" : "addClass"]("x-grid-group-collapsed") 34816 } 34817 }, 34818 toggleAllGroups : function(c) { 34819 var b = this.getGroups(); 34820 for (var d = 0, a = b.length; d < a; d++) { 34821 this.toggleGroup(b[d], c) 34822 } 34823 }, 34824 expandAllGroups : function() { 34825 this.toggleAllGroups(true) 34826 }, 34827 collapseAllGroups : function() { 34828 this.toggleAllGroups(false) 34829 }, 34830 getGroup : function(a, e, i, j, b, h) { 34831 var c = this.cm.config[b], d = i 34832 ? i.call(c.scope, a, {}, e, j, b, h) 34833 : String(a); 34834 if (d === "" || d === " ") { 34835 d = c.emptyGroupText || this.emptyGroupText 34836 } 34837 return d 34838 }, 34839 getGroupField : function() { 34840 return this.grid.store.getGroupState() 34841 }, 34842 afterRender : function() { 34843 if (!this.ds || !this.cm) { 34844 return 34845 } 34846 Ext.grid.GroupingView.superclass.afterRender.call(this); 34847 if (this.grid.deferRowRender) { 34848 this.updateGroupWidths() 34849 } 34850 }, 34851 afterRenderUI : function() { 34852 Ext.grid.GroupingView.superclass.afterRenderUI.call(this); 34853 if (this.enableGroupingMenu && this.hmenu) { 34854 this.hmenu.add("-", { 34855 itemId : "groupBy", 34856 text : this.groupByText, 34857 handler : this.onGroupByClick, 34858 scope : this, 34859 iconCls : "x-group-by-icon" 34860 }); 34861 if (this.enableNoGroups) { 34862 this.hmenu.add({ 34863 itemId : "showGroups", 34864 text : this.showGroupsText, 34865 checked : true, 34866 checkHandler : this.onShowGroupsClick, 34867 scope : this 34868 }) 34869 } 34870 this.hmenu.on("beforeshow", this.beforeMenuShow, this) 34871 } 34872 }, 34873 renderRows : function() { 34874 var a = this.getGroupField(); 34875 var e = !!a; 34876 if (this.hideGroupedColumn) { 34877 var b = this.cm.findColumnIndex(a), d = Ext 34878 .isDefined(this.lastGroupField); 34879 if (!e && d) { 34880 this.mainBody.update(""); 34881 this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), 34882 false); 34883 delete this.lastGroupField 34884 } else { 34885 if (e && !d) { 34886 this.lastGroupField = a; 34887 this.cm.setHidden(b, true) 34888 } else { 34889 if (e && d && a !== this.lastGroupField) { 34890 this.mainBody.update(""); 34891 var c = this.cm.findColumnIndex(this.lastGroupField); 34892 this.cm.setHidden(c, false); 34893 this.lastGroupField = a; 34894 this.cm.setHidden(b, true) 34895 } 34896 } 34897 } 34898 } 34899 return Ext.grid.GroupingView.superclass.renderRows.apply(this, 34900 arguments) 34901 }, 34902 doRender : function(c, h, q, a, p, s) { 34903 if (h.length < 1) { 34904 return "" 34905 } 34906 if (!this.canGroup() || this.isUpdating) { 34907 return Ext.grid.GroupingView.superclass.doRender.apply(this, 34908 arguments) 34909 } 34910 var z = this.getGroupField(), o = this.cm.findColumnIndex(z), w, j = "width:" 34911 + this.getTotalWidth() + ";", e = this.cm.config[o], b = e.groupRenderer 34912 || e.renderer, t = this.showGroupName 34913 ? (e.groupName || e.header) + ": " 34914 : "", y = [], l, u, v, n; 34915 for (u = 0, v = h.length; u < v; u++) { 34916 var k = a + u, m = h[u], d = m.data[z]; 34917 w = this.getGroup(d, m, b, k, o, q); 34918 if (!l || l.group != w) { 34919 n = this.constructId(d, z, o); 34920 this.state[n] = !(Ext.isDefined(this.state[n]) 34921 ? !this.state[n] 34922 : this.startCollapsed); 34923 l = { 34924 group : w, 34925 gvalue : d, 34926 text : t + w, 34927 groupId : n, 34928 startRow : k, 34929 rs : [m], 34930 cls : this.state[n] ? "" : "x-grid-group-collapsed", 34931 style : j 34932 }; 34933 y.push(l) 34934 } else { 34935 l.rs.push(m) 34936 } 34937 m._groupId = n 34938 } 34939 var x = []; 34940 for (u = 0, v = y.length; u < v; u++) { 34941 w = y[u]; 34942 this.doGroupStart(x, w, c, q, p); 34943 x[x.length] = Ext.grid.GroupingView.superclass.doRender.call(this, 34944 c, w.rs, q, w.startRow, p, s); 34945 this.doGroupEnd(x, w, c, q, p) 34946 } 34947 return x.join("") 34948 }, 34949 getGroupId : function(a) { 34950 var b = this.getGroupField(); 34951 return this.constructId(a, b, this.cm.findColumnIndex(b)) 34952 }, 34953 constructId : function(c, e, a) { 34954 var b = this.cm.config[a], d = b.groupRenderer || b.renderer, g = (this.groupMode == "value") 34955 ? c 34956 : this.getGroup(c, { 34957 data : {} 34958 }, d, 0, a, this.ds); 34959 return this.getPrefix(e) + Ext.util.Format.htmlEncode(g) 34960 }, 34961 canGroup : function() { 34962 return this.enableGrouping && !!this.getGroupField() 34963 }, 34964 getPrefix : function(a) { 34965 return this.grid.getGridEl().id + "-gp-" + a + "-" 34966 }, 34967 doGroupStart : function(a, d, b, e, c) { 34968 a[a.length] = this.startGroup.apply(d) 34969 }, 34970 doGroupEnd : function(a, d, b, e, c) { 34971 a[a.length] = this.endGroup 34972 }, 34973 getRows : function() { 34974 if (!this.canGroup()) { 34975 return Ext.grid.GroupingView.superclass.getRows.call(this) 34976 } 34977 var k = [], c = this.getGroups(), h, e = 0, a = c.length, d, b; 34978 for (; e < a; ++e) { 34979 h = c[e].childNodes[1]; 34980 if (h) { 34981 h = h.childNodes; 34982 for (d = 0, b = h.length; d < b; ++d) { 34983 k[k.length] = h[d] 34984 } 34985 } 34986 } 34987 return k 34988 }, 34989 updateGroupWidths : function() { 34990 if (!this.canGroup() || !this.hasRows()) { 34991 return 34992 } 34993 var c = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth
34994 - this.getScrollOffset()) 34995 + "px"; 34996 var b = this.getGroups(); 34997 for (var d = 0, a = b.length; d < a; d++) { 34998 b[d].firstChild.style.width = c 34999 } 35000 }, 35001 onColumnWidthUpdated : function(c, a, b) { 35002 Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this, c, a, 35003 b); 35004 this.updateGroupWidths() 35005 }, 35006 onAllColumnWidthsUpdated : function(a, b) { 35007 Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this, a, 35008 b); 35009 this.updateGroupWidths() 35010 }, 35011 onColumnHiddenUpdated : function(b, c, a) { 35012 Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this, b, c, 35013 a); 35014 this.updateGroupWidths() 35015 }, 35016 onLayout : function() { 35017 this.updateGroupWidths() 35018 }, 35019 onBeforeRowSelect : function(b, a) { 35020 this.toggleRowIndex(a, true) 35021 } 35022}); 35023Ext.grid.GroupingView.GROUP_ID = 1000; 35024 35025 35026 35027/* Class Override * ch197cm */ 35028 35029/* íì¤í 리 ì¬ì ì */ 35030Ext.History = (function () { 35031 var tabIdStore = { 35032 'MAIL' : ['maillist','mailview','mailwrite','rcptlist','spamlist'], 35033 'BOARD' : ['noticelist','noticeview','noticewrite'] 35034 }; 35035 return { 35036 init: function () { 35037 this.addEvents( 35038 'change' 35039 ); 35040 }, 35041 add: function (page,changeTabId) { 35042 var changeTabIndex, 35043 tabIndex = this.getIndexByUrl(page), 35044 tabId = this.getTabIdByIndex(page,tabIndex); 35045 if (tabId !== -1 && tabId !== changeTabId) { 35046 changeTabIndex = this.getIndexByTabId(page,changeTabId); 35047 document.location.hash = changeTabIndex; 35048 } 35049 }, 35050 change : function(page) { 35051 var tabIndex, activeTabId; 35052 if (page) { 35053 tabIndex = this.getIndexByUrl(page); 35054 activeTabId = this.getTabIdByIndex(page,tabIndex); 35055 if (activeTabId) { 35056 Ext.History.fireEvent('change', activeTabId); 35057 } 35058 } 35059 }, 35060 getTabIdByIndex : function (page,index) { 35061 var tabIdList = tabIdStore[page]; 35062 if (tabIdList && index > -1 && tabIdList.length > index) { 35063 return tabIdList[index]; 35064 } 35065 return null; 35066 }, 35067 getIndexByTabId : function (page,tabId) { 35068 var tabIdList = tabIdStore[page]; 35069 if (tabIdList) { 35070 return tabIdList.indexOf(tabId); 35071 } 35072 return -1; 35073 }, 35074 getIndexByUrl : function (page) { 35075 var index, tabIdList = tabIdStore[page], 35076 matchList = document.location.href.match(/(https?:)(.+)((#)([0-9]{1}))/i); 35077 if (tabIdList && matchList && matchList.length === 6) { 35078 try { 35079 index = parseInt(matchList[5]); 35080 if (index > -1 && tabIdList.length > index) { 35081 return index; 35082 } 35083 } catch (e) { 35084 //ignore 35085 } 35086 } 35087 return -1; 35088 } 35089 }; 35090})(); 35091Ext.apply(Ext.History, new Ext.util.Observable()); 35092 35093/* ë²í¼ í¨ì¹ iconClsê° ì ì ëì§ ìììë */ 35094Ext.override(Ext.CycleButton, { 35095 getItemText : function(item){ 35096 if(item && this.showText === true){ 35097 var text = ''; 35098 if(this.prependText){ 35099 text += this.prependText; 35100 } 35101 if (item.text) { 35102 text += item.text; 35103 } 35104 return text; 35105 } else { 35106 return this.text; 35107 } 35108 return undefined; 35109 }, 35110 setActiveItem : function(item, suppressEvent){ 35111 if(!Ext.isObject(item)){ 35112 item = this.menu.getComponent(item); 35113 } 35114 if(item){ 35115 if(!this.rendered){ 35116 this.text = this.getItemText(item); 35117 if (item.iconCls) { 35118 this.iconCls = item.iconCls; 35119 } 35120 }else{ 35121 var t = this.getItemText(item); 35122 if(t){ 35123 this.setText(t); 35124 } 35125 if (item.iconCls) { 35126 this.setIconClass(item.iconCls); 35127 } 35128 } 35129 this.activeItem = item; 35130 if(!item.checked){ 35131 item.setChecked(true, suppressEvent); 35132 } 35133 if(this.forceIcon){ 35134 if (this.forceIcon) { 35135 this.setIconClass(this.forceIcon); 35136 } 35137 } 35138 if(!suppressEvent){ 35139 this.fireEvent('change', this, item); 35140 } 35141 } 35142 } 35143 }); 35144 35145/* ë¡ë© ì¸ëì¼ì´í° ì´ê¸°í */ 35146Ext.Updater.defaults.showLoadIndicator = false; 35147 35148/* 그리ë ì´ê¸°í */ 35149Ext.override(Ext.grid.GridPanel, { 35150 enableColumnMove : false 35151 }); 35152 35153/* ìëì° ì´ê¸°í */ 35154Ext.override(Ext.Window, { 35155 shadow : false, 35156 shim : false 35157 }); 35158 35159/* ë©ë´ ì´ê¸°í */ 35160Ext.override(Ext.menu.Menu, { 35161 shadow : false 35162 }); 35163 35164/* 콤보 ì´ê¸°í */ 35165Ext.override(Ext.form.ComboBox, { 35166 shadow : false 35167}); 35168 35169/* Ext.Fx ì¬ì©ìí¨ : ê¼ ì¬ì©í´ì¼íë ê²½ì°ë ìëì¼ë¡ í¨ê³¼ ìì± */ 35170Ext.enableFx = false; 35171 35172Ext.enableGarbageCollector = false; 35173 35174Ext.Ajax.defaultHeaders = { 35175 'Powered-By': 'Crinity' 35176};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.