469b9bda3e7f4a3dd5ce1ccbb318a489a06df720.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. if (typeof jQuery == "undefined") {
  7. throw "Unable to load Ext, jQuery not found."
  8. }
  9. (function() {
  10. var B;
  11. Ext.lib.Dom = {
  12. getViewWidth : function(D) {
  13. return D ? Math.max(jQuery(document).width(), jQuery(window)
  14. .width()) : jQuery(window).width()
  15. },
  16. getViewHeight : function(D) {
  17. return D ? Math.max(jQuery(document).height(), jQuery(window)
  18. .height()) : jQuery(window).height()
  19. },
  20. isAncestor : function(E, F) {
  21. E = Ext.getDom(E);
  22. F = Ext.getDom(F);
  23. if (!E || !F) {
  24. return false
  25. }
  26. if (E.contains && !Ext.isSafari) {
  27. return E.contains(F)
  28. } else {
  29. if (E.compareDocumentPosition) {
  30. return !!(E.compareDocumentPosition(F) & 16)
  31. } else {
  32. var D = F.parentNode;
  33. while (D) {
  34. if (D == E) {
  35. return true
  36. } else {
  37. if (!D.tagName || D.tagName.toUpperCase() == "HTML") {
  38. return false
  39. }
  40. }
  41. D = D.parentNode
  42. }
  43. return false
  44. }
  45. }
  46. },
  47. getRegion : function(D) {
  48. return Ext.lib.Region.getRegion(D)
  49. },
  50. getY : function(D) {
  51. return this.getXY(D)[1]
  52. },
  53. getX : function(D) {
  54. return this.getXY(D)[0]
  55. },
  56. getXY : function(F) {
  57. var E, J, L, M, I = (document.body || document.documentElement);
  58. F = Ext.getDom(F);
  59. if (F == I) {
  60. return [0, 0]
  61. }
  62. if (F.getBoundingClientRect) {
  63. L = F.getBoundingClientRect();
  64. M = C(document).getScroll();
  65. return [L.left + M.left, L.top + M.top]
  66. }
  67. var N = 0, K = 0;
  68. E = F;
  69. var D = C(F).getStyle("position") == "absolute";
  70. while (E) {
  71. N += E.offsetLeft;
  72. K += E.offsetTop;
  73. if (!D && C(E).getStyle("position") == "absolute") {
  74. D = true
  75. }
  76. if (Ext.isGecko) {
  77. J = C(E);
  78. var O = parseInt(J.getStyle("borderTopWidth"), 10) || 0;
  79. var G = parseInt(J.getStyle("borderLeftWidth"), 10) || 0;
  80. N += G;
  81. K += O;
  82. if (E != F && J.getStyle("overflow") != "visible") {
  83. N += G;
  84. K += O
  85. }
  86. }
  87. E = E.offsetParent
  88. }
  89. if (Ext.isSafari && D) {
  90. N -= I.offsetLeft;
  91. K -= I.offsetTop
  92. }
  93. if (Ext.isGecko && !D) {
  94. var H = C(I);
  95. N += parseInt(H.getStyle("borderLeftWidth"), 10) || 0;
  96. K += parseInt(H.getStyle("borderTopWidth"), 10) || 0
  97. }
  98. E = F.parentNode;
  99. while (E && E != I) {
  100. if (!Ext.isOpera
  101. || (E.tagName != "TR" && C(E).getStyle("display") != "inline")) {
  102. N -= E.scrollLeft;
  103. K -= E.scrollTop
  104. }
  105. E = E.parentNode
  106. }
  107. return [N, K]
  108. },
  109. setXY : function(D, E) {
  110. D = Ext.fly(D, "_setXY");
  111. D.position();
  112. var F = D.translatePoints(E);
  113. if (E[0] !== false) {
  114. D.dom.style.left = F.left + "px"
  115. }
  116. if (E[1] !== false) {
  117. D.dom.style.top = F.top + "px"
  118. }
  119. },
  120. setX : function(E, D) {
  121. this.setXY(E, [D, false])
  122. },
  123. setY : function(D, E) {
  124. this.setXY(D, [false, E])
  125. }
  126. };
  127. function C(D) {
  128. if (!B) {
  129. B = new Ext.Element.Flyweight()
  130. }
  131. B.dom = D;
  132. return B
  133. }
  134. Ext.lib.Event = {
  135. getPageX : function(D) {
  136. D = D.browserEvent || D;
  137. return D.pageX
  138. },
  139. getPageY : function(D) {
  140. D = D.browserEvent || D;
  141. return D.pageY
  142. },
  143. getXY : function(D) {
  144. D = D.browserEvent || D;
  145. return [D.pageX, D.pageY]
  146. },
  147. getTarget : function(D) {
  148. return D.target
  149. },
  150. on : function(H, D, G, F, E) {
  151. jQuery(H).bind(D, G)
  152. },
  153. un : function(F, D, E) {
  154. jQuery(F).unbind(D, E)
  155. },
  156. purgeElement : function(D) {
  157. jQuery(D).unbind()
  158. },
  159. preventDefault : function(D) {
  160. D = D.browserEvent || D;
  161. if (D.preventDefault) {
  162. D.preventDefault()
  163. } else {
  164. D.returnValue = false
  165. }
  166. },
  167. stopPropagation : function(D) {
  168. D = D.browserEvent || D;
  169. if (D.stopPropagation) {
  170. D.stopPropagation()
  171. } else {
  172. D.cancelBubble = true
  173. }
  174. },
  175. stopEvent : function(D) {
  176. this.preventDefault(D);
  177. this.stopPropagation(D)
  178. },
  179. onAvailable : function(I, E, D) {
  180. var H = allGetServerTime();
  181. var F = function() {
  182. if (H.getElapsed() > 10000) {
  183. clearInterval(G)
  184. }
  185. var J = document.getElementById(I);
  186. if (J) {
  187. clearInterval(G);
  188. E.call(D || window, J)
  189. }
  190. };
  191. var G = setInterval(F, 50)
  192. },
  193. resolveTextNode : function(D) {
  194. if (D && 3 == D.nodeType) {
  195. return D.parentNode
  196. } else {
  197. return D
  198. }
  199. },
  200. getRelatedTarget : function(E) {
  201. E = E.browserEvent || E;
  202. var D = E.relatedTarget;
  203. if (!D) {
  204. if (E.type == "mouseout") {
  205. D = E.toElement
  206. } else {
  207. if (E.type == "mouseover") {
  208. D = E.fromElement
  209. }
  210. }
  211. }
  212. return this.resolveTextNode(D)
  213. }
  214. };
  215. Ext.lib.Ajax = function() {
  216. var D = function(E) {
  217. return function(G, F) {
  218. if ((F == "error" || F == "timeout") && E.failure) {
  219. E.failure.call(E.scope || window, {
  220. responseText : G.responseText,
  221. responseXML : G.responseXML,
  222. argument : E.argument
  223. })
  224. } else {
  225. if (E.success) {
  226. E.success.call(E.scope || window, {
  227. responseText : G.responseText,
  228. responseXML : G.responseXML,
  229. argument : E.argument
  230. })
  231. }
  232. }
  233. }
  234. };
  235. return {
  236. request : function(J, G, E, H, F) {
  237. var I = {
  238. type : J,
  239. url : G,
  240. data : H,
  241. timeout : E.timeout,
  242. complete : D(E)
  243. };
  244. if (F) {
  245. if (F.xmlData) {
  246. I.data = F.xmlData;
  247. I.processData = false;
  248. I.type = "POST";
  249. I.contentType = "text/xml"
  250. } else {
  251. if (F.jsonData) {
  252. I.data = typeof F.jsonData == "object" ? Ext
  253. .encode(F.jsonData) : F.jsonData;
  254. I.processData = false;
  255. I.type = "POST";
  256. I.contentType = "text/javascript"
  257. }
  258. }
  259. if (F.headers) {
  260. I.beforeSend = function(M) {
  261. var K = F.headers;
  262. for (var L in K) {
  263. if (K.hasOwnProperty(L)) {
  264. M.setRequestHeader(L, K[L])
  265. }
  266. }
  267. }
  268. }
  269. }
  270. jQuery.ajax(I)
  271. },
  272. formRequest : function(I, H, F, J, E, G) {
  273. jQuery.ajax({
  274. type : Ext.getDom(I).method || "POST",
  275. url : H,
  276. data : jQuery(I).formSerialize()
  277. + (J ? "&" + J : ""),
  278. timeout : F.timeout,
  279. complete : D(F)
  280. })
  281. },
  282. isCallInProgress : function(E) {
  283. return false
  284. },
  285. abort : function(E) {
  286. return false
  287. },
  288. serializeForm : function(E) {
  289. return jQuery(E.dom || E).formSerialize()
  290. }
  291. }
  292. }();
  293. Ext.lib.Anim = function() {
  294. var D = function(E, F) {
  295. var G = true;
  296. return {
  297. stop : function(H) {
  298. },
  299. isAnimated : function() {
  300. return G
  301. },
  302. proxyCallback : function() {
  303. G = false;
  304. Ext.callback(E, F)
  305. }
  306. }
  307. };
  308. return {
  309. scroll : function(H, F, J, K, E, G) {
  310. var I = D(E, G);
  311. H = Ext.getDom(H);
  312. if (typeof F.scroll.to[0] == "number") {
  313. H.scrollLeft = F.scroll.to[0]
  314. }
  315. if (typeof F.scroll.to[1] == "number") {
  316. H.scrollTop = F.scroll.to[1]
  317. }
  318. I.proxyCallback();
  319. return I
  320. },
  321. motion : function(H, F, I, J, E, G) {
  322. return this.run(H, F, I, J, E, G)
  323. },
  324. color : function(H, F, J, K, E, G) {
  325. var I = D(E, G);
  326. I.proxyCallback();
  327. return I
  328. },
  329. run : function(F, N, I, M, G, P, O) {
  330. var J = D(G, P), K = Ext.fly(F, "_animrun");
  331. var E = {};
  332. for (var H in N) {
  333. if (N[H].from) {
  334. if (H != "points") {
  335. K.setStyle(H, N[H].from)
  336. }
  337. }
  338. switch (H) {
  339. case "points" :
  340. var L, R;
  341. K.position();
  342. if (L = N.points.by) {
  343. var Q = K.getXY();
  344. R = K
  345. .translatePoints([Q[0] + L[0],
  346. Q[1] + L[1]])
  347. } else {
  348. R = K.translatePoints(N.points.to)
  349. }
  350. E.left = R.left;
  351. E.top = R.top;
  352. if (!parseInt(K.getStyle("left"), 10)) {
  353. K.setLeft(0)
  354. }
  355. if (!parseInt(K.getStyle("top"), 10)) {
  356. K.setTop(0)
  357. }
  358. if (N.points.from) {
  359. K.setXY(N.points.from)
  360. }
  361. break;
  362. case "width" :
  363. E.width = N.width.to;
  364. break;
  365. case "height" :
  366. E.height = N.height.to;
  367. break;
  368. case "opacity" :
  369. E.opacity = N.opacity.to;
  370. break;
  371. case "left" :
  372. E.left = N.left.to;
  373. break;
  374. case "top" :
  375. E.top = N.top.to;
  376. break;
  377. default :
  378. E[H] = N[H].to;
  379. break
  380. }
  381. }
  382. jQuery(F).animate(E, I * 1000, undefined, J.proxyCallback);
  383. return J
  384. }
  385. }
  386. }();
  387. Ext.lib.Region = function(F, G, D, E) {
  388. this.top = F;
  389. this[1] = F;
  390. this.right = G;
  391. this.bottom = D;
  392. this.left = E;
  393. this[0] = E
  394. };
  395. Ext.lib.Region.prototype = {
  396. contains : function(D) {
  397. return (D.left >= this.left && D.right <= this.right
  398. && D.top >= this.top && D.bottom <= this.bottom)
  399. },
  400. getArea : function() {
  401. return ((this.bottom - this.top) * (this.right - this.left))
  402. },
  403. intersect : function(H) {
  404. var F = Math.max(this.top, H.top);
  405. var G = Math.min(this.right, H.right);
  406. var D = Math.min(this.bottom, H.bottom);
  407. var E = Math.max(this.left, H.left);
  408. if (D >= F && G >= E) {
  409. return new Ext.lib.Region(F, G, D, E)
  410. } else {
  411. return null
  412. }
  413. },
  414. union : function(H) {
  415. var F = Math.min(this.top, H.top);
  416. var G = Math.max(this.right, H.right);
  417. var D = Math.max(this.bottom, H.bottom);
  418. var E = Math.min(this.left, H.left);
  419. return new Ext.lib.Region(F, G, D, E)
  420. },
  421. constrainTo : function(D) {
  422. this.top = this.top.constrain(D.top, D.bottom);
  423. this.bottom = this.bottom.constrain(D.top, D.bottom);
  424. this.left = this.left.constrain(D.left, D.right);
  425. this.right = this.right.constrain(D.left, D.right);
  426. return this
  427. },
  428. adjust : function(F, E, D, G) {
  429. this.top += F;
  430. this.left += E;
  431. this.right += G;
  432. this.bottom += D;
  433. return this
  434. }
  435. };
  436. Ext.lib.Region.getRegion = function(G) {
  437. var I = Ext.lib.Dom.getXY(G);
  438. var F = I[1];
  439. var H = I[0] + G.offsetWidth;
  440. var D = I[1] + G.offsetHeight;
  441. var E = I[0];
  442. return new Ext.lib.Region(F, H, D, E)
  443. };
  444. Ext.lib.Point = function(D, E) {
  445. if (D instanceof Array) {
  446. E = D[1];
  447. D = D[0]
  448. }
  449. this.x = this.right = this.left = this[0] = D;
  450. this.y = this.top = this.bottom = this[1] = E
  451. };
  452. Ext.lib.Point.prototype = new Ext.lib.Region();
  453. if (Ext.isIE) {
  454. function A() {
  455. var D = Function.prototype;
  456. delete D.createSequence;
  457. delete D.defer;
  458. delete D.createDelegate;
  459. delete D.createCallback;
  460. delete D.createInterceptor;
  461. window.detachEvent("onunload", A)
  462. }
  463. window.attachEvent("onunload", A)
  464. }
  465. })();