ext-core-debug.js 125 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698
  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. Ext.DomHelper = function() {
  7. var tempTableEl = null;
  8. var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;
  9. var tableRe = /^table|tbody|tr|td$/i;
  10. var createHtml = function(o) {
  11. if (typeof o == 'string') {
  12. return o;
  13. }
  14. var b = "";
  15. if (!o.tag) {
  16. o.tag = "div";
  17. }
  18. b += "<" + o.tag;
  19. for (var attr in o) {
  20. if (attr == "tag" || attr == "children" || attr == "cn"
  21. || attr == "html" || typeof o[attr] == "function")
  22. continue;
  23. if (attr == "style") {
  24. var s = o["style"];
  25. if (typeof s == "function") {
  26. s = s.call();
  27. }
  28. if (typeof s == "string") {
  29. b += ' style="' + s + '"';
  30. } else if (typeof s == "object") {
  31. b += ' style="';
  32. for (var key in s) {
  33. if (typeof s[key] != "function") {
  34. b += key + ":" + s[key] + ";";
  35. }
  36. }
  37. b += '"';
  38. }
  39. } else {
  40. if (attr == "cls") {
  41. b += ' class="' + o["cls"] + '"';
  42. } else if (attr == "htmlFor") {
  43. b += ' for="' + o["htmlFor"] + '"';
  44. } else {
  45. b += " " + attr + '="' + o[attr] + '"';
  46. }
  47. }
  48. }
  49. if (emptyTags.test(o.tag)) {
  50. b += "/>";
  51. } else {
  52. b += ">";
  53. var cn = o.children || o.cn;
  54. if (cn) {
  55. if (cn instanceof Array) {
  56. for (var i = 0, len = cn.length; i < len; i++) {
  57. b += createHtml(cn[i], b);
  58. }
  59. } else {
  60. b += createHtml(cn, b);
  61. }
  62. }
  63. if (o.html) {
  64. b += o.html;
  65. }
  66. b += "</" + o.tag + ">";
  67. }
  68. return b;
  69. };
  70. var createDom = function(o, parentNode) {
  71. var el = document.createElement(o.tag || 'div');
  72. var useSet = el.setAttribute ? true : false;
  73. for (var attr in o) {
  74. if (attr == "tag" || attr == "children" || attr == "cn"
  75. || attr == "html" || attr == "style"
  76. || typeof o[attr] == "function")
  77. continue;
  78. if (attr == "cls") {
  79. el.className = o["cls"];
  80. } else {
  81. if (useSet)
  82. el.setAttribute(attr, o[attr]);
  83. else
  84. el[attr] = o[attr];
  85. }
  86. }
  87. Ext.DomHelper.applyStyles(el, o.style);
  88. var cn = o.children || o.cn;
  89. if (cn) {
  90. if (cn instanceof Array) {
  91. for (var i = 0, len = cn.length; i < len; i++) {
  92. createDom(cn[i], el);
  93. }
  94. } else {
  95. createDom(cn, el);
  96. }
  97. }
  98. if (o.html) {
  99. el.innerHTML = o.html;
  100. }
  101. if (parentNode) {
  102. parentNode.appendChild(el);
  103. }
  104. return el;
  105. };
  106. var ieTable = function(depth, s, h, e) {
  107. tempTableEl.innerHTML = [s, h, e].join('');
  108. var i = -1, el = tempTableEl;
  109. while (++i < depth) {
  110. el = el.firstChild;
  111. }
  112. return el;
  113. };
  114. var ts = '<table>', te = '</table>', tbs = ts + '<tbody>', tbe = '</tbody>'
  115. + te, trs = tbs + '<tr>', tre = '</tr>' + tbe;
  116. var insertIntoTable = function(tag, where, el, html) {
  117. if (!tempTableEl) {
  118. tempTableEl = document.createElement('div');
  119. }
  120. var node;
  121. var before = null;
  122. if (tag == 'td') {
  123. if (where == 'afterbegin' || where == 'beforeend') {
  124. return;
  125. }
  126. if (where == 'beforebegin') {
  127. before = el;
  128. el = el.parentNode;
  129. } else {
  130. before = el.nextSibling;
  131. el = el.parentNode;
  132. }
  133. node = ieTable(4, trs, html, tre);
  134. } else if (tag == 'tr') {
  135. if (where == 'beforebegin') {
  136. before = el;
  137. el = el.parentNode;
  138. node = ieTable(3, tbs, html, tbe);
  139. } else if (where == 'afterend') {
  140. before = el.nextSibling;
  141. el = el.parentNode;
  142. node = ieTable(3, tbs, html, tbe);
  143. } else {
  144. if (where == 'afterbegin') {
  145. before = el.firstChild;
  146. }
  147. node = ieTable(4, trs, html, tre);
  148. }
  149. } else if (tag == 'tbody') {
  150. if (where == 'beforebegin') {
  151. before = el;
  152. el = el.parentNode;
  153. node = ieTable(2, ts, html, te);
  154. } else if (where == 'afterend') {
  155. before = el.nextSibling;
  156. el = el.parentNode;
  157. node = ieTable(2, ts, html, te);
  158. } else {
  159. if (where == 'afterbegin') {
  160. before = el.firstChild;
  161. }
  162. node = ieTable(3, tbs, html, tbe);
  163. }
  164. } else {
  165. if (where == 'beforebegin' || where == 'afterend') {
  166. return;
  167. }
  168. if (where == 'afterbegin') {
  169. before = el.firstChild;
  170. }
  171. node = ieTable(2, ts, html, te);
  172. }
  173. el.insertBefore(node, before);
  174. return node;
  175. };
  176. return {
  177. useDom : false,
  178. markup : function(o) {
  179. return createHtml(o);
  180. },
  181. applyStyles : function(el, styles) {
  182. if (styles) {
  183. el = Ext.fly(el);
  184. if (typeof styles == "string") {
  185. var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;
  186. var matches;
  187. while ((matches = re.exec(styles)) != null) {
  188. el.setStyle(matches[1], matches[2]);
  189. }
  190. } else if (typeof styles == "object") {
  191. for (var style in styles) {
  192. el.setStyle(style, styles[style]);
  193. }
  194. } else if (typeof styles == "function") {
  195. Ext.DomHelper.applyStyles(el, styles.call());
  196. }
  197. }
  198. },
  199. insertHtml : function(where, el, html) {
  200. where = where.toLowerCase();
  201. if (el.insertAdjacentHTML) {
  202. if (tableRe.test(el.tagName)) {
  203. var rs;
  204. if (rs = insertIntoTable(el.tagName.toLowerCase(), where,
  205. el, html)) {
  206. return rs;
  207. }
  208. }
  209. switch (where) {
  210. case "beforebegin" :
  211. el.insertAdjacentHTML('BeforeBegin', html);
  212. return el.previousSibling;
  213. case "afterbegin" :
  214. el.insertAdjacentHTML('AfterBegin', html);
  215. return el.firstChild;
  216. case "beforeend" :
  217. el.insertAdjacentHTML('BeforeEnd', html);
  218. return el.lastChild;
  219. case "afterend" :
  220. el.insertAdjacentHTML('AfterEnd', html);
  221. return el.nextSibling;
  222. }
  223. throw 'Illegal insertion point -> "' + where + '"';
  224. }
  225. var range = el.ownerDocument.createRange();
  226. var frag;
  227. switch (where) {
  228. case "beforebegin" :
  229. range.setStartBefore(el);
  230. frag = range.createContextualFragment(html);
  231. el.parentNode.insertBefore(frag, el);
  232. return el.previousSibling;
  233. case "afterbegin" :
  234. if (el.firstChild) {
  235. range.setStartBefore(el.firstChild);
  236. frag = range.createContextualFragment(html);
  237. el.insertBefore(frag, el.firstChild);
  238. return el.firstChild;
  239. } else {
  240. el.innerHTML = html;
  241. return el.firstChild;
  242. }
  243. case "beforeend" :
  244. if (el.lastChild) {
  245. range.setStartAfter(el.lastChild);
  246. frag = range.createContextualFragment(html);
  247. el.appendChild(frag);
  248. return el.lastChild;
  249. } else {
  250. el.innerHTML = html;
  251. return el.lastChild;
  252. }
  253. case "afterend" :
  254. range.setStartAfter(el);
  255. frag = range.createContextualFragment(html);
  256. el.parentNode.insertBefore(frag, el.nextSibling);
  257. return el.nextSibling;
  258. }
  259. throw 'Illegal insertion point -> "' + where + '"';
  260. },
  261. insertBefore : function(el, o, returnElement) {
  262. return this.doInsert(el, o, returnElement, "beforeBegin");
  263. },
  264. insertAfter : function(el, o, returnElement) {
  265. return this.doInsert(el, o, returnElement, "afterEnd",
  266. "nextSibling");
  267. },
  268. insertFirst : function(el, o, returnElement) {
  269. return this.doInsert(el, o, returnElement, "afterBegin",
  270. "firstChild");
  271. },
  272. doInsert : function(el, o, returnElement, pos, sibling) {
  273. el = Ext.getDom(el);
  274. var newNode;
  275. if (this.useDom) {
  276. newNode = createDom(o, null);
  277. (sibling === "firstChild" ? el : el.parentNode).insertBefore(
  278. newNode, sibling ? el[sibling] : el);
  279. } else {
  280. var html = createHtml(o);
  281. newNode = this.insertHtml(pos, el, html);
  282. }
  283. return returnElement ? Ext.get(newNode, true) : newNode;
  284. },
  285. append : function(el, o, returnElement) {
  286. el = Ext.getDom(el);
  287. var newNode;
  288. if (this.useDom) {
  289. newNode = createDom(o, null);
  290. el.appendChild(newNode);
  291. } else {
  292. var html = createHtml(o);
  293. newNode = this.insertHtml("beforeEnd", el, html);
  294. }
  295. return returnElement ? Ext.get(newNode, true) : newNode;
  296. },
  297. overwrite : function(el, o, returnElement) {
  298. el = Ext.getDom(el);
  299. el.innerHTML = createHtml(o);
  300. return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
  301. },
  302. createTemplate : function(o) {
  303. var html = createHtml(o);
  304. return new Ext.Template(html);
  305. }
  306. };
  307. }();
  308. Ext.Template = function(html) {
  309. var a = arguments;
  310. if (html instanceof Array) {
  311. html = html.join("");
  312. } else if (a.length > 1) {
  313. var buf = [];
  314. for (var i = 0, len = a.length; i < len; i++) {
  315. if (typeof a[i] == 'object') {
  316. Ext.apply(this, a[i]);
  317. } else {
  318. buf[buf.length] = a[i];
  319. }
  320. }
  321. html = buf.join('');
  322. }
  323. this.html = html;
  324. if (this.compiled) {
  325. this.compile();
  326. }
  327. };
  328. Ext.Template.prototype = {
  329. applyTemplate : function(values) {
  330. if (this.compiled) {
  331. return this.compiled(values);
  332. }
  333. var useF = this.disableFormats !== true;
  334. var fm = Ext.util.Format, tpl = this;
  335. var fn = function(m, name, format, args) {
  336. if (format && useF) {
  337. if (format.substr(0, 5) == "this.") {
  338. return tpl.call(format.substr(5), values[name], values);
  339. } else {
  340. if (args) {
  341. var re = /^\s*['"](.*)["']\s*$/;
  342. args = args.split(',');
  343. for (var i = 0, len = args.length; i < len; i++) {
  344. args[i] = args[i].replace(re, "$1");
  345. }
  346. args = [values[name]].concat(args);
  347. } else {
  348. args = [values[name]];
  349. }
  350. return fm[format].apply(fm, args);
  351. }
  352. } else {
  353. return values[name] !== undefined ? values[name] : "";
  354. }
  355. };
  356. return this.html.replace(this.re, fn);
  357. },
  358. set : function(html, compile) {
  359. this.html = html;
  360. this.compiled = null;
  361. if (compile) {
  362. this.compile();
  363. }
  364. return this;
  365. },
  366. disableFormats : false,
  367. re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
  368. compile : function() {
  369. var fm = Ext.util.Format;
  370. var useF = this.disableFormats !== true;
  371. var sep = Ext.isGecko ? "+" : ",";
  372. var fn = function(m, name, format, args) {
  373. if (format && useF) {
  374. args = args ? ',' + args : "";
  375. if (format.substr(0, 5) != "this.") {
  376. format = "fm." + format + '(';
  377. } else {
  378. format = 'this.call("' + format.substr(5) + '", ';
  379. args = ", values";
  380. }
  381. } else {
  382. args = '';
  383. format = "(values['" + name + "'] == undefined ? '' : ";
  384. }
  385. return "'" + sep + format + "values['" + name + "']" + args + ")"
  386. + sep + "'";
  387. };
  388. var body;
  389. if (Ext.isGecko) {
  390. body = "this.compiled = function(values){ return '"
  391. + this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g,
  392. '\\n').replace(/'/g, "\\'").replace(this.re, fn)
  393. + "';};";
  394. } else {
  395. body = ["this.compiled = function(values){ return ['"];
  396. body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g,
  397. '\\n').replace(/'/g, "\\'").replace(this.re, fn));
  398. body.push("'].join('');};");
  399. body = body.join('');
  400. }
  401. eval(body);
  402. return this;
  403. },
  404. call : function(fnName, value, allValues) {
  405. return this[fnName](value, allValues);
  406. },
  407. insertFirst : function(el, values, returnElement) {
  408. return this.doInsert('afterBegin', el, values, returnElement);
  409. },
  410. insertBefore : function(el, values, returnElement) {
  411. return this.doInsert('beforeBegin', el, values, returnElement);
  412. },
  413. insertAfter : function(el, values, returnElement) {
  414. return this.doInsert('afterEnd', el, values, returnElement);
  415. },
  416. append : function(el, values, returnElement) {
  417. return this.doInsert('beforeEnd', el, values, returnElement);
  418. },
  419. doInsert : function(where, el, values, returnEl) {
  420. el = Ext.getDom(el);
  421. var newNode = Ext.DomHelper.insertHtml(where, el, this
  422. .applyTemplate(values));
  423. return returnEl ? Ext.get(newNode, true) : newNode;
  424. },
  425. overwrite : function(el, values, returnElement) {
  426. el = Ext.getDom(el);
  427. el.innerHTML = this.applyTemplate(values);
  428. return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
  429. }
  430. };
  431. Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
  432. Ext.DomHelper.Template = Ext.Template;
  433. Ext.Template.from = function(el, config) {
  434. el = Ext.getDom(el);
  435. return new Ext.Template(el.value || el.innerHTML, config || '');
  436. };
  437. Ext.DomQuery = function() {
  438. var cache = {}, simpleCache = {}, valueCache = {};
  439. var nonSpace = /\S/;
  440. var trimRe = /^\s+|\s+$/g;
  441. var tplRe = /\{(\d+)\}/g;
  442. var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;
  443. var tagTokenRe = /^(#)?([\w-\*]+)/;
  444. var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;
  445. function child(p, index) {
  446. var i = 0;
  447. var n = p.firstChild;
  448. while (n) {
  449. if (n.nodeType == 1) {
  450. if (++i == index) {
  451. return n;
  452. }
  453. }
  454. n = n.nextSibling;
  455. }
  456. return null;
  457. };
  458. function next(n) {
  459. while ((n = n.nextSibling) && n.nodeType != 1);
  460. return n;
  461. };
  462. function prev(n) {
  463. while ((n = n.previousSibling) && n.nodeType != 1);
  464. return n;
  465. };
  466. function children(d) {
  467. var n = d.firstChild, ni = -1;
  468. while (n) {
  469. var nx = n.nextSibling;
  470. if (n.nodeType == 3 && !nonSpace.test(n.nodeValue)) {
  471. d.removeChild(n);
  472. } else {
  473. n.nodeIndex = ++ni;
  474. }
  475. n = nx;
  476. }
  477. return this;
  478. };
  479. function byClassName(c, a, v) {
  480. if (!v) {
  481. return c;
  482. }
  483. var r = [], ri = -1, cn;
  484. for (var i = 0, ci; ci = c[i]; i++) {
  485. if ((' ' + ci.className + ' ').indexOf(v) != -1) {
  486. r[++ri] = ci;
  487. }
  488. }
  489. return r;
  490. };
  491. function attrValue(n, attr) {
  492. if (!n.tagName && typeof n.length != "undefined") {
  493. n = n[0];
  494. }
  495. if (!n) {
  496. return null;
  497. }
  498. if (attr == "for") {
  499. return n.htmlFor;
  500. }
  501. if (attr == "class" || attr == "className") {
  502. return n.className;
  503. }
  504. return n.getAttribute(attr) || n[attr];
  505. };
  506. function getNodes(ns, mode, tagName) {
  507. var result = [], ri = -1, cs;
  508. if (!ns) {
  509. return result;
  510. }
  511. tagName = tagName || "*";
  512. if (typeof ns.getElementsByTagName != "undefined") {
  513. ns = [ns];
  514. }
  515. if (!mode) {
  516. for (var i = 0, ni; ni = ns[i]; i++) {
  517. cs = ni.getElementsByTagName(tagName);
  518. for (var j = 0, ci; ci = cs[j]; j++) {
  519. result[++ri] = ci;
  520. }
  521. }
  522. } else if (mode == "/" || mode == ">") {
  523. var utag = tagName.toUpperCase();
  524. for (var i = 0, ni, cn; ni = ns[i]; i++) {
  525. cn = ni.children || ni.childNodes;
  526. for (var j = 0, cj; cj = cn[j]; j++) {
  527. if (cj.nodeName == utag || cj.nodeName == tagName
  528. || tagName == '*') {
  529. result[++ri] = cj;
  530. }
  531. }
  532. }
  533. } else if (mode == "+") {
  534. var utag = tagName.toUpperCase();
  535. for (var i = 0, n; n = ns[i]; i++) {
  536. while ((n = n.nextSibling) && n.nodeType != 1);
  537. if (n
  538. && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')) {
  539. result[++ri] = n;
  540. }
  541. }
  542. } else if (mode == "~") {
  543. for (var i = 0, n; n = ns[i]; i++) {
  544. while ((n = n.nextSibling)
  545. && (n.nodeType != 1 || (tagName == '*' || n.tagName
  546. .toLowerCase() != tagName)));
  547. if (n) {
  548. result[++ri] = n;
  549. }
  550. }
  551. }
  552. return result;
  553. };
  554. function concat(a, b) {
  555. if (b.slice) {
  556. return a.concat(b);
  557. }
  558. for (var i = 0, l = b.length; i < l; i++) {
  559. a[a.length] = b[i];
  560. }
  561. return a;
  562. }
  563. function byTag(cs, tagName) {
  564. if (cs.tagName || cs == document) {
  565. cs = [cs];
  566. }
  567. if (!tagName) {
  568. return cs;
  569. }
  570. var r = [], ri = -1;
  571. tagName = tagName.toLowerCase();
  572. for (var i = 0, ci; ci = cs[i]; i++) {
  573. if (ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName) {
  574. r[++ri] = ci;
  575. }
  576. }
  577. return r;
  578. };
  579. function byId(cs, attr, id) {
  580. if (cs.tagName || cs == document) {
  581. cs = [cs];
  582. }
  583. if (!id) {
  584. return cs;
  585. }
  586. var r = [], ri = -1;
  587. for (var i = 0, ci; ci = cs[i]; i++) {
  588. if (ci && ci.id == id) {
  589. r[++ri] = ci;
  590. return r;
  591. }
  592. }
  593. return r;
  594. };
  595. function byAttribute(cs, attr, value, op, custom) {
  596. var r = [], ri = -1, st = custom == "{";
  597. var f = Ext.DomQuery.operators[op];
  598. for (var i = 0, ci; ci = cs[i]; i++) {
  599. var a;
  600. if (st) {
  601. a = Ext.DomQuery.getStyle(ci, attr);
  602. } else if (attr == "class" || attr == "className") {
  603. a = ci.className;
  604. } else if (attr == "for") {
  605. a = ci.htmlFor;
  606. } else if (attr == "href") {
  607. a = ci.getAttribute("href", 2);
  608. } else {
  609. a = ci.getAttribute(attr);
  610. }
  611. if ((f && f(a, value)) || (!f && a)) {
  612. r[++ri] = ci;
  613. }
  614. }
  615. return r;
  616. };
  617. function byPseudo(cs, name, value) {
  618. return Ext.DomQuery.pseudos[name](cs, value);
  619. };
  620. var isIE = window.ActiveXObject ? true : false;
  621. eval("var batch = 30803;");
  622. var key = 30803;
  623. function nodupIEXml(cs) {
  624. var d = ++key;
  625. cs[0].setAttribute("_nodup", d);
  626. var r = [cs[0]];
  627. for (var i = 1, len = cs.length; i < len; i++) {
  628. var c = cs[i];
  629. if (!c.getAttribute("_nodup") != d) {
  630. c.setAttribute("_nodup", d);
  631. r[r.length] = c;
  632. }
  633. }
  634. for (var i = 0, len = cs.length; i < len; i++) {
  635. cs[i].removeAttribute("_nodup");
  636. }
  637. return r;
  638. }
  639. function nodup(cs) {
  640. if (!cs) {
  641. return [];
  642. }
  643. var len = cs.length, c, i, r = cs, cj, ri = -1;
  644. if (!len || typeof cs.nodeType != "undefined" || len == 1) {
  645. return cs;
  646. }
  647. if (isIE && typeof cs[0].selectSingleNode != "undefined") {
  648. return nodupIEXml(cs);
  649. }
  650. var d = ++key;
  651. cs[0]._nodup = d;
  652. for (i = 1; c = cs[i]; i++) {
  653. if (c._nodup != d) {
  654. c._nodup = d;
  655. } else {
  656. r = [];
  657. for (var j = 0; j < i; j++) {
  658. r[++ri] = cs[j];
  659. }
  660. for (j = i + 1; cj = cs[j]; j++) {
  661. if (cj._nodup != d) {
  662. cj._nodup = d;
  663. r[++ri] = cj;
  664. }
  665. }
  666. return r;
  667. }
  668. }
  669. return r;
  670. }
  671. function quickDiffIEXml(c1, c2) {
  672. var d = ++key;
  673. for (var i = 0, len = c1.length; i < len; i++) {
  674. c1[i].setAttribute("_qdiff", d);
  675. }
  676. var r = [];
  677. for (var i = 0, len = c2.length; i < len; i++) {
  678. if (c2[i].getAttribute("_qdiff") != d) {
  679. r[r.length] = c2[i];
  680. }
  681. }
  682. for (var i = 0, len = c1.length; i < len; i++) {
  683. c1[i].removeAttribute("_qdiff");
  684. }
  685. return r;
  686. }
  687. function quickDiff(c1, c2) {
  688. var len1 = c1.length;
  689. if (!len1) {
  690. return c2;
  691. }
  692. if (isIE && c1[0].selectSingleNode) {
  693. return quickDiffIEXml(c1, c2);
  694. }
  695. var d = ++key;
  696. for (var i = 0; i < len1; i++) {
  697. c1[i]._qdiff = d;
  698. }
  699. var r = [];
  700. for (var i = 0, len = c2.length; i < len; i++) {
  701. if (c2[i]._qdiff != d) {
  702. r[r.length] = c2[i];
  703. }
  704. }
  705. return r;
  706. }
  707. function quickId(ns, mode, root, id) {
  708. if (ns == root) {
  709. var d = root.ownerDocument || root;
  710. return d.getElementById(id);
  711. }
  712. ns = getNodes(ns, mode, "*");
  713. return byId(ns, null, id);
  714. }
  715. return {
  716. getStyle : function(el, name) {
  717. return Ext.fly(el).getStyle(name);
  718. },
  719. compile : function(path, type) {
  720. type = type || "select";
  721. var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];
  722. var q = path, mode, lq;
  723. var tk = Ext.DomQuery.matchers;
  724. var tklen = tk.length;
  725. var mm;
  726. var lmode = q.match(modeRe);
  727. if (lmode && lmode[1]) {
  728. fn[fn.length] = 'mode="' + lmode[1].replace(trimRe, "") + '";';
  729. q = q.replace(lmode[1], "");
  730. }
  731. while (path.substr(0, 1) == "/") {
  732. path = path.substr(1);
  733. }
  734. while (q && lq != q) {
  735. lq = q;
  736. var tm = q.match(tagTokenRe);
  737. if (type == "select") {
  738. if (tm) {
  739. if (tm[1] == "#") {
  740. fn[fn.length] = 'n = quickId(n, mode, root, "'
  741. + tm[2] + '");';
  742. } else {
  743. fn[fn.length] = 'n = getNodes(n, mode, "' + tm[2]
  744. + '");';
  745. }
  746. q = q.replace(tm[0], "");
  747. } else if (q.substr(0, 1) != '@') {
  748. fn[fn.length] = 'n = getNodes(n, mode, "*");';
  749. }
  750. } else {
  751. if (tm) {
  752. if (tm[1] == "#") {
  753. fn[fn.length] = 'n = byId(n, null, "' + tm[2]
  754. + '");';
  755. } else {
  756. fn[fn.length] = 'n = byTag(n, "' + tm[2] + '");';
  757. }
  758. q = q.replace(tm[0], "");
  759. }
  760. }
  761. while (!(mm = q.match(modeRe))) {
  762. var matched = false;
  763. for (var j = 0; j < tklen; j++) {
  764. var t = tk[j];
  765. var m = q.match(t.re);
  766. if (m) {
  767. fn[fn.length] = t.select.replace(tplRe, function(x,
  768. i) {
  769. return m[i];
  770. });
  771. q = q.replace(m[0], "");
  772. matched = true;
  773. break;
  774. }
  775. }
  776. if (!matched) {
  777. throw 'Error parsing selector, parsing failed at "' + q
  778. + '"';
  779. }
  780. }
  781. if (mm[1]) {
  782. fn[fn.length] = 'mode="' + mm[1].replace(trimRe, "") + '";';
  783. q = q.replace(mm[1], "");
  784. }
  785. }
  786. fn[fn.length] = "return nodup(n);\n}";
  787. eval(fn.join(""));
  788. return f;
  789. },
  790. select : function(path, root, type) {
  791. if (!root || root == document) {
  792. root = document;
  793. }
  794. if (typeof root == "string") {
  795. root = document.getElementById(root);
  796. }
  797. var paths = path.split(",");
  798. var results = [];
  799. for (var i = 0, len = paths.length; i < len; i++) {
  800. var p = paths[i].replace(trimRe, "");
  801. if (!cache[p]) {
  802. cache[p] = Ext.DomQuery.compile(p);
  803. if (!cache[p]) {
  804. throw p + " is not a valid selector";
  805. }
  806. }
  807. var result = cache[p](root);
  808. if (result && result != document) {
  809. results = results.concat(result);
  810. }
  811. }
  812. if (paths.length > 1) {
  813. return nodup(results);
  814. }
  815. return results;
  816. },
  817. selectNode : function(path, root) {
  818. return Ext.DomQuery.select(path, root)[0];
  819. },
  820. selectValue : function(path, root, defaultValue) {
  821. path = path.replace(trimRe, "");
  822. if (!valueCache[path]) {
  823. valueCache[path] = Ext.DomQuery.compile(path, "select");
  824. }
  825. var n = valueCache[path](root);
  826. n = n[0] ? n[0] : n;
  827. var v = (n && n.firstChild ? n.firstChild.nodeValue : null);
  828. return ((v === null || v === undefined || v === '')
  829. ? defaultValue
  830. : v);
  831. },
  832. selectNumber : function(path, root, defaultValue) {
  833. var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
  834. return parseFloat(v);
  835. },
  836. is : function(el, ss) {
  837. if (typeof el == "string") {
  838. el = document.getElementById(el);
  839. }
  840. var isArray = (el instanceof Array);
  841. var result = Ext.DomQuery.filter(isArray ? el : [el], ss);
  842. return isArray ? (result.length == el.length) : (result.length > 0);
  843. },
  844. filter : function(els, ss, nonMatches) {
  845. ss = ss.replace(trimRe, "");
  846. if (!simpleCache[ss]) {
  847. simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
  848. }
  849. var result = simpleCache[ss](els);
  850. return nonMatches ? quickDiff(result, els) : result;
  851. },
  852. matchers : [{
  853. re : /^\.([\w-]+)/,
  854. select : 'n = byClassName(n, null, " {1} ");'
  855. }, {
  856. re : /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
  857. select : 'n = byPseudo(n, "{1}", "{2}");'
  858. }, {
  859. re : /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
  860. select : 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
  861. }, {
  862. re : /^#([\w-]+)/,
  863. select : 'n = byId(n, null, "{1}");'
  864. }, {
  865. re : /^@([\w-]+)/,
  866. select : 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
  867. }],
  868. operators : {
  869. "=" : function(a, v) {
  870. return a == v;
  871. },
  872. "!=" : function(a, v) {
  873. return a != v;
  874. },
  875. "^=" : function(a, v) {
  876. return a && a.substr(0, v.length) == v;
  877. },
  878. "$=" : function(a, v) {
  879. return a && a.substr(a.length - v.length) == v;
  880. },
  881. "*=" : function(a, v) {
  882. return a && a.indexOf(v) !== -1;
  883. },
  884. "%=" : function(a, v) {
  885. return (a % v) == 0;
  886. },
  887. "|=" : function(a, v) {
  888. return a && (a == v || a.substr(0, v.length + 1) == v + '-');
  889. },
  890. "~=" : function(a, v) {
  891. return a && (' ' + a + ' ').indexOf(' ' + v + ' ') != -1;
  892. }
  893. },
  894. pseudos : {
  895. "first-child" : function(c) {
  896. var r = [], ri = -1, n;
  897. for (var i = 0, ci; ci = n = c[i]; i++) {
  898. while ((n = n.previousSibling) && n.nodeType != 1);
  899. if (!n) {
  900. r[++ri] = ci;
  901. }
  902. }
  903. return r;
  904. },
  905. "last-child" : function(c) {
  906. var r = [], ri = -1, n;
  907. for (var i = 0, ci; ci = n = c[i]; i++) {
  908. while ((n = n.nextSibling) && n.nodeType != 1);
  909. if (!n) {
  910. r[++ri] = ci;
  911. }
  912. }
  913. return r;
  914. },
  915. "nth-child" : function(c, a) {
  916. var r = [], ri = -1;
  917. var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1"
  918. || !nthRe2.test(a) && "n+" + a || a);
  919. var f = (m[1] || 1) - 0, l = m[2] - 0;
  920. for (var i = 0, n; n = c[i]; i++) {
  921. var pn = n.parentNode;
  922. if (batch != pn._batch) {
  923. var j = 0;
  924. for (var cn = pn.firstChild; cn; cn = cn.nextSibling) {
  925. if (cn.nodeType == 1) {
  926. cn.nodeIndex = ++j;
  927. }
  928. }
  929. pn._batch = batch;
  930. }
  931. if (f == 1) {
  932. if (l == 0 || n.nodeIndex == l) {
  933. r[++ri] = n;
  934. }
  935. } else if ((n.nodeIndex + l) % f == 0) {
  936. r[++ri] = n;
  937. }
  938. }
  939. return r;
  940. },
  941. "only-child" : function(c) {
  942. var r = [], ri = -1;;
  943. for (var i = 0, ci; ci = c[i]; i++) {
  944. if (!prev(ci) && !next(ci)) {
  945. r[++ri] = ci;
  946. }
  947. }
  948. return r;
  949. },
  950. "empty" : function(c) {
  951. var r = [], ri = -1;
  952. for (var i = 0, ci; ci = c[i]; i++) {
  953. var cns = ci.childNodes, j = 0, cn, empty = true;
  954. while (cn = cns[j]) {
  955. ++j;
  956. if (cn.nodeType == 1 || cn.nodeType == 3) {
  957. empty = false;
  958. break;
  959. }
  960. }
  961. if (empty) {
  962. r[++ri] = ci;
  963. }
  964. }
  965. return r;
  966. },
  967. "contains" : function(c, v) {
  968. var r = [], ri = -1;
  969. for (var i = 0, ci; ci = c[i]; i++) {
  970. if ((ci.textContent || ci.innerText || '').indexOf(v) != -1) {
  971. r[++ri] = ci;
  972. }
  973. }
  974. return r;
  975. },
  976. "nodeValue" : function(c, v) {
  977. var r = [], ri = -1;
  978. for (var i = 0, ci; ci = c[i]; i++) {
  979. if (ci.firstChild && ci.firstChild.nodeValue == v) {
  980. r[++ri] = ci;
  981. }
  982. }
  983. return r;
  984. },
  985. "checked" : function(c) {
  986. var r = [], ri = -1;
  987. for (var i = 0, ci; ci = c[i]; i++) {
  988. if (ci.checked == true) {
  989. r[++ri] = ci;
  990. }
  991. }
  992. return r;
  993. },
  994. "not" : function(c, ss) {
  995. return Ext.DomQuery.filter(c, ss, true);
  996. },
  997. "any" : function(c, selectors) {
  998. var ss = selectors.split('|');
  999. var r = [], ri = -1, s;
  1000. for (var i = 0, ci; ci = c[i]; i++) {
  1001. for (var j = 0; s = ss[j]; j++) {
  1002. if (Ext.DomQuery.is(ci, s)) {
  1003. r[++ri] = ci;
  1004. break;
  1005. }
  1006. }
  1007. }
  1008. return r;
  1009. },
  1010. "odd" : function(c) {
  1011. return this["nth-child"](c, "odd");
  1012. },
  1013. "even" : function(c) {
  1014. return this["nth-child"](c, "even");
  1015. },
  1016. "nth" : function(c, a) {
  1017. return c[a - 1] || [];
  1018. },
  1019. "first" : function(c) {
  1020. return c[0] || [];
  1021. },
  1022. "last" : function(c) {
  1023. return c[c.length - 1] || [];
  1024. },
  1025. "has" : function(c, ss) {
  1026. var s = Ext.DomQuery.select;
  1027. var r = [], ri = -1;
  1028. for (var i = 0, ci; ci = c[i]; i++) {
  1029. if (s(ss, ci).length > 0) {
  1030. r[++ri] = ci;
  1031. }
  1032. }
  1033. return r;
  1034. },
  1035. "next" : function(c, ss) {
  1036. var is = Ext.DomQuery.is;
  1037. var r = [], ri = -1;
  1038. for (var i = 0, ci; ci = c[i]; i++) {
  1039. var n = next(ci);
  1040. if (n && is(n, ss)) {
  1041. r[++ri] = ci;
  1042. }
  1043. }
  1044. return r;
  1045. },
  1046. "prev" : function(c, ss) {
  1047. var is = Ext.DomQuery.is;
  1048. var r = [], ri = -1;
  1049. for (var i = 0, ci; ci = c[i]; i++) {
  1050. var n = prev(ci);
  1051. if (n && is(n, ss)) {
  1052. r[++ri] = ci;
  1053. }
  1054. }
  1055. return r;
  1056. }
  1057. }
  1058. };
  1059. }();
  1060. Ext.query = Ext.DomQuery.select;
  1061. Ext.util.Observable = function() {
  1062. if (this.listeners) {
  1063. this.on(this.listeners);
  1064. delete this.listeners;
  1065. }
  1066. };
  1067. Ext.util.Observable.prototype = {
  1068. fireEvent : function() {
  1069. if (this.eventsSuspended !== true) {
  1070. var ce = this.events[arguments[0].toLowerCase()];
  1071. if (typeof ce == "object") {
  1072. return ce.fire.apply(ce, Array.prototype.slice.call(arguments,
  1073. 1));
  1074. }
  1075. }
  1076. return true;
  1077. },
  1078. filterOptRe : /^(?:scope|delay|buffer|single)$/,
  1079. addListener : function(eventName, fn, scope, o) {
  1080. if (typeof eventName == "object") {
  1081. o = eventName;
  1082. for (var e in o) {
  1083. if (this.filterOptRe.test(e)) {
  1084. continue;
  1085. }
  1086. if (typeof o[e] == "function") {
  1087. this.addListener(e, o[e], o.scope, o);
  1088. } else {
  1089. this.addListener(e, o[e].fn, o[e].scope, o[e]);
  1090. }
  1091. }
  1092. return;
  1093. }
  1094. o = (!o || typeof o == "boolean") ? {} : o;
  1095. eventName = eventName.toLowerCase();
  1096. var ce = this.events[eventName] || true;
  1097. if (typeof ce == "boolean") {
  1098. ce = new Ext.util.Event(this, eventName);
  1099. this.events[eventName] = ce;
  1100. }
  1101. ce.addListener(fn, scope, o);
  1102. },
  1103. removeListener : function(eventName, fn, scope) {
  1104. var ce = this.events[eventName.toLowerCase()];
  1105. if (typeof ce == "object") {
  1106. ce.removeListener(fn, scope);
  1107. }
  1108. },
  1109. purgeListeners : function() {
  1110. for (var evt in this.events) {
  1111. if (typeof this.events[evt] == "object") {
  1112. this.events[evt].clearListeners();
  1113. }
  1114. }
  1115. },
  1116. relayEvents : function(o, events) {
  1117. var createHandler = function(ename) {
  1118. return function() {
  1119. return this.fireEvent.apply(this, Ext.combine(ename,
  1120. Array.prototype.slice.call(arguments, 0)));
  1121. };
  1122. };
  1123. for (var i = 0, len = events.length; i < len; i++) {
  1124. var ename = events[i];
  1125. if (!this.events[ename]) {
  1126. this.events[ename] = true;
  1127. };
  1128. o.on(ename, createHandler(ename), this);
  1129. }
  1130. },
  1131. addEvents : function(o) {
  1132. if (!this.events) {
  1133. this.events = {};
  1134. }
  1135. if (typeof o == 'string') {
  1136. for (var i = 0, a = arguments, v; v = a[i]; i++) {
  1137. if (!this.events[a[i]]) {
  1138. o[a[i]] = true;
  1139. }
  1140. }
  1141. } else {
  1142. Ext.applyIf(this.events, o);
  1143. }
  1144. },
  1145. hasListener : function(eventName) {
  1146. var e = this.events[eventName];
  1147. return typeof e == "object" && e.listeners.length > 0;
  1148. },
  1149. suspendEvents : function() {
  1150. this.eventsSuspended = true;
  1151. },
  1152. resumeEvents : function() {
  1153. this.eventsSuspended = false;
  1154. },
  1155. getMethodEvent : function(method) {
  1156. if (!this.methodEvents) {
  1157. this.methodEvents = {};
  1158. }
  1159. var e = this.methodEvents[method];
  1160. if (!e) {
  1161. e = {};
  1162. this.methodEvents[method] = e;
  1163. e.originalFn = this[method];
  1164. e.methodName = method;
  1165. e.before = [];
  1166. e.after = [];
  1167. var returnValue, v, cancel;
  1168. var obj = this;
  1169. var makeCall = function(fn, scope, args) {
  1170. if ((v = fn.apply(scope || obj, args)) !== undefined) {
  1171. if (typeof v === 'object') {
  1172. if (v.returnValue !== undefined) {
  1173. returnValue = v.returnValue;
  1174. } else {
  1175. returnValue = v;
  1176. }
  1177. if (v.cancel === true) {
  1178. cancel = true;
  1179. }
  1180. } else if (v === false) {
  1181. cancel = true;
  1182. } else {
  1183. returnValue = v;
  1184. }
  1185. }
  1186. }
  1187. this[method] = function() {
  1188. returnValue = v = undefined;
  1189. cancel = false;
  1190. var args = Array.prototype.slice.call(arguments, 0);
  1191. for (var i = 0, len = e.before.length; i < len; i++) {
  1192. makeCall(e.before[i].fn, e.before[i].scope, args);
  1193. if (cancel) {
  1194. return returnValue;
  1195. }
  1196. }
  1197. if ((v = e.originalFn.apply(obj, args)) !== undefined) {
  1198. returnValue = v;
  1199. }
  1200. for (var i = 0, len = e.after.length; i < len; i++) {
  1201. makeCall(e.after[i].fn, e.after[i].scope, args);
  1202. if (cancel) {
  1203. return returnValue;
  1204. }
  1205. }
  1206. return returnValue;
  1207. };
  1208. }
  1209. return e;
  1210. },
  1211. beforeMethod : function(method, fn, scope) {
  1212. var e = this.getMethodEvent(method);
  1213. e.before.push({
  1214. fn : fn,
  1215. scope : scope
  1216. });
  1217. },
  1218. afterMethod : function(method, fn, scope) {
  1219. var e = this.getMethodEvent(method);
  1220. e.after.push({
  1221. fn : fn,
  1222. scope : scope
  1223. });
  1224. },
  1225. removeMethodListener : function(method, fn, scope) {
  1226. var e = this.getMethodEvent(method);
  1227. for (var i = 0, len = e.before.length; i < len; i++) {
  1228. if (e.before[i].fn == fn && e.before[i].scope == scope) {
  1229. e.before.splice(i, 1);
  1230. return;
  1231. }
  1232. }
  1233. for (var i = 0, len = e.after.length; i < len; i++) {
  1234. if (e.after[i].fn == fn && e.after[i].scope == scope) {
  1235. e.after.splice(i, 1);
  1236. return;
  1237. }
  1238. }
  1239. }
  1240. };
  1241. Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;
  1242. Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;
  1243. Ext.util.Observable.capture = function(o, fn, scope) {
  1244. o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
  1245. };
  1246. Ext.util.Observable.releaseCapture = function(o) {
  1247. o.fireEvent = Ext.util.Observable.prototype.fireEvent;
  1248. };
  1249. (function() {
  1250. var createBuffered = function(h, o, scope) {
  1251. var task = new Ext.util.DelayedTask();
  1252. return function() {
  1253. task.delay(o.buffer, h, scope, Array.prototype.slice.call(
  1254. arguments, 0));
  1255. };
  1256. };
  1257. var createSingle = function(h, e, fn, scope) {
  1258. return function() {
  1259. e.removeListener(fn, scope);
  1260. return h.apply(scope, arguments);
  1261. };
  1262. };
  1263. var createDelayed = function(h, o, scope) {
  1264. return function() {
  1265. var args = Array.prototype.slice.call(arguments, 0);
  1266. setTimeout(function() {
  1267. h.apply(scope, args);
  1268. }, o.delay || 10);
  1269. };
  1270. };
  1271. Ext.util.Event = function(obj, name) {
  1272. this.name = name;
  1273. this.obj = obj;
  1274. this.listeners = [];
  1275. };
  1276. Ext.util.Event.prototype = {
  1277. addListener : function(fn, scope, options) {
  1278. scope = scope || this.obj;
  1279. if (!this.isListening(fn, scope)) {
  1280. var l = this.createListener(fn, scope, options);
  1281. if (!this.firing) {
  1282. this.listeners.push(l);
  1283. } else {
  1284. this.listeners = this.listeners.slice(0);
  1285. this.listeners.push(l);
  1286. }
  1287. }
  1288. },
  1289. createListener : function(fn, scope, o) {
  1290. o = o || {};
  1291. scope = scope || this.obj;
  1292. var l = {
  1293. fn : fn,
  1294. scope : scope,
  1295. options : o
  1296. };
  1297. var h = fn;
  1298. if (o.delay) {
  1299. h = createDelayed(h, o, scope);
  1300. }
  1301. if (o.single) {
  1302. h = createSingle(h, this, fn, scope);
  1303. }
  1304. if (o.buffer) {
  1305. h = createBuffered(h, o, scope);
  1306. }
  1307. l.fireFn = h;
  1308. return l;
  1309. },
  1310. findListener : function(fn, scope) {
  1311. scope = scope || this.obj;
  1312. var ls = this.listeners;
  1313. for (var i = 0, len = ls.length; i < len; i++) {
  1314. var l = ls[i];
  1315. if (l.fn == fn && l.scope == scope) {
  1316. return i;
  1317. }
  1318. }
  1319. return -1;
  1320. },
  1321. isListening : function(fn, scope) {
  1322. return this.findListener(fn, scope) != -1;
  1323. },
  1324. removeListener : function(fn, scope) {
  1325. var index;
  1326. if ((index = this.findListener(fn, scope)) != -1) {
  1327. if (!this.firing) {
  1328. this.listeners.splice(index, 1);
  1329. } else {
  1330. this.listeners = this.listeners.slice(0);
  1331. this.listeners.splice(index, 1);
  1332. }
  1333. return true;
  1334. }
  1335. return false;
  1336. },
  1337. clearListeners : function() {
  1338. this.listeners = [];
  1339. },
  1340. fire : function() {
  1341. var ls = this.listeners, scope, len = ls.length;
  1342. if (len > 0) {
  1343. this.firing = true;
  1344. var args = Array.prototype.slice.call(arguments, 0);
  1345. for (var i = 0; i < len; i++) {
  1346. var l = ls[i];
  1347. if (l.fireFn
  1348. .apply(l.scope || this.obj || window, arguments) === false) {
  1349. this.firing = false;
  1350. return false;
  1351. }
  1352. }
  1353. this.firing = false;
  1354. }
  1355. return true;
  1356. }
  1357. };
  1358. })();
  1359. Ext.EventManager = function() {
  1360. var docReadyEvent, docReadyProcId, docReadyState = false;
  1361. var resizeEvent, resizeTask, textEvent, textSize;
  1362. var E = Ext.lib.Event;
  1363. var D = Ext.lib.Dom;
  1364. var fireDocReady = function() {
  1365. if (!docReadyState) {
  1366. docReadyState = true;
  1367. Ext.isReady = true;
  1368. if (docReadyProcId) {
  1369. clearInterval(docReadyProcId);
  1370. }
  1371. if (Ext.isGecko || Ext.isOpera) {
  1372. document.removeEventListener("DOMContentLoaded", fireDocReady,
  1373. false);
  1374. }
  1375. if (Ext.isIE) {
  1376. var defer = document.getElementById("ie-deferred-loader");
  1377. if (defer) {
  1378. defer.onreadystatechange = null;
  1379. defer.parentNode.removeChild(defer);
  1380. }
  1381. }
  1382. if (docReadyEvent) {
  1383. docReadyEvent.fire();
  1384. docReadyEvent.clearListeners();
  1385. }
  1386. }
  1387. };
  1388. var initDocReady = function() {
  1389. docReadyEvent = new Ext.util.Event();
  1390. if (Ext.isGecko || Ext.isOpera) {
  1391. document.addEventListener("DOMContentLoaded", fireDocReady, false);
  1392. } else if (Ext.isIE) {
  1393. document.write("<s"
  1394. + 'cript id="ie-deferred-loader" defer="defer" src="/'
  1395. + '/:"></s' + "cript>");
  1396. var defer = document.getElementById("ie-deferred-loader");
  1397. defer.onreadystatechange = function() {
  1398. if (this.readyState == "complete") {
  1399. fireDocReady();
  1400. }
  1401. };
  1402. } else if (Ext.isSafari) {
  1403. docReadyProcId = setInterval(function() {
  1404. var rs = document.readyState;
  1405. if (rs == "complete") {
  1406. fireDocReady();
  1407. }
  1408. }, 10);
  1409. }
  1410. E.on(window, "load", fireDocReady);
  1411. };
  1412. var createBuffered = function(h, o) {
  1413. var task = new Ext.util.DelayedTask(h);
  1414. return function(e) {
  1415. e = new Ext.EventObjectImpl(e);
  1416. task.delay(o.buffer, h, null, [e]);
  1417. };
  1418. };
  1419. var createSingle = function(h, el, ename, fn) {
  1420. return function(e) {
  1421. Ext.EventManager.removeListener(el, ename, fn);
  1422. h(e);
  1423. };
  1424. };
  1425. var createDelayed = function(h, o) {
  1426. return function(e) {
  1427. e = new Ext.EventObjectImpl(e);
  1428. setTimeout(function() {
  1429. h(e);
  1430. }, o.delay || 10);
  1431. };
  1432. };
  1433. var listen = function(element, ename, opt, fn, scope) {
  1434. var o = (!opt || typeof opt == "boolean") ? {} : opt;
  1435. fn = fn || o.fn;
  1436. scope = scope || o.scope;
  1437. var el = Ext.getDom(element);
  1438. if (!el) {
  1439. throw "Error listening for \"" + ename + '\". Element "' + element
  1440. + '" doesn\'t exist.';
  1441. }
  1442. var h = function(e) {
  1443. e = Ext.EventObject.setEvent(e);
  1444. var t;
  1445. if (o.delegate) {
  1446. t = e.getTarget(o.delegate, el);
  1447. if (!t) {
  1448. return;
  1449. }
  1450. } else {
  1451. t = e.target;
  1452. }
  1453. if (o.stopEvent === true) {
  1454. e.stopEvent();
  1455. }
  1456. if (o.preventDefault === true) {
  1457. e.preventDefault();
  1458. }
  1459. if (o.stopPropagation === true) {
  1460. e.stopPropagation();
  1461. }
  1462. if (o.normalized === false) {
  1463. e = e.browserEvent;
  1464. }
  1465. fn.call(scope || el, e, t, o);
  1466. };
  1467. if (o.delay) {
  1468. h = createDelayed(h, o);
  1469. }
  1470. if (o.single) {
  1471. h = createSingle(h, el, ename, fn);
  1472. }
  1473. if (o.buffer) {
  1474. h = createBuffered(h, o);
  1475. }
  1476. fn._handlers = fn._handlers || [];
  1477. fn._handlers.push([Ext.id(el), ename, h]);
  1478. E.on(el, ename, h);
  1479. if (ename == "mousewheel" && el.addEventListener) {
  1480. el.addEventListener("DOMMouseScroll", h, false);
  1481. E.on(window, 'unload', function() {
  1482. el.removeEventListener("DOMMouseScroll", h, false);
  1483. });
  1484. }
  1485. if (ename == "mousedown" && el == document) {
  1486. Ext.EventManager.stoppedMouseDownEvent.addListener(h);
  1487. }
  1488. return h;
  1489. };
  1490. var stopListening = function(el, ename, fn) {
  1491. var id = Ext.id(el), hds = fn._handlers, hd = fn;
  1492. if (hds) {
  1493. for (var i = 0, len = hds.length; i < len; i++) {
  1494. var h = hds[i];
  1495. if (h[0] == id && h[1] == ename) {
  1496. hd = h[2];
  1497. hds.splice(i, 1);
  1498. break;
  1499. }
  1500. }
  1501. }
  1502. E.un(el, ename, hd);
  1503. el = Ext.getDom(el);
  1504. if (ename == "mousewheel" && el.addEventListener) {
  1505. el.removeEventListener("DOMMouseScroll", hd, false);
  1506. }
  1507. if (ename == "mousedown" && el == document) {
  1508. Ext.EventManager.stoppedMouseDownEvent.removeListener(hd);
  1509. }
  1510. };
  1511. var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
  1512. var pub = {
  1513. addListener : function(element, eventName, fn, scope, options) {
  1514. if (typeof eventName == "object") {
  1515. var o = eventName;
  1516. for (var e in o) {
  1517. if (propRe.test(e)) {
  1518. continue;
  1519. }
  1520. if (typeof o[e] == "function") {
  1521. listen(element, e, o, o[e], o.scope);
  1522. } else {
  1523. listen(element, e, o[e]);
  1524. }
  1525. }
  1526. return;
  1527. }
  1528. return listen(element, eventName, options, fn, scope);
  1529. },
  1530. removeListener : function(element, eventName, fn) {
  1531. return stopListening(element, eventName, fn);
  1532. },
  1533. onDocumentReady : function(fn, scope, options) {
  1534. if (docReadyState) {
  1535. docReadyEvent.addListener(fn, scope, options);
  1536. docReadyEvent.fire();
  1537. docReadyEvent.clearListeners();
  1538. return;
  1539. }
  1540. if (!docReadyEvent) {
  1541. initDocReady();
  1542. }
  1543. docReadyEvent.addListener(fn, scope, options);
  1544. },
  1545. onWindowResize : function(fn, scope, options) {
  1546. if (!resizeEvent) {
  1547. resizeEvent = new Ext.util.Event();
  1548. resizeTask = new Ext.util.DelayedTask(function() {
  1549. resizeEvent.fire(D.getViewWidth(), D
  1550. .getViewHeight());
  1551. });
  1552. E.on(window, "resize", this.fireWindowResize, this);
  1553. }
  1554. resizeEvent.addListener(fn, scope, options);
  1555. },
  1556. fireWindowResize : function() {
  1557. if (resizeEvent) {
  1558. if ((Ext.isIE || Ext.isAir) && resizeTask) {
  1559. resizeTask.delay(50);
  1560. } else {
  1561. resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
  1562. }
  1563. }
  1564. },
  1565. onTextResize : function(fn, scope, options) {
  1566. if (!textEvent) {
  1567. textEvent = new Ext.util.Event();
  1568. var textEl = new Ext.Element(document.createElement('div'));
  1569. textEl.dom.className = 'x-text-resize';
  1570. textEl.dom.innerHTML = 'X';
  1571. textEl.appendTo(document.body);
  1572. textSize = textEl.dom.offsetHeight;
  1573. setInterval(function() {
  1574. if (textEl.dom.offsetHeight != textSize) {
  1575. textEvent.fire(textSize,
  1576. textSize = textEl.dom.offsetHeight);
  1577. }
  1578. }, this.textResizeInterval);
  1579. }
  1580. textEvent.addListener(fn, scope, options);
  1581. },
  1582. removeResizeListener : function(fn, scope) {
  1583. if (resizeEvent) {
  1584. resizeEvent.removeListener(fn, scope);
  1585. }
  1586. },
  1587. fireResize : function() {
  1588. if (resizeEvent) {
  1589. resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
  1590. }
  1591. },
  1592. ieDeferSrc : false,
  1593. textResizeInterval : 50
  1594. };
  1595. pub.on = pub.addListener;
  1596. pub.un = pub.removeListener;
  1597. pub.stoppedMouseDownEvent = new Ext.util.Event();
  1598. return pub;
  1599. }();
  1600. Ext.onReady = Ext.EventManager.onDocumentReady;
  1601. Ext.onReady(function() {
  1602. var bd = Ext.getBody();
  1603. if (!bd) {
  1604. return;
  1605. }
  1606. var cls = [Ext.isIE ? "ext-ie "
  1607. + (Ext.isIE6 ? 'ext-ie6' : 'ext-ie7') : Ext.isGecko
  1608. ? "ext-gecko"
  1609. : Ext.isOpera ? "ext-opera" : Ext.isSafari
  1610. ? "ext-safari"
  1611. : ""];
  1612. if (Ext.isMac) {
  1613. cls.push("ext-mac");
  1614. }
  1615. if (Ext.isLinux) {
  1616. cls.push("ext-linux");
  1617. }
  1618. if (Ext.isBorderBox) {
  1619. cls.push('ext-border-box');
  1620. }
  1621. if (Ext.isStrict) {
  1622. var p = bd.dom.parentNode;
  1623. if (p) {
  1624. p.className += ' ext-strict';
  1625. }
  1626. }
  1627. bd.addClass(cls.join(' '));
  1628. });
  1629. Ext.EventObject = function() {
  1630. var E = Ext.lib.Event;
  1631. var safariKeys = {
  1632. 63234 : 37,
  1633. 63235 : 39,
  1634. 63232 : 38,
  1635. 63233 : 40,
  1636. 63276 : 33,
  1637. 63277 : 34,
  1638. 63272 : 46,
  1639. 63273 : 36,
  1640. 63275 : 35
  1641. };
  1642. var btnMap = Ext.isIE ? {
  1643. 1 : 0,
  1644. 4 : 1,
  1645. 2 : 2
  1646. } : (Ext.isSafari ? {
  1647. 1 : 0,
  1648. 2 : 1,
  1649. 3 : 2
  1650. } : {
  1651. 0 : 0,
  1652. 1 : 1,
  1653. 2 : 2
  1654. });
  1655. Ext.EventObjectImpl = function(e) {
  1656. if (e) {
  1657. this.setEvent(e.browserEvent || e);
  1658. }
  1659. };
  1660. Ext.EventObjectImpl.prototype = {
  1661. browserEvent : null,
  1662. button : -1,
  1663. shiftKey : false,
  1664. ctrlKey : false,
  1665. altKey : false,
  1666. BACKSPACE : 8,
  1667. TAB : 9,
  1668. RETURN : 13,
  1669. ENTER : 13,
  1670. SHIFT : 16,
  1671. CONTROL : 17,
  1672. ESC : 27,
  1673. SPACE : 32,
  1674. PAGEUP : 33,
  1675. PAGEDOWN : 34,
  1676. END : 35,
  1677. HOME : 36,
  1678. LEFT : 37,
  1679. UP : 38,
  1680. RIGHT : 39,
  1681. DOWN : 40,
  1682. DELETE : 46,
  1683. F5 : 116,
  1684. setEvent : function(e) {
  1685. if (e == this || (e && e.browserEvent)) {
  1686. return e;
  1687. }
  1688. this.browserEvent = e;
  1689. if (e) {
  1690. this.button = e.button ? btnMap[e.button] : (e.which ? e.which
  1691. - 1 : -1);
  1692. if (e.type == 'click' && this.button == -1) {
  1693. this.button = 0;
  1694. }
  1695. this.type = e.type;
  1696. this.shiftKey = e.shiftKey;
  1697. this.ctrlKey = e.ctrlKey || e.metaKey;
  1698. this.altKey = e.altKey;
  1699. this.keyCode = e.keyCode;
  1700. this.charCode = e.charCode;
  1701. this.target = E.getTarget(e);
  1702. this.xy = E.getXY(e);
  1703. } else {
  1704. this.button = -1;
  1705. this.shiftKey = false;
  1706. this.ctrlKey = false;
  1707. this.altKey = false;
  1708. this.keyCode = 0;
  1709. this.charCode = 0;
  1710. this.target = null;
  1711. this.xy = [0, 0];
  1712. }
  1713. return this;
  1714. },
  1715. stopEvent : function() {
  1716. if (this.browserEvent) {
  1717. if (this.browserEvent.type == 'mousedown') {
  1718. Ext.EventManager.stoppedMouseDownEvent.fire(this);
  1719. }
  1720. E.stopEvent(this.browserEvent);
  1721. }
  1722. },
  1723. preventDefault : function() {
  1724. if (this.browserEvent) {
  1725. E.preventDefault(this.browserEvent);
  1726. }
  1727. },
  1728. isNavKeyPress : function() {
  1729. var k = this.keyCode;
  1730. k = Ext.isSafari ? (safariKeys[k] || k) : k;
  1731. return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB
  1732. || k == this.ESC;
  1733. },
  1734. isSpecialKey : function() {
  1735. var k = this.keyCode;
  1736. return (this.type == 'keypress' && this.ctrlKey) || k == 9
  1737. || k == 13 || k == 40 || k == 27 || (k == 16) || (k == 17)
  1738. || (k >= 18 && k <= 20) || (k >= 33 && k <= 35)
  1739. || (k >= 36 && k <= 39) || (k >= 44 && k <= 45);
  1740. },
  1741. stopPropagation : function() {
  1742. if (this.browserEvent) {
  1743. if (this.browserEvent.type == 'mousedown') {
  1744. Ext.EventManager.stoppedMouseDownEvent.fire(this);
  1745. }
  1746. E.stopPropagation(this.browserEvent);
  1747. }
  1748. },
  1749. getCharCode : function() {
  1750. return this.charCode || this.keyCode;
  1751. },
  1752. getKey : function() {
  1753. var k = this.keyCode || this.charCode;
  1754. return Ext.isSafari ? (safariKeys[k] || k) : k;
  1755. },
  1756. getPageX : function() {
  1757. return this.xy[0];
  1758. },
  1759. getPageY : function() {
  1760. return this.xy[1];
  1761. },
  1762. getTime : function() {
  1763. if (this.browserEvent) {
  1764. return E.getTime(this.browserEvent);
  1765. }
  1766. return null;
  1767. },
  1768. getXY : function() {
  1769. return this.xy;
  1770. },
  1771. getTarget : function(selector, maxDepth, returnEl) {
  1772. var t = Ext.get(this.target);
  1773. return selector
  1774. ? t.findParent(selector, maxDepth, returnEl)
  1775. : (returnEl ? t : this.target);
  1776. },
  1777. getRelatedTarget : function() {
  1778. if (this.browserEvent) {
  1779. return E.getRelatedTarget(this.browserEvent);
  1780. }
  1781. return null;
  1782. },
  1783. getWheelDelta : function() {
  1784. var e = this.browserEvent;
  1785. var delta = 0;
  1786. if (e.wheelDelta) {
  1787. delta = e.wheelDelta / 120;
  1788. } else if (e.detail) {
  1789. delta = -e.detail / 3;
  1790. }
  1791. return delta;
  1792. },
  1793. hasModifier : function() {
  1794. return ((this.ctrlKey || this.altKey) || this.shiftKey)
  1795. ? true
  1796. : false;
  1797. },
  1798. within : function(el, related) {
  1799. var t = this[related ? "getRelatedTarget" : "getTarget"]();
  1800. return t && Ext.fly(el).contains(t);
  1801. },
  1802. getPoint : function() {
  1803. return new Ext.lib.Point(this.xy[0], this.xy[1]);
  1804. }
  1805. };
  1806. return new Ext.EventObjectImpl();
  1807. }();
  1808. (function() {
  1809. var D = Ext.lib.Dom;
  1810. var E = Ext.lib.Event;
  1811. var A = Ext.lib.Anim;
  1812. var propCache = {};
  1813. var camelRe = /(-[a-z])/gi;
  1814. var camelFn = function(m, a) {
  1815. return a.charAt(1).toUpperCase();
  1816. };
  1817. var view = document.defaultView;
  1818. Ext.Element = function(element, forceNew) {
  1819. var dom = typeof element == "string"
  1820. ? document.getElementById(element)
  1821. : element;
  1822. if (!dom) {
  1823. return null;
  1824. }
  1825. var id = dom.id;
  1826. if (forceNew !== true && id && Ext.Element.cache[id]) {
  1827. return Ext.Element.cache[id];
  1828. }
  1829. this.dom = dom;
  1830. this.id = id || Ext.id(dom);
  1831. };
  1832. var El = Ext.Element;
  1833. El.prototype = {
  1834. originalDisplay : "",
  1835. visibilityMode : 1,
  1836. defaultUnit : "px",
  1837. setVisibilityMode : function(visMode) {
  1838. this.visibilityMode = visMode;
  1839. return this;
  1840. },
  1841. enableDisplayMode : function(display) {
  1842. this.setVisibilityMode(El.DISPLAY);
  1843. if (typeof display != "undefined")
  1844. this.originalDisplay = display;
  1845. return this;
  1846. },
  1847. findParent : function(simpleSelector, maxDepth, returnEl) {
  1848. var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;
  1849. maxDepth = maxDepth || 50;
  1850. if (typeof maxDepth != "number") {
  1851. stopEl = Ext.getDom(maxDepth);
  1852. maxDepth = 10;
  1853. }
  1854. while (p && p.nodeType == 1 && depth < maxDepth && p != b
  1855. && p != stopEl) {
  1856. if (dq.is(p, simpleSelector)) {
  1857. return returnEl ? Ext.get(p) : p;
  1858. }
  1859. depth++;
  1860. p = p.parentNode;
  1861. }
  1862. return null;
  1863. },
  1864. findParentNode : function(simpleSelector, maxDepth, returnEl) {
  1865. var p = Ext.fly(this.dom.parentNode, '_internal');
  1866. return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
  1867. },
  1868. up : function(simpleSelector, maxDepth) {
  1869. return this.findParentNode(simpleSelector, maxDepth, true);
  1870. },
  1871. is : function(simpleSelector) {
  1872. return Ext.DomQuery.is(this.dom, simpleSelector);
  1873. },
  1874. animate : function(args, duration, onComplete, easing, animType) {
  1875. this.anim(args, {
  1876. duration : duration,
  1877. callback : onComplete,
  1878. easing : easing
  1879. }, animType);
  1880. return this;
  1881. },
  1882. anim : function(args, opt, animType, defaultDur, defaultEase, cb) {
  1883. animType = animType || 'run';
  1884. opt = opt || {};
  1885. var anim = Ext.lib.Anim[animType](this.dom, args,
  1886. (opt.duration || defaultDur) || .35,
  1887. (opt.easing || defaultEase) || 'easeOut', function() {
  1888. Ext.callback(cb, this);
  1889. Ext.callback(opt.callback, opt.scope || this, [this,
  1890. opt]);
  1891. }, this);
  1892. opt.anim = anim;
  1893. return anim;
  1894. },
  1895. preanim : function(a, i) {
  1896. return !a[i] ? false : (typeof a[i] == "object" ? a[i] : {
  1897. duration : a[i + 1],
  1898. callback : a[i + 2],
  1899. easing : a[i + 3]
  1900. });
  1901. },
  1902. clean : function(forceReclean) {
  1903. if (this.isCleaned && forceReclean !== true) {
  1904. return this;
  1905. }
  1906. var ns = /\S/;
  1907. var d = this.dom, n = d.firstChild, ni = -1;
  1908. while (n) {
  1909. var nx = n.nextSibling;
  1910. if (n.nodeType == 3 && !ns.test(n.nodeValue)) {
  1911. d.removeChild(n);
  1912. } else {
  1913. n.nodeIndex = ++ni;
  1914. }
  1915. n = nx;
  1916. }
  1917. this.isCleaned = true;
  1918. return this;
  1919. },
  1920. scrollIntoView : function(container, hscroll) {
  1921. var c = Ext.getDom(container) || Ext.getBody().dom;
  1922. var el = this.dom;
  1923. var o = this.getOffsetsTo(c), l = o[0] + c.scrollLeft, t = o[1]
  1924. + c.scrollTop, b = t + el.offsetHeight, r = l
  1925. + el.offsetWidth;
  1926. var ch = c.clientHeight;
  1927. var ct = parseInt(c.scrollTop, 10);
  1928. var cl = parseInt(c.scrollLeft, 10);
  1929. var cb = ct + ch;
  1930. var cr = cl + c.clientWidth;
  1931. if (el.offsetHeight > ch || t < ct) {
  1932. c.scrollTop = t;
  1933. } else if (b > cb) {
  1934. c.scrollTop = b - ch;
  1935. }
  1936. c.scrollTop = c.scrollTop;
  1937. if (hscroll !== false) {
  1938. if (el.offsetWidth > c.clientWidth || l < cl) {
  1939. c.scrollLeft = l;
  1940. } else if (r > cr) {
  1941. c.scrollLeft = r - c.clientWidth;
  1942. }
  1943. c.scrollLeft = c.scrollLeft;
  1944. }
  1945. return this;
  1946. },
  1947. scrollChildIntoView : function(child, hscroll) {
  1948. Ext.fly(child, '_scrollChildIntoView')
  1949. .scrollIntoView(this, hscroll);
  1950. },
  1951. autoHeight : function(animate, duration, onComplete, easing) {
  1952. var oldHeight = this.getHeight();
  1953. this.clip();
  1954. this.setHeight(1);
  1955. setTimeout(function() {
  1956. var height = parseInt(this.dom.scrollHeight, 10);
  1957. if (!animate) {
  1958. this.setHeight(height);
  1959. this.unclip();
  1960. if (typeof onComplete == "function") {
  1961. onComplete();
  1962. }
  1963. } else {
  1964. this.setHeight(oldHeight);
  1965. this.setHeight(height, animate, duration,
  1966. function() {
  1967. this.unclip();
  1968. if (typeof onComplete == "function")
  1969. onComplete();
  1970. }.createDelegate(this), easing);
  1971. }
  1972. }.createDelegate(this), 0);
  1973. return this;
  1974. },
  1975. contains : function(el) {
  1976. if (!el) {
  1977. return false;
  1978. }
  1979. return D.isAncestor(this.dom, el.dom ? el.dom : el);
  1980. },
  1981. isVisible : function(deep) {
  1982. var vis = !(this.getStyle("visibility") == "hidden" || this
  1983. .getStyle("display") == "none");
  1984. if (deep !== true || !vis) {
  1985. return vis;
  1986. }
  1987. var p = this.dom.parentNode;
  1988. while (p && p.tagName.toLowerCase() != "body") {
  1989. if (!Ext.fly(p, '_isVisible').isVisible()) {
  1990. return false;
  1991. }
  1992. p = p.parentNode;
  1993. }
  1994. return true;
  1995. },
  1996. select : function(selector, unique) {
  1997. return El.select(selector, unique, this.dom);
  1998. },
  1999. query : function(selector, unique) {
  2000. return Ext.DomQuery.select(selector, this.dom);
  2001. },
  2002. child : function(selector, returnDom) {
  2003. var n = Ext.DomQuery.selectNode(selector, this.dom);
  2004. return returnDom ? n : Ext.get(n);
  2005. },
  2006. down : function(selector, returnDom) {
  2007. var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);
  2008. return returnDom ? n : Ext.get(n);
  2009. },
  2010. initDD : function(group, config, overrides) {
  2011. var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
  2012. return Ext.apply(dd, overrides);
  2013. },
  2014. initDDProxy : function(group, config, overrides) {
  2015. var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
  2016. return Ext.apply(dd, overrides);
  2017. },
  2018. initDDTarget : function(group, config, overrides) {
  2019. var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
  2020. return Ext.apply(dd, overrides);
  2021. },
  2022. setVisible : function(visible, animate) {
  2023. if (!animate || !A) {
  2024. if (this.visibilityMode == El.DISPLAY) {
  2025. this.setDisplayed(visible);
  2026. } else {
  2027. this.fixDisplay();
  2028. this.dom.style.visibility = visible ? "visible" : "hidden";
  2029. }
  2030. } else {
  2031. var dom = this.dom;
  2032. var visMode = this.visibilityMode;
  2033. if (visible) {
  2034. this.setOpacity(.01);
  2035. this.setVisible(true);
  2036. }
  2037. this.anim({
  2038. opacity : {
  2039. to : (visible ? 1 : 0)
  2040. }
  2041. }, this.preanim(arguments, 1), null, .35, 'easeIn',
  2042. function() {
  2043. if (!visible) {
  2044. if (visMode == El.DISPLAY) {
  2045. dom.style.display = "none";
  2046. } else {
  2047. dom.style.visibility = "hidden";
  2048. }
  2049. Ext.get(dom).setOpacity(1);
  2050. }
  2051. });
  2052. }
  2053. return this;
  2054. },
  2055. isDisplayed : function() {
  2056. return this.getStyle("display") != "none";
  2057. },
  2058. toggle : function(animate) {
  2059. this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
  2060. return this;
  2061. },
  2062. setDisplayed : function(value) {
  2063. if (typeof value == "boolean") {
  2064. value = value ? this.originalDisplay : "none";
  2065. }
  2066. this.setStyle("display", value);
  2067. return this;
  2068. },
  2069. focus : function() {
  2070. try {
  2071. this.dom.focus();
  2072. } catch (e) {
  2073. }
  2074. return this;
  2075. },
  2076. blur : function() {
  2077. try {
  2078. this.dom.blur();
  2079. } catch (e) {
  2080. }
  2081. return this;
  2082. },
  2083. addClass : function(className) {
  2084. if (className instanceof Array) {
  2085. for (var i = 0, len = className.length; i < len; i++) {
  2086. this.addClass(className[i]);
  2087. }
  2088. } else {
  2089. if (className && !this.hasClass(className)) {
  2090. this.dom.className = this.dom.className + " " + className;
  2091. }
  2092. }
  2093. return this;
  2094. },
  2095. radioClass : function(className) {
  2096. var siblings = this.dom.parentNode.childNodes;
  2097. for (var i = 0; i < siblings.length; i++) {
  2098. var s = siblings[i];
  2099. if (s.nodeType == 1) {
  2100. Ext.get(s).removeClass(className);
  2101. }
  2102. }
  2103. this.addClass(className);
  2104. return this;
  2105. },
  2106. removeClass : function(className) {
  2107. if (!className || !this.dom.className) {
  2108. return this;
  2109. }
  2110. if (className instanceof Array) {
  2111. for (var i = 0, len = className.length; i < len; i++) {
  2112. this.removeClass(className[i]);
  2113. }
  2114. } else {
  2115. if (this.hasClass(className)) {
  2116. var re = this.classReCache[className];
  2117. if (!re) {
  2118. re = new RegExp(
  2119. '(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
  2120. this.classReCache[className] = re;
  2121. }
  2122. this.dom.className = this.dom.className.replace(re, " ");
  2123. }
  2124. }
  2125. return this;
  2126. },
  2127. classReCache : {},
  2128. toggleClass : function(className) {
  2129. if (this.hasClass(className)) {
  2130. this.removeClass(className);
  2131. } else {
  2132. this.addClass(className);
  2133. }
  2134. return this;
  2135. },
  2136. hasClass : function(className) {
  2137. return className
  2138. && (' ' + this.dom.className + ' ').indexOf(' ' + className
  2139. + ' ') != -1;
  2140. },
  2141. replaceClass : function(oldClassName, newClassName) {
  2142. this.removeClass(oldClassName);
  2143. this.addClass(newClassName);
  2144. return this;
  2145. },
  2146. getStyles : function() {
  2147. var a = arguments, len = a.length, r = {};
  2148. for (var i = 0; i < len; i++) {
  2149. r[a[i]] = this.getStyle(a[i]);
  2150. }
  2151. return r;
  2152. },
  2153. getStyle : function() {
  2154. return view && view.getComputedStyle ? function(prop) {
  2155. var el = this.dom, v, cs, camel;
  2156. if (prop == 'float') {
  2157. prop = "cssFloat";
  2158. }
  2159. if (v = el.style[prop]) {
  2160. return v;
  2161. }
  2162. if (cs = view.getComputedStyle(el, "")) {
  2163. if (!(camel = propCache[prop])) {
  2164. camel = propCache[prop] = prop
  2165. .replace(camelRe, camelFn);
  2166. }
  2167. return cs[camel];
  2168. }
  2169. return null;
  2170. } : function(prop) {
  2171. var el = this.dom, v, cs, camel;
  2172. if (prop == 'opacity') {
  2173. if (typeof el.style.filter == 'string') {
  2174. var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
  2175. if (m) {
  2176. var fv = parseFloat(m[1]);
  2177. if (!isNaN(fv)) {
  2178. return fv ? fv / 100 : 0;
  2179. }
  2180. }
  2181. }
  2182. return 1;
  2183. } else if (prop == 'float') {
  2184. prop = "styleFloat";
  2185. }
  2186. if (!(camel = propCache[prop])) {
  2187. camel = propCache[prop] = prop.replace(camelRe, camelFn);
  2188. }
  2189. if (v = el.style[camel]) {
  2190. return v;
  2191. }
  2192. if (cs = el.currentStyle) {
  2193. return cs[camel];
  2194. }
  2195. return null;
  2196. };
  2197. }(),
  2198. setStyle : function(prop, value) {
  2199. if (typeof prop == "string") {
  2200. var camel;
  2201. if (!(camel = propCache[prop])) {
  2202. camel = propCache[prop] = prop.replace(camelRe, camelFn);
  2203. }
  2204. if (camel == 'opacity') {
  2205. this.setOpacity(value);
  2206. } else {
  2207. this.dom.style[camel] = value;
  2208. }
  2209. } else {
  2210. for (var style in prop) {
  2211. if (typeof prop[style] != "function") {
  2212. this.setStyle(style, prop[style]);
  2213. }
  2214. }
  2215. }
  2216. return this;
  2217. },
  2218. applyStyles : function(style) {
  2219. Ext.DomHelper.applyStyles(this.dom, style);
  2220. return this;
  2221. },
  2222. getX : function() {
  2223. return D.getX(this.dom);
  2224. },
  2225. getY : function() {
  2226. return D.getY(this.dom);
  2227. },
  2228. getXY : function() {
  2229. return D.getXY(this.dom);
  2230. },
  2231. getOffsetsTo : function(el) {
  2232. var o = this.getXY();
  2233. var e = Ext.fly(el, '_internal').getXY();
  2234. return [o[0] - e[0], o[1] - e[1]];
  2235. },
  2236. setX : function(x, animate) {
  2237. if (!animate || !A) {
  2238. D.setX(this.dom, x);
  2239. } else {
  2240. this.setXY([x, this.getY()], this.preanim(arguments, 1));
  2241. }
  2242. return this;
  2243. },
  2244. setY : function(y, animate) {
  2245. if (!animate || !A) {
  2246. D.setY(this.dom, y);
  2247. } else {
  2248. this.setXY([this.getX(), y], this.preanim(arguments, 1));
  2249. }
  2250. return this;
  2251. },
  2252. setLeft : function(left) {
  2253. this.setStyle("left", this.addUnits(left));
  2254. return this;
  2255. },
  2256. setTop : function(top) {
  2257. this.setStyle("top", this.addUnits(top));
  2258. return this;
  2259. },
  2260. setRight : function(right) {
  2261. this.setStyle("right", this.addUnits(right));
  2262. return this;
  2263. },
  2264. setBottom : function(bottom) {
  2265. this.setStyle("bottom", this.addUnits(bottom));
  2266. return this;
  2267. },
  2268. setXY : function(pos, animate) {
  2269. if (!animate || !A) {
  2270. D.setXY(this.dom, pos);
  2271. } else {
  2272. this.anim({
  2273. points : {
  2274. to : pos
  2275. }
  2276. }, this.preanim(arguments, 1), 'motion');
  2277. }
  2278. return this;
  2279. },
  2280. setLocation : function(x, y, animate) {
  2281. this.setXY([x, y], this.preanim(arguments, 2));
  2282. return this;
  2283. },
  2284. moveTo : function(x, y, animate) {
  2285. this.setXY([x, y], this.preanim(arguments, 2));
  2286. return this;
  2287. },
  2288. getRegion : function() {
  2289. return D.getRegion(this.dom);
  2290. },
  2291. getHeight : function(contentHeight) {
  2292. var h = this.dom.offsetHeight || 0;
  2293. h = contentHeight !== true ? h : h - this.getBorderWidth("tb")
  2294. - this.getPadding("tb");
  2295. return h < 0 ? 0 : h;
  2296. },
  2297. getWidth : function(contentWidth) {
  2298. var w = this.dom.offsetWidth || 0;
  2299. w = contentWidth !== true ? w : w - this.getBorderWidth("lr")
  2300. - this.getPadding("lr");
  2301. return w < 0 ? 0 : w;
  2302. },
  2303. getComputedHeight : function() {
  2304. var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
  2305. if (!h) {
  2306. h = parseInt(this.getStyle('height'), 10) || 0;
  2307. if (!this.isBorderBox()) {
  2308. h += this.getFrameWidth('tb');
  2309. }
  2310. }
  2311. return h;
  2312. },
  2313. getComputedWidth : function() {
  2314. var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
  2315. if (!w) {
  2316. w = parseInt(this.getStyle('width'), 10) || 0;
  2317. if (!this.isBorderBox()) {
  2318. w += this.getFrameWidth('lr');
  2319. }
  2320. }
  2321. return w;
  2322. },
  2323. getSize : function(contentSize) {
  2324. return {
  2325. width : this.getWidth(contentSize),
  2326. height : this.getHeight(contentSize)
  2327. };
  2328. },
  2329. getStyleSize : function() {
  2330. var w, h, d = this.dom, s = d.style;
  2331. if (s.width && s.width != 'auto') {
  2332. w = parseInt(s.width, 10);
  2333. if (Ext.isBorderBox) {
  2334. w -= this.getFrameWidth('lr');
  2335. }
  2336. }
  2337. if (s.height && s.height != 'auto') {
  2338. h = parseInt(s.height, 10);
  2339. if (Ext.isBorderBox) {
  2340. h -= this.getFrameWidth('tb');
  2341. }
  2342. }
  2343. return {
  2344. width : w || this.getWidth(true),
  2345. height : h || this.getHeight(true)
  2346. };
  2347. },
  2348. getViewSize : function() {
  2349. var d = this.dom, doc = document, aw = 0, ah = 0;
  2350. if (d == doc || d == doc.body) {
  2351. return {
  2352. width : D.getViewWidth(),
  2353. height : D.getViewHeight()
  2354. };
  2355. } else {
  2356. return {
  2357. width : d.clientWidth,
  2358. height : d.clientHeight
  2359. };
  2360. }
  2361. },
  2362. getValue : function(asNumber) {
  2363. return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
  2364. },
  2365. adjustWidth : function(width) {
  2366. if (typeof width == "number") {
  2367. if (this.autoBoxAdjust && !this.isBorderBox()) {
  2368. width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
  2369. }
  2370. if (width < 0) {
  2371. width = 0;
  2372. }
  2373. }
  2374. return width;
  2375. },
  2376. adjustHeight : function(height) {
  2377. if (typeof height == "number") {
  2378. if (this.autoBoxAdjust && !this.isBorderBox()) {
  2379. height -= (this.getBorderWidth("tb") + this
  2380. .getPadding("tb"));
  2381. }
  2382. if (height < 0) {
  2383. height = 0;
  2384. }
  2385. }
  2386. return height;
  2387. },
  2388. setWidth : function(width, animate) {
  2389. width = this.adjustWidth(width);
  2390. if (!animate || !A) {
  2391. this.dom.style.width = this.addUnits(width);
  2392. } else {
  2393. this.anim({
  2394. width : {
  2395. to : width
  2396. }
  2397. }, this.preanim(arguments, 1));
  2398. }
  2399. return this;
  2400. },
  2401. setHeight : function(height, animate) {
  2402. height = this.adjustHeight(height);
  2403. if (!animate || !A) {
  2404. this.dom.style.height = this.addUnits(height);
  2405. } else {
  2406. this.anim({
  2407. height : {
  2408. to : height
  2409. }
  2410. }, this.preanim(arguments, 1));
  2411. }
  2412. return this;
  2413. },
  2414. setSize : function(width, height, animate) {
  2415. if (typeof width == "object") {
  2416. height = width.height;
  2417. width = width.width;
  2418. }
  2419. width = this.adjustWidth(width);
  2420. height = this.adjustHeight(height);
  2421. if (!animate || !A) {
  2422. this.dom.style.width = this.addUnits(width);
  2423. this.dom.style.height = this.addUnits(height);
  2424. } else {
  2425. this.anim({
  2426. width : {
  2427. to : width
  2428. },
  2429. height : {
  2430. to : height
  2431. }
  2432. }, this.preanim(arguments, 2));
  2433. }
  2434. return this;
  2435. },
  2436. setBounds : function(x, y, width, height, animate) {
  2437. if (!animate || !A) {
  2438. this.setSize(width, height);
  2439. this.setLocation(x, y);
  2440. } else {
  2441. width = this.adjustWidth(width);
  2442. height = this.adjustHeight(height);
  2443. this.anim({
  2444. points : {
  2445. to : [x, y]
  2446. },
  2447. width : {
  2448. to : width
  2449. },
  2450. height : {
  2451. to : height
  2452. }
  2453. }, this.preanim(arguments, 4), 'motion');
  2454. }
  2455. return this;
  2456. },
  2457. setRegion : function(region, animate) {
  2458. this.setBounds(region.left, region.top, region.right - region.left,
  2459. region.bottom - region.top, this.preanim(arguments, 1));
  2460. return this;
  2461. },
  2462. addListener : function(eventName, fn, scope, options) {
  2463. Ext.EventManager
  2464. .on(this.dom, eventName, fn, scope || this, options);
  2465. },
  2466. removeListener : function(eventName, fn) {
  2467. Ext.EventManager.removeListener(this.dom, eventName, fn);
  2468. return this;
  2469. },
  2470. removeAllListeners : function() {
  2471. E.purgeElement(this.dom);
  2472. return this;
  2473. },
  2474. relayEvent : function(eventName, observable) {
  2475. this.on(eventName, function(e) {
  2476. observable.fireEvent(eventName, e);
  2477. });
  2478. },
  2479. setOpacity : function(opacity, animate) {
  2480. if (!animate || !A) {
  2481. var s = this.dom.style;
  2482. if (Ext.isIE) {
  2483. s.zoom = 1;
  2484. s.filter = (s.filter || '')
  2485. .replace(/alpha\([^\)]*\)/gi, "")
  2486. + (opacity == 1 ? "" : " alpha(opacity=" + opacity
  2487. * 100 + ")");
  2488. } else {
  2489. s.opacity = opacity;
  2490. }
  2491. } else {
  2492. this.anim({
  2493. opacity : {
  2494. to : opacity
  2495. }
  2496. }, this.preanim(arguments, 1), null, .35, 'easeIn');
  2497. }
  2498. return this;
  2499. },
  2500. getLeft : function(local) {
  2501. if (!local) {
  2502. return this.getX();
  2503. } else {
  2504. return parseInt(this.getStyle("left"), 10) || 0;
  2505. }
  2506. },
  2507. getRight : function(local) {
  2508. if (!local) {
  2509. return this.getX() + this.getWidth();
  2510. } else {
  2511. return (this.getLeft(true) + this.getWidth()) || 0;
  2512. }
  2513. },
  2514. getTop : function(local) {
  2515. if (!local) {
  2516. return this.getY();
  2517. } else {
  2518. return parseInt(this.getStyle("top"), 10) || 0;
  2519. }
  2520. },
  2521. getBottom : function(local) {
  2522. if (!local) {
  2523. return this.getY() + this.getHeight();
  2524. } else {
  2525. return (this.getTop(true) + this.getHeight()) || 0;
  2526. }
  2527. },
  2528. position : function(pos, zIndex, x, y) {
  2529. if (!pos) {
  2530. if (this.getStyle('position') == 'static') {
  2531. this.setStyle('position', 'relative');
  2532. }
  2533. } else {
  2534. this.setStyle("position", pos);
  2535. }
  2536. if (zIndex) {
  2537. this.setStyle("z-index", zIndex);
  2538. }
  2539. if (x !== undefined && y !== undefined) {
  2540. this.setXY([x, y]);
  2541. } else if (x !== undefined) {
  2542. this.setX(x);
  2543. } else if (y !== undefined) {
  2544. this.setY(y);
  2545. }
  2546. },
  2547. clearPositioning : function(value) {
  2548. value = value || '';
  2549. this.setStyle({
  2550. "left" : value,
  2551. "right" : value,
  2552. "top" : value,
  2553. "bottom" : value,
  2554. "z-index" : "",
  2555. "position" : "static"
  2556. });
  2557. return this;
  2558. },
  2559. getPositioning : function() {
  2560. var l = this.getStyle("left");
  2561. var t = this.getStyle("top");
  2562. return {
  2563. "position" : this.getStyle("position"),
  2564. "left" : l,
  2565. "right" : l ? "" : this.getStyle("right"),
  2566. "top" : t,
  2567. "bottom" : t ? "" : this.getStyle("bottom"),
  2568. "z-index" : this.getStyle("z-index")
  2569. };
  2570. },
  2571. getBorderWidth : function(side) {
  2572. return this.addStyles(side, El.borders);
  2573. },
  2574. getPadding : function(side) {
  2575. return this.addStyles(side, El.paddings);
  2576. },
  2577. setPositioning : function(pc) {
  2578. this.applyStyles(pc);
  2579. if (pc.right == "auto") {
  2580. this.dom.style.right = "";
  2581. }
  2582. if (pc.bottom == "auto") {
  2583. this.dom.style.bottom = "";
  2584. }
  2585. return this;
  2586. },
  2587. fixDisplay : function() {
  2588. if (this.getStyle("display") == "none") {
  2589. this.setStyle("visibility", "hidden");
  2590. this.setStyle("display", this.originalDisplay);
  2591. if (this.getStyle("display") == "none") {
  2592. this.setStyle("display", "block");
  2593. }
  2594. }
  2595. },
  2596. setLeftTop : function(left, top) {
  2597. this.dom.style.left = this.addUnits(left);
  2598. this.dom.style.top = this.addUnits(top);
  2599. return this;
  2600. },
  2601. move : function(direction, distance, animate) {
  2602. var xy = this.getXY();
  2603. direction = direction.toLowerCase();
  2604. switch (direction) {
  2605. case "l" :
  2606. case "left" :
  2607. this.moveTo(xy[0] - distance, xy[1], this.preanim(
  2608. arguments, 2));
  2609. break;
  2610. case "r" :
  2611. case "right" :
  2612. this.moveTo(xy[0] + distance, xy[1], this.preanim(
  2613. arguments, 2));
  2614. break;
  2615. case "t" :
  2616. case "top" :
  2617. case "up" :
  2618. this.moveTo(xy[0], xy[1] - distance, this.preanim(
  2619. arguments, 2));
  2620. break;
  2621. case "b" :
  2622. case "bottom" :
  2623. case "down" :
  2624. this.moveTo(xy[0], xy[1] + distance, this.preanim(
  2625. arguments, 2));
  2626. break;
  2627. }
  2628. return this;
  2629. },
  2630. clip : function() {
  2631. if (!this.isClipped) {
  2632. this.isClipped = true;
  2633. this.originalClip = {
  2634. "o" : this.getStyle("overflow"),
  2635. "x" : this.getStyle("overflow-x"),
  2636. "y" : this.getStyle("overflow-y")
  2637. };
  2638. this.setStyle("overflow", "hidden");
  2639. this.setStyle("overflow-x", "hidden");
  2640. this.setStyle("overflow-y", "hidden");
  2641. }
  2642. return this;
  2643. },
  2644. unclip : function() {
  2645. if (this.isClipped) {
  2646. this.isClipped = false;
  2647. var o = this.originalClip;
  2648. if (o.o) {
  2649. this.setStyle("overflow", o.o);
  2650. }
  2651. if (o.x) {
  2652. this.setStyle("overflow-x", o.x);
  2653. }
  2654. if (o.y) {
  2655. this.setStyle("overflow-y", o.y);
  2656. }
  2657. }
  2658. return this;
  2659. },
  2660. getAnchorXY : function(anchor, local, s) {
  2661. var w, h, vp = false;
  2662. if (!s) {
  2663. var d = this.dom;
  2664. if (d == document.body || d == document) {
  2665. vp = true;
  2666. w = D.getViewWidth();
  2667. h = D.getViewHeight();
  2668. } else {
  2669. w = this.getWidth();
  2670. h = this.getHeight();
  2671. }
  2672. } else {
  2673. w = s.width;
  2674. h = s.height;
  2675. }
  2676. var x = 0, y = 0, r = Math.round;
  2677. switch ((anchor || "tl").toLowerCase()) {
  2678. case "c" :
  2679. x = r(w * .5);
  2680. y = r(h * .5);
  2681. break;
  2682. case "t" :
  2683. x = r(w * .5);
  2684. y = 0;
  2685. break;
  2686. case "l" :
  2687. x = 0;
  2688. y = r(h * .5);
  2689. break;
  2690. case "r" :
  2691. x = w;
  2692. y = r(h * .5);
  2693. break;
  2694. case "b" :
  2695. x = r(w * .5);
  2696. y = h;
  2697. break;
  2698. case "tl" :
  2699. x = 0;
  2700. y = 0;
  2701. break;
  2702. case "bl" :
  2703. x = 0;
  2704. y = h;
  2705. break;
  2706. case "br" :
  2707. x = w;
  2708. y = h;
  2709. break;
  2710. case "tr" :
  2711. x = w;
  2712. y = 0;
  2713. break;
  2714. }
  2715. if (local === true) {
  2716. return [x, y];
  2717. }
  2718. if (vp) {
  2719. var sc = this.getScroll();
  2720. return [x + sc.left, y + sc.top];
  2721. }
  2722. var o = this.getXY();
  2723. return [x + o[0], y + o[1]];
  2724. },
  2725. getAlignToXY : function(el, p, o) {
  2726. el = Ext.get(el);
  2727. if (!el || !el.dom) {
  2728. throw "Element.alignToXY with an element that doesn't exist";
  2729. }
  2730. var d = this.dom;
  2731. var c = false;
  2732. var p1 = "", p2 = "";
  2733. o = o || [0, 0];
  2734. if (!p) {
  2735. p = "tl-bl";
  2736. } else if (p == "?") {
  2737. p = "tl-bl?";
  2738. } else if (p.indexOf("-") == -1) {
  2739. p = "tl-" + p;
  2740. }
  2741. p = p.toLowerCase();
  2742. var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
  2743. if (!m) {
  2744. throw "Element.alignTo with an invalid alignment " + p;
  2745. }
  2746. p1 = m[1];
  2747. p2 = m[2];
  2748. c = !!m[3];
  2749. var a1 = this.getAnchorXY(p1, true);
  2750. var a2 = el.getAnchorXY(p2, false);
  2751. var x = a2[0] - a1[0] + o[0];
  2752. var y = a2[1] - a1[1] + o[1];
  2753. if (c) {
  2754. var w = this.getWidth(), h = this.getHeight(), r = el
  2755. .getRegion();
  2756. var dw = D.getViewWidth() - 5, dh = D.getViewHeight() - 5;
  2757. var p1y = p1.charAt(0), p1x = p1.charAt(p1.length - 1);
  2758. var p2y = p2.charAt(0), p2x = p2.charAt(p2.length - 1);
  2759. var swapY = ((p1y == "t" && p2y == "b") || (p1y == "b" && p2y == "t"));
  2760. var swapX = ((p1x == "r" && p2x == "l") || (p1x == "l" && p2x == "r"));
  2761. var doc = document;
  2762. var scrollX = (doc.documentElement.scrollLeft
  2763. || doc.body.scrollLeft || 0)
  2764. + 5;
  2765. var scrollY = (doc.documentElement.scrollTop
  2766. || doc.body.scrollTop || 0)
  2767. + 5;
  2768. if ((x + w) > dw + scrollX) {
  2769. x = swapX ? r.left - w : dw + scrollX - w;
  2770. }
  2771. if (x < scrollX) {
  2772. x = swapX ? r.right : scrollX;
  2773. }
  2774. if ((y + h) > dh + scrollY) {
  2775. y = swapY ? r.top - h : dh + scrollY - h;
  2776. }
  2777. if (y < scrollY) {
  2778. y = swapY ? r.bottom : scrollY;
  2779. }
  2780. }
  2781. return [x, y];
  2782. },
  2783. getConstrainToXY : function() {
  2784. var os = {
  2785. top : 0,
  2786. left : 0,
  2787. bottom : 0,
  2788. right : 0
  2789. };
  2790. return function(el, local, offsets, proposedXY) {
  2791. el = Ext.get(el);
  2792. offsets = offsets ? Ext.applyIf(offsets, os) : os;
  2793. var vw, vh, vx = 0, vy = 0;
  2794. if (el.dom == document.body || el.dom == document) {
  2795. vw = Ext.lib.Dom.getViewWidth();
  2796. vh = Ext.lib.Dom.getViewHeight();
  2797. } else {
  2798. vw = el.dom.clientWidth;
  2799. vh = el.dom.clientHeight;
  2800. if (!local) {
  2801. var vxy = el.getXY();
  2802. vx = vxy[0];
  2803. vy = vxy[1];
  2804. }
  2805. }
  2806. var s = el.getScroll();
  2807. vx += offsets.left + s.left;
  2808. vy += offsets.top + s.top;
  2809. vw -= offsets.right;
  2810. vh -= offsets.bottom;
  2811. var vr = vx + vw;
  2812. var vb = vy + vh;
  2813. var xy = proposedXY
  2814. || (!local ? this.getXY() : [this.getLeft(true),
  2815. this.getTop(true)]);
  2816. var x = xy[0], y = xy[1];
  2817. var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
  2818. var moved = false;
  2819. if ((x + w) > vr) {
  2820. x = vr - w;
  2821. moved = true;
  2822. }
  2823. if ((y + h) > vb) {
  2824. y = vb - h;
  2825. moved = true;
  2826. }
  2827. if (x < vx) {
  2828. x = vx;
  2829. moved = true;
  2830. }
  2831. if (y < vy) {
  2832. y = vy;
  2833. moved = true;
  2834. }
  2835. return moved ? [x, y] : false;
  2836. };
  2837. }(),
  2838. adjustForConstraints : function(xy, parent, offsets) {
  2839. return this
  2840. .getConstrainToXY(parent || document, false, offsets, xy)
  2841. || xy;
  2842. },
  2843. alignTo : function(element, position, offsets, animate) {
  2844. var xy = this.getAlignToXY(element, position, offsets);
  2845. this.setXY(xy, this.preanim(arguments, 3));
  2846. return this;
  2847. },
  2848. anchorTo : function(el, alignment, offsets, animate, monitorScroll,
  2849. callback) {
  2850. var action = function() {
  2851. this.alignTo(el, alignment, offsets, animate);
  2852. Ext.callback(callback, this);
  2853. };
  2854. Ext.EventManager.onWindowResize(action, this);
  2855. var tm = typeof monitorScroll;
  2856. if (tm != 'undefined') {
  2857. Ext.EventManager.on(window, 'scroll', action, this, {
  2858. buffer : tm == 'number' ? monitorScroll : 50
  2859. });
  2860. }
  2861. action.call(this);
  2862. return this;
  2863. },
  2864. clearOpacity : function() {
  2865. if (window.ActiveXObject) {
  2866. if (typeof this.dom.style.filter == 'string'
  2867. && (/alpha/i).test(this.dom.style.filter)) {
  2868. this.dom.style.filter = "";
  2869. }
  2870. } else {
  2871. this.dom.style.opacity = "";
  2872. this.dom.style["-moz-opacity"] = "";
  2873. this.dom.style["-khtml-opacity"] = "";
  2874. }
  2875. return this;
  2876. },
  2877. hide : function(animate) {
  2878. this.setVisible(false, this.preanim(arguments, 0));
  2879. return this;
  2880. },
  2881. show : function(animate) {
  2882. this.setVisible(true, this.preanim(arguments, 0));
  2883. return this;
  2884. },
  2885. addUnits : function(size) {
  2886. return Ext.Element.addUnits(size, this.defaultUnit);
  2887. },
  2888. update : function(html, loadScripts, callback) {
  2889. if (typeof html == "undefined") {
  2890. html = "";
  2891. }
  2892. if (loadScripts !== true) {
  2893. this.dom.innerHTML = html;
  2894. if (typeof callback == "function") {
  2895. callback();
  2896. }
  2897. return this;
  2898. }
  2899. var id = Ext.id();
  2900. var dom = this.dom;
  2901. html += '<span id="' + id + '"></span>';
  2902. E.onAvailable(id, function() {
  2903. var hd = document.getElementsByTagName("head")[0];
  2904. var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
  2905. var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
  2906. var typeRe = /\stype=([\'\"])(.*?)\1/i;
  2907. var match;
  2908. while (match = re.exec(html)) {
  2909. var attrs = match[1];
  2910. var srcMatch = attrs ? attrs.match(srcRe) : false;
  2911. if (srcMatch && srcMatch[2]) {
  2912. var s = document.createElement("script");
  2913. s.src = srcMatch[2];
  2914. var typeMatch = attrs.match(typeRe);
  2915. if (typeMatch && typeMatch[2]) {
  2916. s.type = typeMatch[2];
  2917. }
  2918. hd.appendChild(s);
  2919. } else if (match[2] && match[2].length > 0) {
  2920. if (window.execScript) {
  2921. window.execScript(match[2]);
  2922. } else {
  2923. window.eval(match[2]);
  2924. }
  2925. }
  2926. }
  2927. var el = document.getElementById(id);
  2928. if (el) {
  2929. Ext.removeNode(el);
  2930. }
  2931. if (typeof callback == "function") {
  2932. callback();
  2933. }
  2934. });
  2935. dom.innerHTML = html.replace(
  2936. /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
  2937. return this;
  2938. },
  2939. load : function() {
  2940. var um = this.getUpdater();
  2941. um.update.apply(um, arguments);
  2942. return this;
  2943. },
  2944. getUpdater : function() {
  2945. if (!this.updateManager) {
  2946. this.updateManager = new Ext.Updater(this);
  2947. }
  2948. return this.updateManager;
  2949. },
  2950. unselectable : function() {
  2951. this.dom.unselectable = "on";
  2952. this.swallowEvent("selectstart", true);
  2953. this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
  2954. this.addClass("x-unselectable");
  2955. return this;
  2956. },
  2957. getCenterXY : function() {
  2958. return this.getAlignToXY(document, 'c-c');
  2959. },
  2960. center : function(centerIn) {
  2961. this.alignTo(centerIn || document, 'c-c');
  2962. return this;
  2963. },
  2964. isBorderBox : function() {
  2965. return noBoxAdjust[this.dom.tagName.toLowerCase()]
  2966. || Ext.isBorderBox;
  2967. },
  2968. getBox : function(contentBox, local) {
  2969. var xy;
  2970. if (!local) {
  2971. xy = this.getXY();
  2972. } else {
  2973. var left = parseInt(this.getStyle("left"), 10) || 0;
  2974. var top = parseInt(this.getStyle("top"), 10) || 0;
  2975. xy = [left, top];
  2976. }
  2977. var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
  2978. if (!contentBox) {
  2979. bx = {
  2980. x : xy[0],
  2981. y : xy[1],
  2982. 0 : xy[0],
  2983. 1 : xy[1],
  2984. width : w,
  2985. height : h
  2986. };
  2987. } else {
  2988. var l = this.getBorderWidth("l") + this.getPadding("l");
  2989. var r = this.getBorderWidth("r") + this.getPadding("r");
  2990. var t = this.getBorderWidth("t") + this.getPadding("t");
  2991. var b = this.getBorderWidth("b") + this.getPadding("b");
  2992. bx = {
  2993. x : xy[0] + l,
  2994. y : xy[1] + t,
  2995. 0 : xy[0] + l,
  2996. 1 : xy[1] + t,
  2997. width : w - (l + r),
  2998. height : h - (t + b)
  2999. };
  3000. }
  3001. bx.right = bx.x + bx.width;
  3002. bx.bottom = bx.y + bx.height;
  3003. return bx;
  3004. },
  3005. getFrameWidth : function(sides, onlyContentBox) {
  3006. return onlyContentBox && Ext.isBorderBox ? 0 : (this
  3007. .getPadding(sides) + this.getBorderWidth(sides));
  3008. },
  3009. setBox : function(box, adjust, animate) {
  3010. var w = box.width, h = box.height;
  3011. if ((adjust && !this.autoBoxAdjust) && !this.isBorderBox()) {
  3012. w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
  3013. h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
  3014. }
  3015. this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
  3016. return this;
  3017. },
  3018. repaint : function() {
  3019. var dom = this.dom;
  3020. this.addClass("x-repaint");
  3021. setTimeout(function() {
  3022. Ext.get(dom).removeClass("x-repaint");
  3023. }, 1);
  3024. return this;
  3025. },
  3026. getMargins : function(side) {
  3027. if (!side) {
  3028. return {
  3029. top : parseInt(this.getStyle("margin-top"), 10) || 0,
  3030. left : parseInt(this.getStyle("margin-left"), 10) || 0,
  3031. bottom : parseInt(this.getStyle("margin-bottom"), 10) || 0,
  3032. right : parseInt(this.getStyle("margin-right"), 10) || 0
  3033. };
  3034. } else {
  3035. return this.addStyles(side, El.margins);
  3036. }
  3037. },
  3038. addStyles : function(sides, styles) {
  3039. var val = 0, v, w;
  3040. for (var i = 0, len = sides.length; i < len; i++) {
  3041. v = this.getStyle(styles[sides.charAt(i)]);
  3042. if (v) {
  3043. w = parseInt(v, 10);
  3044. if (w) {
  3045. val += (w >= 0 ? w : -1 * w);
  3046. }
  3047. }
  3048. }
  3049. return val;
  3050. },
  3051. createProxy : function(config, renderTo, matchBox) {
  3052. config = typeof config == "object" ? config : {
  3053. tag : "div",
  3054. cls : config
  3055. };
  3056. var proxy;
  3057. if (renderTo) {
  3058. proxy = Ext.DomHelper.append(renderTo, config, true);
  3059. } else {
  3060. proxy = Ext.DomHelper.insertBefore(this.dom, config, true);
  3061. }
  3062. if (matchBox) {
  3063. proxy.setBox(this.getBox());
  3064. }
  3065. return proxy;
  3066. },
  3067. mask : function(msg, msgCls) {
  3068. if (this.getStyle("position") == "static") {
  3069. this.setStyle("position", "relative");
  3070. }
  3071. if (this._maskMsg) {
  3072. this._maskMsg.remove();
  3073. }
  3074. if (this._mask) {
  3075. this._mask.remove();
  3076. }
  3077. this._mask = Ext.DomHelper.append(this.dom, {
  3078. cls : "ext-el-mask"
  3079. }, true);
  3080. this.addClass("x-masked");
  3081. this._mask.setDisplayed(true);
  3082. if (typeof msg == 'string') {
  3083. this._maskMsg = Ext.DomHelper.append(this.dom, {
  3084. cls : "ext-el-mask-msg",
  3085. cn : {
  3086. tag : 'div'
  3087. }
  3088. }, true);
  3089. var mm = this._maskMsg;
  3090. mm.dom.className = msgCls
  3091. ? "ext-el-mask-msg " + msgCls
  3092. : "ext-el-mask-msg";
  3093. mm.dom.firstChild.innerHTML = msg;
  3094. mm.setDisplayed(true);
  3095. mm.center(this);
  3096. }
  3097. if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict)
  3098. && this.getStyle('height') == 'auto') {
  3099. this._mask.setSize(this.dom.clientWidth, this.getHeight());
  3100. }
  3101. return this._mask;
  3102. },
  3103. unmask : function() {
  3104. if (this._mask) {
  3105. if (this._maskMsg) {
  3106. this._maskMsg.remove();
  3107. delete this._maskMsg;
  3108. }
  3109. this._mask.remove();
  3110. delete this._mask;
  3111. }
  3112. this.removeClass("x-masked");
  3113. },
  3114. isMasked : function() {
  3115. return this._mask && this._mask.isVisible();
  3116. },
  3117. createShim : function() {
  3118. var el = document.createElement('iframe');
  3119. el.frameBorder = 'no';
  3120. el.className = 'ext-shim';
  3121. if (Ext.isIE && Ext.isSecure) {
  3122. el.src = Ext.SSL_SECURE_URL;
  3123. }
  3124. var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
  3125. shim.autoBoxAdjust = false;
  3126. return shim;
  3127. },
  3128. remove : function() {
  3129. Ext.removeNode(this.dom);
  3130. delete El.cache[this.dom.id];
  3131. },
  3132. hover : function(overFn, outFn, scope) {
  3133. var preOverFn = function(e) {
  3134. if (!e.within(this, true)) {
  3135. overFn.apply(scope || this, arguments);
  3136. }
  3137. };
  3138. var preOutFn = function(e) {
  3139. if (!e.within(this, true)) {
  3140. outFn.apply(scope || this, arguments);
  3141. }
  3142. };
  3143. this.on("mouseover", preOverFn, this.dom);
  3144. this.on("mouseout", preOutFn, this.dom);
  3145. return this;
  3146. },
  3147. addClassOnOver : function(className, preventFlicker) {
  3148. this.hover(function() {
  3149. Ext.fly(this, '_internal').addClass(className);
  3150. }, function() {
  3151. Ext.fly(this, '_internal').removeClass(className);
  3152. });
  3153. return this;
  3154. },
  3155. addClassOnFocus : function(className) {
  3156. this.on("focus", function() {
  3157. Ext.fly(this, '_internal').addClass(className);
  3158. }, this.dom);
  3159. this.on("blur", function() {
  3160. Ext.fly(this, '_internal').removeClass(className);
  3161. }, this.dom);
  3162. return this;
  3163. },
  3164. addClassOnClick : function(className) {
  3165. var dom = this.dom;
  3166. this.on("mousedown", function() {
  3167. Ext.fly(dom, '_internal').addClass(className);
  3168. var d = Ext.getDoc();
  3169. var fn = function() {
  3170. Ext.fly(dom, '_internal').removeClass(className);
  3171. d.removeListener("mouseup", fn);
  3172. };
  3173. d.on("mouseup", fn);
  3174. });
  3175. return this;
  3176. },
  3177. swallowEvent : function(eventName, preventDefault) {
  3178. var fn = function(e) {
  3179. e.stopPropagation();
  3180. if (preventDefault) {
  3181. e.preventDefault();
  3182. }
  3183. };
  3184. if (eventName instanceof Array) {
  3185. for (var i = 0, len = eventName.length; i < len; i++) {
  3186. this.on(eventName[i], fn);
  3187. }
  3188. return this;
  3189. }
  3190. this.on(eventName, fn);
  3191. return this;
  3192. },
  3193. parent : function(selector, returnDom) {
  3194. return this.matchNode('parentNode', 'parentNode', selector,
  3195. returnDom);
  3196. },
  3197. next : function(selector, returnDom) {
  3198. return this.matchNode('nextSibling', 'nextSibling', selector,
  3199. returnDom);
  3200. },
  3201. prev : function(selector, returnDom) {
  3202. return this.matchNode('previousSibling', 'previousSibling',
  3203. selector, returnDom);
  3204. },
  3205. first : function(selector, returnDom) {
  3206. return this.matchNode('nextSibling', 'firstChild', selector,
  3207. returnDom);
  3208. },
  3209. last : function(selector, returnDom) {
  3210. return this.matchNode('previousSibling', 'lastChild', selector,
  3211. returnDom);
  3212. },
  3213. matchNode : function(dir, start, selector, returnDom) {
  3214. var n = this.dom[start];
  3215. while (n) {
  3216. if (n.nodeType == 1
  3217. && (!selector || Ext.DomQuery.is(n, selector))) {
  3218. return !returnDom ? Ext.get(n) : n;
  3219. }
  3220. n = n[dir];
  3221. }
  3222. return null;
  3223. },
  3224. appendChild : function(el) {
  3225. el = Ext.get(el);
  3226. el.appendTo(this);
  3227. return this;
  3228. },
  3229. createChild : function(config, insertBefore, returnDom) {
  3230. config = config || {
  3231. tag : 'div'
  3232. };
  3233. if (insertBefore) {
  3234. return Ext.DomHelper.insertBefore(insertBefore, config,
  3235. returnDom !== true);
  3236. }
  3237. return Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](
  3238. this.dom, config, returnDom !== true);
  3239. },
  3240. appendTo : function(el) {
  3241. el = Ext.getDom(el);
  3242. el.appendChild(this.dom);
  3243. return this;
  3244. },
  3245. insertBefore : function(el) {
  3246. el = Ext.getDom(el);
  3247. el.parentNode.insertBefore(this.dom, el);
  3248. return this;
  3249. },
  3250. insertAfter : function(el) {
  3251. el = Ext.getDom(el);
  3252. el.parentNode.insertBefore(this.dom, el.nextSibling);
  3253. return this;
  3254. },
  3255. insertFirst : function(el, returnDom) {
  3256. el = el || {};
  3257. if (typeof el == 'object' && !el.nodeType) {
  3258. return this.createChild(el, this.dom.firstChild, returnDom);
  3259. } else {
  3260. el = Ext.getDom(el);
  3261. this.dom.insertBefore(el, this.dom.firstChild);
  3262. return !returnDom ? Ext.get(el) : el;
  3263. }
  3264. },
  3265. insertSibling : function(el, where, returnDom) {
  3266. var rt;
  3267. if (el instanceof Array) {
  3268. for (var i = 0, len = el.length; i < len; i++) {
  3269. rt = this.insertSibling(el[i], where, returnDom);
  3270. }
  3271. return rt;
  3272. }
  3273. where = where ? where.toLowerCase() : 'before';
  3274. el = el || {};
  3275. var refNode = where == 'before' ? this.dom : this.dom.nextSibling;
  3276. if (typeof el == 'object' && !el.nodeType) {
  3277. if (where == 'after' && !this.dom.nextSibling) {
  3278. rt = Ext.DomHelper.append(this.dom.parentNode, el,
  3279. !returnDom);
  3280. } else {
  3281. rt = Ext.DomHelper[where == 'after'
  3282. ? 'insertAfter'
  3283. : 'insertBefore'](this.dom, el, !returnDom);
  3284. }
  3285. } else {
  3286. rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);
  3287. if (!returnDom) {
  3288. rt = Ext.get(rt);
  3289. }
  3290. }
  3291. return rt;
  3292. },
  3293. wrap : function(config, returnDom) {
  3294. if (!config) {
  3295. config = {
  3296. tag : "div"
  3297. };
  3298. }
  3299. var newEl = Ext.DomHelper
  3300. .insertBefore(this.dom, config, !returnDom);
  3301. newEl.dom ? newEl.dom.appendChild(this.dom) : newEl
  3302. .appendChild(this.dom);
  3303. return newEl;
  3304. },
  3305. replace : function(el) {
  3306. el = Ext.get(el);
  3307. this.insertBefore(el);
  3308. el.remove();
  3309. return this;
  3310. },
  3311. replaceWith : function(el) {
  3312. if (typeof el == 'object' && !el.nodeType) {
  3313. el = this.insertSibling(el, 'before');
  3314. } else {
  3315. el = Ext.getDom(el);
  3316. this.dom.parentNode.insertBefore(el, this.dom);
  3317. }
  3318. El.uncache(this.id);
  3319. this.dom.parentNode.removeChild(this.dom);
  3320. this.dom = el;
  3321. this.id = Ext.id(el);
  3322. El.cache[this.id] = this;
  3323. return this;
  3324. },
  3325. insertHtml : function(where, html, returnEl) {
  3326. var el = Ext.DomHelper.insertHtml(where, this.dom, html);
  3327. return returnEl ? Ext.get(el) : el;
  3328. },
  3329. set : function(o, useSet) {
  3330. var el = this.dom;
  3331. useSet = typeof useSet == 'undefined' ? (el.setAttribute
  3332. ? true
  3333. : false) : useSet;
  3334. for (var attr in o) {
  3335. if (attr == "style" || typeof o[attr] == "function")
  3336. continue;
  3337. if (attr == "cls") {
  3338. el.className = o["cls"];
  3339. } else if (o.hasOwnProperty(attr)) {
  3340. if (useSet)
  3341. el.setAttribute(attr, o[attr]);
  3342. else
  3343. el[attr] = o[attr];
  3344. }
  3345. }
  3346. if (o.style) {
  3347. Ext.DomHelper.applyStyles(el, o.style);
  3348. }
  3349. return this;
  3350. },
  3351. addKeyListener : function(key, fn, scope) {
  3352. var config;
  3353. if (typeof key != "object" || key instanceof Array) {
  3354. config = {
  3355. key : key,
  3356. fn : fn,
  3357. scope : scope
  3358. };
  3359. } else {
  3360. config = {
  3361. key : key.key,
  3362. shift : key.shift,
  3363. ctrl : key.ctrl,
  3364. alt : key.alt,
  3365. fn : fn,
  3366. scope : scope
  3367. };
  3368. }
  3369. return new Ext.KeyMap(this, config);
  3370. },
  3371. addKeyMap : function(config) {
  3372. return new Ext.KeyMap(this, config);
  3373. },
  3374. isScrollable : function() {
  3375. var dom = this.dom;
  3376. return dom.scrollHeight > dom.clientHeight
  3377. || dom.scrollWidth > dom.clientWidth;
  3378. },
  3379. scrollTo : function(side, value, animate) {
  3380. var prop = side.toLowerCase() == "left"
  3381. ? "scrollLeft"
  3382. : "scrollTop";
  3383. if (!animate || !A) {
  3384. this.dom[prop] = value;
  3385. } else {
  3386. var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [
  3387. this.dom.scrollLeft, value];
  3388. this.anim({
  3389. scroll : {
  3390. "to" : to
  3391. }
  3392. }, this.preanim(arguments, 2), 'scroll');
  3393. }
  3394. return this;
  3395. },
  3396. scroll : function(direction, distance, animate) {
  3397. if (!this.isScrollable()) {
  3398. return;
  3399. }
  3400. var el = this.dom;
  3401. var l = el.scrollLeft, t = el.scrollTop;
  3402. var w = el.scrollWidth, h = el.scrollHeight;
  3403. var cw = el.clientWidth, ch = el.clientHeight;
  3404. direction = direction.toLowerCase();
  3405. var scrolled = false;
  3406. var a = this.preanim(arguments, 2);
  3407. switch (direction) {
  3408. case "l" :
  3409. case "left" :
  3410. if (w - l > cw) {
  3411. var v = Math.min(l + distance, w - cw);
  3412. this.scrollTo("left", v, a);
  3413. scrolled = true;
  3414. }
  3415. break;
  3416. case "r" :
  3417. case "right" :
  3418. if (l > 0) {
  3419. var v = Math.max(l - distance, 0);
  3420. this.scrollTo("left", v, a);
  3421. scrolled = true;
  3422. }
  3423. break;
  3424. case "t" :
  3425. case "top" :
  3426. case "up" :
  3427. if (t > 0) {
  3428. var v = Math.max(t - distance, 0);
  3429. this.scrollTo("top", v, a);
  3430. scrolled = true;
  3431. }
  3432. break;
  3433. case "b" :
  3434. case "bottom" :
  3435. case "down" :
  3436. if (h - t > ch) {
  3437. var v = Math.min(t + distance, h - ch);
  3438. this.scrollTo("top", v, a);
  3439. scrolled = true;
  3440. }
  3441. break;
  3442. }
  3443. return scrolled;
  3444. },
  3445. translatePoints : function(x, y) {
  3446. if (typeof x == 'object' || x instanceof Array) {
  3447. y = x[1];
  3448. x = x[0];
  3449. }
  3450. var p = this.getStyle('position');
  3451. var o = this.getXY();
  3452. var l = parseInt(this.getStyle('left'), 10);
  3453. var t = parseInt(this.getStyle('top'), 10);
  3454. if (isNaN(l)) {
  3455. l = (p == "relative") ? 0 : this.dom.offsetLeft;
  3456. }
  3457. if (isNaN(t)) {
  3458. t = (p == "relative") ? 0 : this.dom.offsetTop;
  3459. }
  3460. return {
  3461. left : (x - o[0] + l),
  3462. top : (y - o[1] + t)
  3463. };
  3464. },
  3465. getScroll : function() {
  3466. var d = this.dom, doc = document;
  3467. if (d == doc || d == doc.body) {
  3468. var l, t;
  3469. if (Ext.isIE && Ext.isStrict) {
  3470. l = doc.documentElement.scrollLeft
  3471. || (doc.body.scrollLeft || 0);
  3472. t = doc.documentElement.scrollTop
  3473. || (doc.body.scrollTop || 0);
  3474. } else {
  3475. l = window.pageXOffset || (doc.body.scrollLeft || 0);
  3476. t = window.pageYOffset || (doc.body.scrollTop || 0);
  3477. }
  3478. return {
  3479. left : l,
  3480. top : t
  3481. };
  3482. } else {
  3483. return {
  3484. left : d.scrollLeft,
  3485. top : d.scrollTop
  3486. };
  3487. }
  3488. },
  3489. getColor : function(attr, defaultValue, prefix) {
  3490. var v = this.getStyle(attr);
  3491. if (!v || v == "transparent" || v == "inherit") {
  3492. return defaultValue;
  3493. }
  3494. var color = typeof prefix == "undefined" ? "#" : prefix;
  3495. if (v.substr(0, 4) == "rgb(") {
  3496. var rvs = v.slice(4, v.length - 1).split(",");
  3497. for (var i = 0; i < 3; i++) {
  3498. var h = parseInt(rvs[i]);
  3499. var s = h.toString(16);
  3500. if (h < 16) {
  3501. s = "0" + s;
  3502. }
  3503. color += s;
  3504. }
  3505. } else {
  3506. if (v.substr(0, 1) == "#") {
  3507. if (v.length == 4) {
  3508. for (var i = 1; i < 4; i++) {
  3509. var c = v.charAt(i);
  3510. color += c + c;
  3511. }
  3512. } else if (v.length == 7) {
  3513. color += v.substr(1);
  3514. }
  3515. }
  3516. }
  3517. return (color.length > 5 ? color.toLowerCase() : defaultValue);
  3518. },
  3519. boxWrap : function(cls) {
  3520. cls = cls || 'x-box';
  3521. var el = Ext.get(this
  3522. .insertHtml('beforeBegin', String.format(
  3523. '<div class="{0}">' + El.boxMarkup
  3524. + '</div>', cls)));
  3525. el.child('.' + cls + '-mc').dom.appendChild(this.dom);
  3526. return el;
  3527. },
  3528. getAttributeNS : Ext.isIE ? function(ns, name) {
  3529. var d = this.dom;
  3530. var type = typeof d[ns + ":" + name];
  3531. if (type != 'undefined' && type != 'unknown') {
  3532. return d[ns + ":" + name];
  3533. }
  3534. return d[name];
  3535. } : function(ns, name) {
  3536. var d = this.dom;
  3537. return d.getAttributeNS(ns, name)
  3538. || d.getAttribute(ns + ":" + name) || d.getAttribute(name)
  3539. || d[name];
  3540. },
  3541. getTextWidth : function(text, min, max) {
  3542. return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text,
  3543. this.dom.innerHTML, true)).width).constrain(min
  3544. || 0, max || 1000000);
  3545. }
  3546. };
  3547. var ep = El.prototype;
  3548. ep.on = ep.addListener;
  3549. ep.mon = ep.addListener;
  3550. ep.getUpdateManager = ep.getUpdater;
  3551. ep.un = ep.removeListener;
  3552. ep.autoBoxAdjust = true;
  3553. El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
  3554. El.addUnits = function(v, defaultUnit) {
  3555. if (v === "" || v == "auto") {
  3556. return v;
  3557. }
  3558. if (v === undefined) {
  3559. return '';
  3560. }
  3561. if (typeof v == "number" || !El.unitPattern.test(v)) {
  3562. return v + (defaultUnit || 'px');
  3563. }
  3564. return v;
  3565. };
  3566. El.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';
  3567. El.VISIBILITY = 1;
  3568. El.DISPLAY = 2;
  3569. El.borders = {
  3570. l : "border-left-width",
  3571. r : "border-right-width",
  3572. t : "border-top-width",
  3573. b : "border-bottom-width"
  3574. };
  3575. El.paddings = {
  3576. l : "padding-left",
  3577. r : "padding-right",
  3578. t : "padding-top",
  3579. b : "padding-bottom"
  3580. };
  3581. El.margins = {
  3582. l : "margin-left",
  3583. r : "margin-right",
  3584. t : "margin-top",
  3585. b : "margin-bottom"
  3586. };
  3587. El.cache = {};
  3588. var docEl;
  3589. El.get = function(el) {
  3590. var ex, elm, id;
  3591. if (!el) {
  3592. return null;
  3593. }
  3594. if (typeof el == "string") {
  3595. if (!(elm = document.getElementById(el))) {
  3596. return null;
  3597. }
  3598. if (ex = El.cache[el]) {
  3599. ex.dom = elm;
  3600. } else {
  3601. ex = El.cache[el] = new El(elm);
  3602. }
  3603. return ex;
  3604. } else if (el.tagName) {
  3605. if (!(id = el.id)) {
  3606. id = Ext.id(el);
  3607. }
  3608. if (ex = El.cache[id]) {
  3609. ex.dom = el;
  3610. } else {
  3611. ex = El.cache[id] = new El(el);
  3612. }
  3613. return ex;
  3614. } else if (el instanceof El) {
  3615. if (el != docEl) {
  3616. el.dom = document.getElementById(el.id) || el.dom;
  3617. El.cache[el.id] = el;
  3618. }
  3619. return el;
  3620. } else if (el.isComposite) {
  3621. return el;
  3622. } else if (el instanceof Array) {
  3623. return El.select(el);
  3624. } else if (el == document) {
  3625. if (!docEl) {
  3626. var f = function() {
  3627. };
  3628. f.prototype = El.prototype;
  3629. docEl = new f();
  3630. docEl.dom = document;
  3631. }
  3632. return docEl;
  3633. }
  3634. return null;
  3635. };
  3636. El.uncache = function(el) {
  3637. for (var i = 0, a = arguments, len = a.length; i < len; i++) {
  3638. if (a[i]) {
  3639. delete El.cache[a[i].id || a[i]];
  3640. }
  3641. }
  3642. };
  3643. El.garbageCollect = function() {
  3644. if (!Ext.enableGarbageCollector) {
  3645. clearInterval(El.collectorThread);
  3646. return;
  3647. }
  3648. for (var eid in El.cache) {
  3649. var el = El.cache[eid], d = el.dom;
  3650. if (!d || !d.parentNode
  3651. || (!d.offsetParent && !document.getElementById(eid))) {
  3652. delete El.cache[eid];
  3653. if (d && Ext.enableListenerCollection) {
  3654. E.purgeElement(d);
  3655. }
  3656. }
  3657. }
  3658. }
  3659. El.collectorThreadId = setInterval(El.garbageCollect, 30000);
  3660. var flyFn = function() {
  3661. };
  3662. flyFn.prototype = El.prototype;
  3663. var _cls = new flyFn();
  3664. El.Flyweight = function(dom) {
  3665. this.dom = dom;
  3666. };
  3667. El.Flyweight.prototype = _cls;
  3668. El.Flyweight.prototype.isFlyweight = true;
  3669. El._flyweights = {};
  3670. El.fly = function(el, named) {
  3671. named = named || '_global';
  3672. el = Ext.getDom(el);
  3673. if (!el) {
  3674. return null;
  3675. }
  3676. if (!El._flyweights[named]) {
  3677. El._flyweights[named] = new El.Flyweight();
  3678. }
  3679. El._flyweights[named].dom = el;
  3680. return El._flyweights[named];
  3681. };
  3682. Ext.get = El.get;
  3683. Ext.fly = El.fly;
  3684. var noBoxAdjust = Ext.isStrict ? {
  3685. select : 1
  3686. } : {
  3687. input : 1,
  3688. select : 1,
  3689. textarea : 1
  3690. };
  3691. if (Ext.isIE || Ext.isGecko) {
  3692. noBoxAdjust['button'] = 1;
  3693. }
  3694. Ext.EventManager.on(window, 'unload', function() {
  3695. delete El.cache;
  3696. delete El._flyweights;
  3697. });
  3698. })();
  3699. Ext.enableFx = true;
  3700. Ext.Fx = {
  3701. slideIn : function(anchor, o) {
  3702. var el = this.getFxEl();
  3703. o = o || {};
  3704. el.queueFx(o, function() {
  3705. anchor = anchor || "t";
  3706. this.fixDisplay();
  3707. var r = this.getFxRestore();
  3708. var b = this.getBox();
  3709. this.setSize(b);
  3710. var wrap = this.fxWrap(r.pos, o, "hidden");
  3711. var st = this.dom.style;
  3712. st.visibility = "visible";
  3713. st.position = "absolute";
  3714. var after = function() {
  3715. el.fxUnwrap(wrap, r.pos, o);
  3716. st.width = r.width;
  3717. st.height = r.height;
  3718. el.afterFx(o);
  3719. };
  3720. var a, pt = {
  3721. to : [b.x, b.y]
  3722. }, bw = {
  3723. to : b.width
  3724. }, bh = {
  3725. to : b.height
  3726. };
  3727. switch (anchor.toLowerCase()) {
  3728. case "t" :
  3729. wrap.setSize(b.width, 0);
  3730. st.left = st.bottom = "0";
  3731. a = {
  3732. height : bh
  3733. };
  3734. break;
  3735. case "l" :
  3736. wrap.setSize(0, b.height);
  3737. st.right = st.top = "0";
  3738. a = {
  3739. width : bw
  3740. };
  3741. break;
  3742. case "r" :
  3743. wrap.setSize(0, b.height);
  3744. wrap.setX(b.right);
  3745. st.left = st.top = "0";
  3746. a = {
  3747. width : bw,
  3748. points : pt
  3749. };
  3750. break;
  3751. case "b" :
  3752. wrap.setSize(b.width, 0);
  3753. wrap.setY(b.bottom);
  3754. st.left = st.top = "0";
  3755. a = {
  3756. height : bh,
  3757. points : pt
  3758. };
  3759. break;
  3760. case "tl" :
  3761. wrap.setSize(0, 0);
  3762. st.right = st.bottom = "0";
  3763. a = {
  3764. width : bw,
  3765. height : bh
  3766. };
  3767. break;
  3768. case "bl" :
  3769. wrap.setSize(0, 0);
  3770. wrap.setY(b.y + b.height);
  3771. st.right = st.top = "0";
  3772. a = {
  3773. width : bw,
  3774. height : bh,
  3775. points : pt
  3776. };
  3777. break;
  3778. case "br" :
  3779. wrap.setSize(0, 0);
  3780. wrap.setXY([b.right, b.bottom]);
  3781. st.left = st.top = "0";
  3782. a = {
  3783. width : bw,
  3784. height : bh,
  3785. points : pt
  3786. };
  3787. break;
  3788. case "tr" :
  3789. wrap.setSize(0, 0);
  3790. wrap.setX(b.x + b.width);
  3791. st.left = st.bottom = "0";
  3792. a = {
  3793. width : bw,
  3794. height : bh,
  3795. points : pt
  3796. };
  3797. break;
  3798. }
  3799. this.dom.style.visibility = "visible";
  3800. wrap.show();
  3801. arguments.callee.anim = wrap.fxanim(a, o, 'motion', .5,
  3802. 'easeOut', after);
  3803. });
  3804. return this;
  3805. },
  3806. slideOut : function(anchor, o) {
  3807. var el = this.getFxEl();
  3808. o = o || {};
  3809. el.queueFx(o, function() {
  3810. anchor = anchor || "t";
  3811. var r = this.getFxRestore();
  3812. var b = this.getBox();
  3813. this.setSize(b);
  3814. var wrap = this.fxWrap(r.pos, o, "visible");
  3815. var st = this.dom.style;
  3816. st.visibility = "visible";
  3817. st.position = "absolute";
  3818. wrap.setSize(b);
  3819. var after = function() {
  3820. if (o.useDisplay) {
  3821. el.setDisplayed(false);
  3822. } else {
  3823. el.hide();
  3824. }
  3825. el.fxUnwrap(wrap, r.pos, o);
  3826. st.width = r.width;
  3827. st.height = r.height;
  3828. el.afterFx(o);
  3829. };
  3830. var a, zero = {
  3831. to : 0
  3832. };
  3833. switch (anchor.toLowerCase()) {
  3834. case "t" :
  3835. st.left = st.bottom = "0";
  3836. a = {
  3837. height : zero
  3838. };
  3839. break;
  3840. case "l" :
  3841. st.right = st.top = "0";
  3842. a = {
  3843. width : zero
  3844. };
  3845. break;
  3846. case "r" :
  3847. st.left = st.top = "0";
  3848. a = {
  3849. width : zero,
  3850. points : {
  3851. to : [b.right, b.y]
  3852. }
  3853. };
  3854. break;
  3855. case "b" :
  3856. st.left = st.top = "0";
  3857. a = {
  3858. height : zero,
  3859. points : {
  3860. to : [b.x, b.bottom]
  3861. }
  3862. };
  3863. break;
  3864. case "tl" :
  3865. st.right = st.bottom = "0";
  3866. a = {
  3867. width : zero,
  3868. height : zero
  3869. };
  3870. break;
  3871. case "bl" :
  3872. st.right = st.top = "0";
  3873. a = {
  3874. width : zero,
  3875. height : zero,
  3876. points : {
  3877. to : [b.x, b.bottom]
  3878. }
  3879. };
  3880. break;
  3881. case "br" :
  3882. st.left = st.top = "0";
  3883. a = {
  3884. width : zero,
  3885. height : zero,
  3886. points : {
  3887. to : [b.x + b.width, b.bottom]
  3888. }
  3889. };
  3890. break;
  3891. case "tr" :
  3892. st.left = st.bottom = "0";
  3893. a = {
  3894. width : zero,
  3895. height : zero,
  3896. points : {
  3897. to : [b.right, b.y]
  3898. }
  3899. };
  3900. break;
  3901. }
  3902. arguments.callee.anim = wrap.fxanim(a, o, 'motion', .5,
  3903. "easeOut", after);
  3904. });
  3905. return this;
  3906. },
  3907. puff : function(o) {
  3908. var el = this.getFxEl();
  3909. o = o || {};
  3910. el.queueFx(o, function() {
  3911. this.clearOpacity();
  3912. this.show();
  3913. var r = this.getFxRestore();
  3914. var st = this.dom.style;
  3915. var after = function() {
  3916. if (o.useDisplay) {
  3917. el.setDisplayed(false);
  3918. } else {
  3919. el.hide();
  3920. }
  3921. el.clearOpacity();
  3922. el.setPositioning(r.pos);
  3923. st.width = r.width;
  3924. st.height = r.height;
  3925. st.fontSize = '';
  3926. el.afterFx(o);
  3927. };
  3928. var width = this.getWidth();
  3929. var height = this.getHeight();
  3930. arguments.callee.anim = this.fxanim({
  3931. width : {
  3932. to : this.adjustWidth(width * 2)
  3933. },
  3934. height : {
  3935. to : this.adjustHeight(height * 2)
  3936. },
  3937. points : {
  3938. by : [-(width * .5), -(height * .5)]
  3939. },
  3940. opacity : {
  3941. to : 0
  3942. },
  3943. fontSize : {
  3944. to : 200,
  3945. unit : "%"
  3946. }
  3947. }, o, 'motion', .5, "easeOut", after);
  3948. });
  3949. return this;
  3950. },
  3951. switchOff : function(o) {
  3952. var el = this.getFxEl();
  3953. o = o || {};
  3954. el.queueFx(o, function() {
  3955. this.clearOpacity();
  3956. this.clip();
  3957. var r = this.getFxRestore();
  3958. var st = this.dom.style;
  3959. var after = function() {
  3960. if (o.useDisplay) {
  3961. el.setDisplayed(false);
  3962. } else {
  3963. el.hide();
  3964. }
  3965. el.clearOpacity();
  3966. el.setPositioning(r.pos);
  3967. st.width = r.width;
  3968. st.height = r.height;
  3969. el.afterFx(o);
  3970. };
  3971. this.fxanim({
  3972. opacity : {
  3973. to : 0.3
  3974. }
  3975. }, null, null, .1, null, function() {
  3976. this.clearOpacity();
  3977. (function() {
  3978. this.fxanim({
  3979. height : {
  3980. to : 1
  3981. },
  3982. points : {
  3983. by : [
  3984. 0,
  3985. this.getHeight()
  3986. * .5]
  3987. }
  3988. }, o, 'motion', 0.3, 'easeIn',
  3989. after);
  3990. }).defer(100, this);
  3991. });
  3992. });
  3993. return this;
  3994. },
  3995. highlight : function(color, o) {
  3996. var el = this.getFxEl();
  3997. o = o || {};
  3998. el.queueFx(o, function() {
  3999. color = color || "ffff9c";
  4000. var attr = o.attr || "backgroundColor";
  4001. this.clearOpacity();
  4002. this.show();
  4003. var origColor = this.getColor(attr);
  4004. var restoreColor = this.dom.style[attr];
  4005. var endColor = (o.endColor || origColor) || "ffffff";
  4006. var after = function() {
  4007. el.dom.style[attr] = restoreColor;
  4008. el.afterFx(o);
  4009. };
  4010. var a = {};
  4011. a[attr] = {
  4012. from : color,
  4013. to : endColor
  4014. };
  4015. arguments.callee.anim = this.fxanim(a, o, 'color', 1,
  4016. 'easeIn', after);
  4017. });
  4018. return this;
  4019. },
  4020. frame : function(color, count, o) {
  4021. var el = this.getFxEl();
  4022. o = o || {};
  4023. el.queueFx(o, function() {
  4024. color = color || "#C3DAF9";
  4025. if (color.length == 6) {
  4026. color = "#" + color;
  4027. }
  4028. count = count || 1;
  4029. var duration = o.duration || 1;
  4030. this.show();
  4031. var b = this.getBox();
  4032. var animFn = function() {
  4033. var proxy = Ext.getBody().createChild({
  4034. style : {
  4035. visbility : "hidden",
  4036. position : "absolute",
  4037. "z-index" : "35000",
  4038. border : "0px solid " + color
  4039. }
  4040. });
  4041. var scale = Ext.isBorderBox ? 2 : 1;
  4042. proxy.animate({
  4043. top : {
  4044. from : b.y,
  4045. to : b.y - 20
  4046. },
  4047. left : {
  4048. from : b.x,
  4049. to : b.x - 20
  4050. },
  4051. borderWidth : {
  4052. from : 0,
  4053. to : 10
  4054. },
  4055. opacity : {
  4056. from : 1,
  4057. to : 0
  4058. },
  4059. height : {
  4060. from : b.height,
  4061. to : (b.height + (20 * scale))
  4062. },
  4063. width : {
  4064. from : b.width,
  4065. to : (b.width + (20 * scale))
  4066. }
  4067. }, duration, function() {
  4068. proxy.remove();
  4069. if (--count > 0) {
  4070. animFn();
  4071. } else {
  4072. el.afterFx(o);
  4073. }
  4074. });
  4075. };
  4076. animFn.call(this);
  4077. });
  4078. return this;
  4079. },
  4080. pause : function(seconds) {
  4081. var el = this.getFxEl();
  4082. var o = {};
  4083. el.queueFx(o, function() {
  4084. setTimeout(function() {
  4085. el.afterFx(o);
  4086. }, seconds * 1000);
  4087. });
  4088. return this;
  4089. },
  4090. fadeIn : function(o) {
  4091. var el = this.getFxEl();
  4092. o = o || {};
  4093. el.queueFx(o, function() {
  4094. this.setOpacity(0);
  4095. this.fixDisplay();
  4096. this.dom.style.visibility = 'visible';
  4097. var to = o.endOpacity || 1;
  4098. arguments.callee.anim = this.fxanim({
  4099. opacity : {
  4100. to : to
  4101. }
  4102. }, o, null, .5, "easeOut", function() {
  4103. if (to == 1) {
  4104. this.clearOpacity();
  4105. }
  4106. el.afterFx(o);
  4107. });
  4108. });
  4109. return this;
  4110. },
  4111. fadeOut : function(o) {
  4112. var el = this.getFxEl();
  4113. o = o || {};
  4114. el.queueFx(o, function() {
  4115. arguments.callee.anim = this.fxanim({
  4116. opacity : {
  4117. to : o.endOpacity || 0
  4118. }
  4119. }, o, null, .5, "easeOut", function() {
  4120. if (this.visibilityMode == Ext.Element.DISPLAY
  4121. || o.useDisplay) {
  4122. this.dom.style.display = "none";
  4123. } else {
  4124. this.dom.style.visibility = "hidden";
  4125. }
  4126. this.clearOpacity();
  4127. el.afterFx(o);
  4128. });
  4129. });
  4130. return this;
  4131. },
  4132. scale : function(w, h, o) {
  4133. this.shift(Ext.apply({}, o, {
  4134. width : w,
  4135. height : h
  4136. }));
  4137. return this;
  4138. },
  4139. shift : function(o) {
  4140. var el = this.getFxEl();
  4141. o = o || {};
  4142. el.queueFx(o, function() {
  4143. var a = {}, w = o.width, h = o.height, x = o.x, y = o.y, op = o.opacity;
  4144. if (w !== undefined) {
  4145. a.width = {
  4146. to : this.adjustWidth(w)
  4147. };
  4148. }
  4149. if (h !== undefined) {
  4150. a.height = {
  4151. to : this.adjustHeight(h)
  4152. };
  4153. }
  4154. if (x !== undefined || y !== undefined) {
  4155. a.points = {
  4156. to : [x !== undefined ? x : this.getX(),
  4157. y !== undefined ? y : this.getY()]
  4158. };
  4159. }
  4160. if (op !== undefined) {
  4161. a.opacity = {
  4162. to : op
  4163. };
  4164. }
  4165. if (o.xy !== undefined) {
  4166. a.points = {
  4167. to : o.xy
  4168. };
  4169. }
  4170. arguments.callee.anim = this.fxanim(a, o, 'motion', .35, "easeOut",
  4171. function() {
  4172. el.afterFx(o);
  4173. });
  4174. });
  4175. return this;
  4176. },
  4177. ghost : function(anchor, o) {
  4178. var el = this.getFxEl();
  4179. o = o || {};
  4180. el.queueFx(o, function() {
  4181. anchor = anchor || "b";
  4182. var r = this.getFxRestore();
  4183. var w = this.getWidth(), h = this.getHeight();
  4184. var st = this.dom.style;
  4185. var after = function() {
  4186. if (o.useDisplay) {
  4187. el.setDisplayed(false);
  4188. } else {
  4189. el.hide();
  4190. }
  4191. el.clearOpacity();
  4192. el.setPositioning(r.pos);
  4193. st.width = r.width;
  4194. st.height = r.height;
  4195. el.afterFx(o);
  4196. };
  4197. var a = {
  4198. opacity : {
  4199. to : 0
  4200. },
  4201. points : {}
  4202. }, pt = a.points;
  4203. switch (anchor.toLowerCase()) {
  4204. case "t" :
  4205. pt.by = [0, -h];
  4206. break;
  4207. case "l" :
  4208. pt.by = [-w, 0];
  4209. break;
  4210. case "r" :
  4211. pt.by = [w, 0];
  4212. break;
  4213. case "b" :
  4214. pt.by = [0, h];
  4215. break;
  4216. case "tl" :
  4217. pt.by = [-w, -h];
  4218. break;
  4219. case "bl" :
  4220. pt.by = [-w, h];
  4221. break;
  4222. case "br" :
  4223. pt.by = [w, h];
  4224. break;
  4225. case "tr" :
  4226. pt.by = [w, -h];
  4227. break;
  4228. }
  4229. arguments.callee.anim = this.fxanim(a, o, 'motion', .5,
  4230. "easeOut", after);
  4231. });
  4232. return this;
  4233. },
  4234. syncFx : function() {
  4235. this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
  4236. block : false,
  4237. concurrent : true,
  4238. stopFx : false
  4239. });
  4240. return this;
  4241. },
  4242. sequenceFx : function() {
  4243. this.fxDefaults = Ext.apply(this.fxDefaults || {}, {
  4244. block : false,
  4245. concurrent : false,
  4246. stopFx : false
  4247. });
  4248. return this;
  4249. },
  4250. nextFx : function() {
  4251. var ef = this.fxQueue[0];
  4252. if (ef) {
  4253. ef.call(this);
  4254. }
  4255. },
  4256. hasActiveFx : function() {
  4257. return this.fxQueue && this.fxQueue[0];
  4258. },
  4259. stopFx : function() {
  4260. if (this.hasActiveFx()) {
  4261. var cur = this.fxQueue[0];
  4262. if (cur && cur.anim && cur.anim.isAnimated()) {
  4263. this.fxQueue = [cur];
  4264. cur.anim.stop(true);
  4265. }
  4266. }
  4267. return this;
  4268. },
  4269. beforeFx : function(o) {
  4270. if (this.hasActiveFx() && !o.concurrent) {
  4271. if (o.stopFx) {
  4272. this.stopFx();
  4273. return true;
  4274. }
  4275. return false;
  4276. }
  4277. return true;
  4278. },
  4279. hasFxBlock : function() {
  4280. var q = this.fxQueue;
  4281. return q && q[0] && q[0].block;
  4282. },
  4283. queueFx : function(o, fn) {
  4284. if (!this.fxQueue) {
  4285. this.fxQueue = [];
  4286. }
  4287. if (!this.hasFxBlock()) {
  4288. Ext.applyIf(o, this.fxDefaults);
  4289. if (!o.concurrent) {
  4290. var run = this.beforeFx(o);
  4291. fn.block = o.block;
  4292. this.fxQueue.push(fn);
  4293. if (run) {
  4294. this.nextFx();
  4295. }
  4296. } else {
  4297. fn.call(this);
  4298. }
  4299. }
  4300. return this;
  4301. },
  4302. fxWrap : function(pos, o, vis) {
  4303. var wrap;
  4304. if (!o.wrap || !(wrap = Ext.get(o.wrap))) {
  4305. var wrapXY;
  4306. if (o.fixPosition) {
  4307. wrapXY = this.getXY();
  4308. }
  4309. var div = document.createElement("div");
  4310. div.style.visibility = vis;
  4311. wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));
  4312. wrap.setPositioning(pos);
  4313. if (wrap.getStyle("position") == "static") {
  4314. wrap.position("relative");
  4315. }
  4316. this.clearPositioning('auto');
  4317. wrap.clip();
  4318. wrap.dom.appendChild(this.dom);
  4319. if (wrapXY) {
  4320. wrap.setXY(wrapXY);
  4321. }
  4322. }
  4323. return wrap;
  4324. },
  4325. fxUnwrap : function(wrap, pos, o) {
  4326. this.clearPositioning();
  4327. this.setPositioning(pos);
  4328. if (!o.wrap) {
  4329. wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
  4330. wrap.remove();
  4331. }
  4332. },
  4333. getFxRestore : function() {
  4334. var st = this.dom.style;
  4335. return {
  4336. pos : this.getPositioning(),
  4337. width : st.width,
  4338. height : st.height
  4339. };
  4340. },
  4341. afterFx : function(o) {
  4342. if (o.afterStyle) {
  4343. this.applyStyles(o.afterStyle);
  4344. }
  4345. if (o.afterCls) {
  4346. this.addClass(o.afterCls);
  4347. }
  4348. if (o.remove === true) {
  4349. this.remove();
  4350. }
  4351. Ext.callback(o.callback, o.scope, [this]);
  4352. if (!o.concurrent) {
  4353. this.fxQueue.shift();
  4354. this.nextFx();
  4355. }
  4356. },
  4357. getFxEl : function() {
  4358. return Ext.get(this.dom);
  4359. },
  4360. fxanim : function(args, opt, animType, defaultDur, defaultEase, cb) {
  4361. animType = animType || 'run';
  4362. opt = opt || {};
  4363. var anim = Ext.lib.Anim[animType](this.dom, args,
  4364. (opt.duration || defaultDur) || .35,
  4365. (opt.easing || defaultEase) || 'easeOut', function() {
  4366. Ext.callback(cb, this);
  4367. }, this);
  4368. opt.anim = anim;
  4369. return anim;
  4370. }
  4371. };
  4372. Ext.Fx.resize = Ext.Fx.scale;
  4373. Ext.apply(Ext.Element.prototype, Ext.Fx);
  4374. Ext.CompositeElement = function(els) {
  4375. this.elements = [];
  4376. this.addElements(els);
  4377. };
  4378. Ext.CompositeElement.prototype = {
  4379. isComposite : true,
  4380. addElements : function(els) {
  4381. if (!els)
  4382. return this;
  4383. if (typeof els == "string") {
  4384. els = Ext.Element.selectorFunction(els);
  4385. }
  4386. var yels = this.elements;
  4387. var index = yels.length - 1;
  4388. for (var i = 0, len = els.length; i < len; i++) {
  4389. yels[++index] = Ext.get(els[i]);
  4390. }
  4391. return this;
  4392. },
  4393. fill : function(els) {
  4394. this.elements = [];
  4395. this.add(els);
  4396. return this;
  4397. },
  4398. filter : function(selector) {
  4399. var els = [];
  4400. this.each(function(el) {
  4401. if (el.is(selector)) {
  4402. els[els.length] = el.dom;
  4403. }
  4404. });
  4405. this.fill(els);
  4406. return this;
  4407. },
  4408. invoke : function(fn, args) {
  4409. var els = this.elements;
  4410. for (var i = 0, len = els.length; i < len; i++) {
  4411. Ext.Element.prototype[fn].apply(els[i], args);
  4412. }
  4413. return this;
  4414. },
  4415. add : function(els) {
  4416. if (typeof els == "string") {
  4417. this.addElements(Ext.Element.selectorFunction(els));
  4418. } else if (els.length !== undefined) {
  4419. this.addElements(els);
  4420. } else {
  4421. this.addElements([els]);
  4422. }
  4423. return this;
  4424. },
  4425. each : function(fn, scope) {
  4426. var els = this.elements;
  4427. for (var i = 0, len = els.length; i < len; i++) {
  4428. if (fn.call(scope || els[i], els[i], this, i) === false) {
  4429. break;
  4430. }
  4431. }
  4432. return this;
  4433. },
  4434. item : function(index) {
  4435. return this.elements[index] || null;
  4436. },
  4437. first : function() {
  4438. return this.item(0);
  4439. },
  4440. last : function() {
  4441. return this.item(this.elements.length - 1);
  4442. },
  4443. getCount : function() {
  4444. return this.elements.length;
  4445. },
  4446. contains : function(el) {
  4447. return this.indexOf(el) !== -1;
  4448. },
  4449. indexOf : function(el) {
  4450. return this.elements.indexOf(Ext.get(el));
  4451. },
  4452. removeElement : function(el, removeDom) {
  4453. if (el instanceof Array) {
  4454. for (var i = 0, len = el.length; i < len; i++) {
  4455. this.removeElement(el[i]);
  4456. }
  4457. return this;
  4458. }
  4459. var index = typeof el == 'number' ? el : this.indexOf(el);
  4460. if (index !== -1 && this.elements[index]) {
  4461. if (removeDom) {
  4462. var d = this.elements[index];
  4463. if (d.dom) {
  4464. d.remove();
  4465. } else {
  4466. Ext.removeNode(d);
  4467. }
  4468. }
  4469. this.elements.splice(index, 1);
  4470. }
  4471. return this;
  4472. },
  4473. replaceElement : function(el, replacement, domReplace) {
  4474. var index = typeof el == 'number' ? el : this.indexOf(el);
  4475. if (index !== -1) {
  4476. if (domReplace) {
  4477. this.elements[index].replaceWith(replacement);
  4478. } else {
  4479. this.elements.splice(index, 1, Ext.get(replacement))
  4480. }
  4481. }
  4482. return this;
  4483. },
  4484. clear : function() {
  4485. this.elements = [];
  4486. }
  4487. };
  4488. (function() {
  4489. Ext.CompositeElement.createCall = function(proto, fnName) {
  4490. if (!proto[fnName]) {
  4491. proto[fnName] = function() {
  4492. return this.invoke(fnName, arguments);
  4493. };
  4494. }
  4495. };
  4496. for (var fnName in Ext.Element.prototype) {
  4497. if (typeof Ext.Element.prototype[fnName] == "function") {
  4498. Ext.CompositeElement.createCall(Ext.CompositeElement.prototype,
  4499. fnName);
  4500. }
  4501. };
  4502. })();
  4503. Ext.CompositeElementLite = function(els) {
  4504. Ext.CompositeElementLite.superclass.constructor.call(this, els);
  4505. this.el = new Ext.Element.Flyweight();
  4506. };
  4507. Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {
  4508. addElements : function(els) {
  4509. if (els) {
  4510. if (els instanceof Array) {
  4511. this.elements = this.elements.concat(els);
  4512. } else {
  4513. var yels = this.elements;
  4514. var index = yels.length - 1;
  4515. for (var i = 0, len = els.length; i < len; i++) {
  4516. yels[++index] = els[i];
  4517. }
  4518. }
  4519. }
  4520. return this;
  4521. },
  4522. invoke : function(fn, args) {
  4523. var els = this.elements;
  4524. var el = this.el;
  4525. for (var i = 0, len = els.length; i < len; i++) {
  4526. el.dom = els[i];
  4527. Ext.Element.prototype[fn].apply(el, args);
  4528. }
  4529. return this;
  4530. },
  4531. item : function(index) {
  4532. if (!this.elements[index]) {
  4533. return null;
  4534. }
  4535. this.el.dom = this.elements[index];
  4536. return this.el;
  4537. },
  4538. addListener : function(eventName, handler, scope, opt) {
  4539. var els = this.elements;
  4540. for (var i = 0, len = els.length; i < len; i++) {
  4541. Ext.EventManager.on(els[i], eventName, handler, scope
  4542. || els[i], opt);
  4543. }
  4544. return this;
  4545. },
  4546. each : function(fn, scope) {
  4547. var els = this.elements;
  4548. var el = this.el;
  4549. for (var i = 0, len = els.length; i < len; i++) {
  4550. el.dom = els[i];
  4551. if (fn.call(scope || el, el, this, i) === false) {
  4552. break;
  4553. }
  4554. }
  4555. return this;
  4556. },
  4557. indexOf : function(el) {
  4558. return this.elements.indexOf(Ext.getDom(el));
  4559. },
  4560. replaceElement : function(el, replacement, domReplace) {
  4561. var index = typeof el == 'number' ? el : this.indexOf(el);
  4562. if (index !== -1) {
  4563. replacement = Ext.getDom(replacement);
  4564. if (domReplace) {
  4565. var d = this.elements[index];
  4566. d.parentNode.insertBefore(replacement, d);
  4567. Ext.removeNode(d);
  4568. }
  4569. this.elements.splice(index, 1, replacement);
  4570. }
  4571. return this;
  4572. }
  4573. });
  4574. Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;
  4575. if (Ext.DomQuery) {
  4576. Ext.Element.selectorFunction = Ext.DomQuery.select;
  4577. }
  4578. Ext.Element.select = function(selector, unique, root) {
  4579. var els;
  4580. if (typeof selector == "string") {
  4581. els = Ext.Element.selectorFunction(selector, root);
  4582. } else if (selector.length !== undefined) {
  4583. els = selector;
  4584. } else {
  4585. throw "Invalid selector";
  4586. }
  4587. if (unique === true) {
  4588. return new Ext.CompositeElement(els);
  4589. } else {
  4590. return new Ext.CompositeElementLite(els);
  4591. }
  4592. };
  4593. Ext.select = Ext.Element.select;
  4594. Ext.data.Connection = function(config) {
  4595. Ext.apply(this, config);
  4596. this.addEvents(
  4597. "beforerequest",
  4598. "requestcomplete",
  4599. "requestexception");
  4600. Ext.data.Connection.superclass.constructor.call(this);
  4601. };
  4602. Ext.extend(Ext.data.Connection, Ext.util.Observable, {
  4603. timeout : 30000,
  4604. autoAbort : false,
  4605. disableCaching : true,
  4606. request : function(o) {
  4607. if (this.fireEvent("beforerequest", this, o) !== false) {
  4608. var p = o.params;
  4609. if (typeof p == "function") {
  4610. p = p.call(o.scope || window, o);
  4611. }
  4612. if (typeof p == "object") {
  4613. p = Ext.urlEncode(p);
  4614. }
  4615. if (this.extraParams) {
  4616. var extras = Ext.urlEncode(this.extraParams);
  4617. p = p ? (p + '&' + extras) : extras;
  4618. }
  4619. var url = o.url || this.url;
  4620. if (typeof url == 'function') {
  4621. url = url.call(o.scope || window, o);
  4622. }
  4623. if (o.form) {
  4624. var form = Ext.getDom(o.form);
  4625. url = url || form.action;
  4626. var enctype = form.getAttribute("enctype");
  4627. if (o.isUpload
  4628. || (enctype && enctype.toLowerCase() == 'multipart/form-data')) {
  4629. return this.doFormUpload(o, p, url);
  4630. }
  4631. var f = Ext.lib.Ajax.serializeForm(form);
  4632. p = p ? (p + '&' + f) : f;
  4633. }
  4634. var hs = o.headers;
  4635. if (this.defaultHeaders) {
  4636. hs = Ext.apply(hs || {}, this.defaultHeaders);
  4637. if (!o.headers) {
  4638. o.headers = hs;
  4639. }
  4640. }
  4641. var cb = {
  4642. success : this.handleResponse,
  4643. failure : this.handleFailure,
  4644. scope : this,
  4645. argument : {
  4646. options : o
  4647. },
  4648. timeout : this.timeout
  4649. };
  4650. var method = o.method || this.method || (p ? "POST" : "GET");
  4651. if (method == 'GET'
  4652. && (this.disableCaching && o.disableCaching !== false)
  4653. || o.disableCaching === true) {
  4654. url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc='
  4655. + (allGetServerTime().getTime());
  4656. }
  4657. if (typeof o.autoAbort == 'boolean') {
  4658. if (o.autoAbort) {
  4659. this.abort();
  4660. }
  4661. } else if (this.autoAbort !== false) {
  4662. this.abort();
  4663. }
  4664. if ((method == 'GET' && p) || o.xmlData || o.jsonData) {
  4665. url += (url.indexOf('?') != -1 ? '&' : '?') + p;
  4666. p = '';
  4667. }
  4668. this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
  4669. return this.transId;
  4670. } else {
  4671. Ext.callback(o.callback, o.scope, [o, null, null]);
  4672. return null;
  4673. }
  4674. },
  4675. isLoading : function(transId) {
  4676. if (transId) {
  4677. return Ext.lib.Ajax.isCallInProgress(transId);
  4678. } else {
  4679. return this.transId ? true : false;
  4680. }
  4681. },
  4682. abort : function(transId) {
  4683. if (transId || this.isLoading()) {
  4684. Ext.lib.Ajax.abort(transId || this.transId);
  4685. }
  4686. },
  4687. handleResponse : function(response) {
  4688. this.transId = false;
  4689. var options = response.argument.options;
  4690. response.argument = options ? options.argument : null;
  4691. this.fireEvent("requestcomplete", this, response, options);
  4692. Ext.callback(options.success, options.scope, [response, options]);
  4693. Ext
  4694. .callback(options.callback, options.scope, [options, true,
  4695. response]);
  4696. },
  4697. handleFailure : function(response, e) {
  4698. this.transId = false;
  4699. var options = response.argument.options;
  4700. response.argument = options ? options.argument : null;
  4701. this.fireEvent("requestexception", this, response, options, e);
  4702. Ext.callback(options.failure, options.scope, [response, options]);
  4703. Ext.callback(options.callback, options.scope,
  4704. [options, false, response]);
  4705. },
  4706. doFormUpload : function(o, ps, url) {
  4707. var id = Ext.id();
  4708. var frame = document.createElement('iframe');
  4709. frame.id = id;
  4710. frame.name = id;
  4711. frame.className = 'x-hidden';
  4712. if (Ext.isIE) {
  4713. frame.src = Ext.SSL_SECURE_URL;
  4714. }
  4715. document.body.appendChild(frame);
  4716. if (Ext.isIE) {
  4717. document.frames[id].name = id;
  4718. }
  4719. var form = Ext.getDom(o.form);
  4720. form.target = id;
  4721. form.method = 'POST';
  4722. form.enctype = form.encoding = 'multipart/form-data';
  4723. if (url) {
  4724. form.action = url;
  4725. }
  4726. var hiddens, hd;
  4727. if (ps) {
  4728. hiddens = [];
  4729. ps = Ext.urlDecode(ps, false);
  4730. for (var k in ps) {
  4731. if (ps.hasOwnProperty(k)) {
  4732. hd = document.createElement('input');
  4733. hd.type = 'hidden';
  4734. hd.name = k;
  4735. hd.value = ps[k];
  4736. form.appendChild(hd);
  4737. hiddens.push(hd);
  4738. }
  4739. }
  4740. }
  4741. function cb() {
  4742. var r = {
  4743. responseText : '',
  4744. responseXML : null
  4745. };
  4746. r.argument = o ? o.argument : null;
  4747. try {
  4748. var doc;
  4749. if (Ext.isIE) {
  4750. doc = frame.contentWindow.document;
  4751. } else {
  4752. doc = (frame.contentDocument || window.frames[id].document);
  4753. }
  4754. if (doc && doc.body) {
  4755. r.responseText = doc.body.innerHTML;
  4756. }
  4757. if (doc && doc.XMLDocument) {
  4758. r.responseXML = doc.XMLDocument;
  4759. } else {
  4760. r.responseXML = doc;
  4761. }
  4762. } catch (e) {
  4763. }
  4764. Ext.EventManager.removeListener(frame, 'load', cb, this);
  4765. this.fireEvent("requestcomplete", this, r, o);
  4766. Ext.callback(o.success, o.scope, [r, o]);
  4767. Ext.callback(o.callback, o.scope, [o, true, r]);
  4768. setTimeout(function() {
  4769. Ext.removeNode(frame);
  4770. }, 100);
  4771. }
  4772. Ext.EventManager.on(frame, 'load', cb, this);
  4773. form.submit();
  4774. if (hiddens) {
  4775. for (var i = 0, len = hiddens.length; i < len; i++) {
  4776. Ext.removeNode(hiddens[i]);
  4777. }
  4778. }
  4779. }
  4780. });
  4781. Ext.Ajax = new Ext.data.Connection({
  4782. autoAbort : false,
  4783. serializeForm : function(form) {
  4784. return Ext.lib.Ajax.serializeForm(form);
  4785. }
  4786. });
  4787. Ext.Updater = function(el, forceNew) {
  4788. el = Ext.get(el);
  4789. if (!forceNew && el.updateManager) {
  4790. return el.updateManager;
  4791. }
  4792. this.el = el;
  4793. this.defaultUrl = null;
  4794. this.addEvents(
  4795. "beforeupdate",
  4796. "update",
  4797. "failure");
  4798. var d = Ext.Updater.defaults;
  4799. this.sslBlankUrl = d.sslBlankUrl;
  4800. this.disableCaching = d.disableCaching;
  4801. this.indicatorText = d.indicatorText;
  4802. this.showLoadIndicator = d.showLoadIndicator;
  4803. this.timeout = d.timeout;
  4804. this.loadScripts = d.loadScripts;
  4805. this.transaction = null;
  4806. this.autoRefreshProcId = null;
  4807. this.refreshDelegate = this.refresh.createDelegate(this);
  4808. this.updateDelegate = this.update.createDelegate(this);
  4809. this.formUpdateDelegate = this.formUpdate.createDelegate(this);
  4810. if (!this.renderer) {
  4811. this.renderer = new Ext.Updater.BasicRenderer();
  4812. }
  4813. Ext.Updater.superclass.constructor.call(this);
  4814. };
  4815. Ext.extend(Ext.Updater, Ext.util.Observable, {
  4816. getEl : function() {
  4817. return this.el;
  4818. },
  4819. update : function(url, params, callback, discardUrl) {
  4820. if (this.fireEvent("beforeupdate", this.el, url, params) !== false) {
  4821. var method = this.method, cfg, callerScope;
  4822. if (typeof url == "object") {
  4823. cfg = url;
  4824. url = cfg.url;
  4825. params = params || cfg.params;
  4826. callback = callback || cfg.callback;
  4827. discardUrl = discardUrl || cfg.discardUrl;
  4828. callerScope = cfg.scope;
  4829. if (typeof cfg.method != "undefined") {
  4830. method = cfg.method;
  4831. };
  4832. if (typeof cfg.nocache != "undefined") {
  4833. this.disableCaching = cfg.nocache;
  4834. };
  4835. if (typeof cfg.text != "undefined") {
  4836. this.indicatorText = '<div class="loading-indicator">'
  4837. + cfg.text + "</div>";
  4838. };
  4839. if (typeof cfg.scripts != "undefined") {
  4840. this.loadScripts = cfg.scripts;
  4841. };
  4842. if (typeof cfg.timeout != "undefined") {
  4843. this.timeout = cfg.timeout;
  4844. };
  4845. }
  4846. this.showLoading();
  4847. if (!discardUrl) {
  4848. this.defaultUrl = url;
  4849. }
  4850. if (typeof url == "function") {
  4851. url = url.call(this);
  4852. }
  4853. method = method || (params ? "POST" : "GET");
  4854. if (method == "GET") {
  4855. url = this.prepareUrl(url);
  4856. }
  4857. var o = Ext.apply(cfg || {}, {
  4858. url : url,
  4859. params : (typeof params == "function" && callerScope)
  4860. ? params.createDelegate(callerScope)
  4861. : params,
  4862. success : this.processSuccess,
  4863. failure : this.processFailure,
  4864. scope : this,
  4865. callback : undefined,
  4866. timeout : (this.timeout * 1000),
  4867. argument : {
  4868. "options" : cfg,
  4869. "url" : url,
  4870. "form" : null,
  4871. "callback" : callback,
  4872. "scope" : callerScope || window,
  4873. "params" : params
  4874. }
  4875. });
  4876. this.transaction = Ext.Ajax.request(o);
  4877. }
  4878. },
  4879. formUpdate : function(form, url, reset, callback) {
  4880. if (this.fireEvent("beforeupdate", this.el, form, url) !== false) {
  4881. if (typeof url == "function") {
  4882. url = url.call(this);
  4883. }
  4884. form = Ext.getDom(form)
  4885. this.transaction = Ext.Ajax.request({
  4886. form : form,
  4887. url : url,
  4888. success : this.processSuccess,
  4889. failure : this.processFailure,
  4890. scope : this,
  4891. timeout : (this.timeout * 1000),
  4892. argument : {
  4893. "url" : url,
  4894. "form" : form,
  4895. "callback" : callback,
  4896. "reset" : reset
  4897. }
  4898. });
  4899. this.showLoading.defer(1, this);
  4900. }
  4901. },
  4902. refresh : function(callback) {
  4903. if (this.defaultUrl == null) {
  4904. return;
  4905. }
  4906. this.update(this.defaultUrl, null, callback, true);
  4907. },
  4908. startAutoRefresh : function(interval, url, params, callback,
  4909. refreshNow) {
  4910. if (refreshNow) {
  4911. this.update(url || this.defaultUrl, params, callback, true);
  4912. }
  4913. if (this.autoRefreshProcId) {
  4914. clearInterval(this.autoRefreshProcId);
  4915. }
  4916. this.autoRefreshProcId = setInterval(this.update
  4917. .createDelegate(this, [url || this.defaultUrl,
  4918. params, callback, true]),
  4919. interval * 1000);
  4920. },
  4921. stopAutoRefresh : function() {
  4922. if (this.autoRefreshProcId) {
  4923. clearInterval(this.autoRefreshProcId);
  4924. delete this.autoRefreshProcId;
  4925. }
  4926. },
  4927. isAutoRefreshing : function() {
  4928. return this.autoRefreshProcId ? true : false;
  4929. },
  4930. showLoading : function() {
  4931. if (this.showLoadIndicator) {
  4932. this.el.update(this.indicatorText);
  4933. }
  4934. },
  4935. prepareUrl : function(url) {
  4936. if (this.disableCaching) {
  4937. var append = "_dc=" + (allGetServerTime().getTime());
  4938. if (url.indexOf("?") !== -1) {
  4939. url += "&" + append;
  4940. } else {
  4941. url += "?" + append;
  4942. }
  4943. }
  4944. return url;
  4945. },
  4946. processSuccess : function(response) {
  4947. this.transaction = null;
  4948. if (response.argument.form && response.argument.reset) {
  4949. try {
  4950. response.argument.form.reset();
  4951. } catch (e) {
  4952. }
  4953. }
  4954. if (this.loadScripts) {
  4955. this.renderer.render(this.el, response, this,
  4956. this.updateComplete
  4957. .createDelegate(this, [response]));
  4958. } else {
  4959. this.renderer.render(this.el, response, this);
  4960. this.updateComplete(response);
  4961. }
  4962. },
  4963. updateComplete : function(response) {
  4964. this.fireEvent("update", this.el, response);
  4965. if (typeof response.argument.callback == "function") {
  4966. response.argument.callback.call(response.argument.scope,
  4967. this.el, true, response, response.argument.options);
  4968. }
  4969. },
  4970. processFailure : function(response) {
  4971. this.transaction = null;
  4972. this.fireEvent("failure", this.el, response);
  4973. if (typeof response.argument.callback == "function") {
  4974. response.argument.callback
  4975. .call(response.argument.scope, this.el, false,
  4976. response, response.argument.options);
  4977. }
  4978. },
  4979. setRenderer : function(renderer) {
  4980. this.renderer = renderer;
  4981. },
  4982. getRenderer : function() {
  4983. return this.renderer;
  4984. },
  4985. setDefaultUrl : function(defaultUrl) {
  4986. this.defaultUrl = defaultUrl;
  4987. },
  4988. abort : function() {
  4989. if (this.transaction) {
  4990. Ext.Ajax.abort(this.transaction);
  4991. }
  4992. },
  4993. isUpdating : function() {
  4994. if (this.transaction) {
  4995. return Ext.Ajax.isLoading(this.transaction);
  4996. }
  4997. return false;
  4998. }
  4999. });
  5000. Ext.Updater.defaults = {
  5001. timeout : 30,
  5002. loadScripts : false,
  5003. sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),
  5004. disableCaching : false,
  5005. showLoadIndicator : true,
  5006. indicatorText : '<div class="loading-indicator">Loading...</div>'
  5007. };
  5008. Ext.Updater.updateElement = function(el, url, params, options) {
  5009. var um = Ext.get(el).getUpdater();
  5010. Ext.apply(um, options);
  5011. um.update(url, params, options ? options.callback : null);
  5012. };
  5013. Ext.Updater.update = Ext.Updater.updateElement;
  5014. Ext.Updater.BasicRenderer = function() {
  5015. };
  5016. Ext.Updater.BasicRenderer.prototype = {
  5017. render : function(el, response, updateManager, callback) {
  5018. el.update(response.responseText, updateManager.loadScripts, callback);
  5019. }
  5020. };
  5021. Ext.UpdateManager = Ext.Updater;
  5022. Ext.util.DelayedTask = function(fn, scope, args) {
  5023. var id = null, d, t;
  5024. var call = function() {
  5025. var now = allGetServerTime().getTime();
  5026. if (now - t >= d) {
  5027. clearInterval(id);
  5028. id = null;
  5029. fn.apply(scope, args || []);
  5030. }
  5031. };
  5032. this.delay = function(delay, newFn, newScope, newArgs) {
  5033. if (id && delay != d) {
  5034. this.cancel();
  5035. }
  5036. d = delay;
  5037. t = allGetServerTime().getTime();
  5038. fn = newFn || fn;
  5039. scope = newScope || scope;
  5040. args = newArgs || args;
  5041. if (!id) {
  5042. id = setInterval(call, d);
  5043. }
  5044. };
  5045. this.cancel = function() {
  5046. if (id) {
  5047. clearInterval(id);
  5048. id = null;
  5049. }
  5050. };
  5051. };