ext-foundation-debug.js 170 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356
  1. /*
  2. Ext JS 4.1 - JavaScript Library
  3. Copyright (c) 2006-2012, Sencha Inc.
  4. All rights reserved.
  5. licensing@sencha.com
  6. http://www.sencha.com/license
  7. Open Source License
  8. ------------------------------------------------------------------------------------------
  9. This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
  10. http://www.gnu.org/licenses/gpl.html
  11. There are several FLOSS exceptions available for use with this release for
  12. open source applications that are distributed under a license other than GPL.
  13. * Open Source License Exception for Applications
  14. http://www.sencha.com/products/floss-exception.php
  15. * Open Source License Exception for Development
  16. http://www.sencha.com/products/ux-exception.php
  17. Alternate Licensing
  18. ------------------------------------------------------------------------------------------
  19. Commercial and OEM Licenses are available for an alternate download of Ext JS.
  20. This is the appropriate option if you are creating proprietary applications and you are
  21. not prepared to distribute and share the source code of your application under the
  22. GPL v3 license. Please visit http://www.sencha.com/license for more details.
  23. --
  24. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY RIGHTS. See the GNU General Public License for more details.
  25. */
  26. //@tag foundation,core
  27. var Ext = Ext || {};
  28. Ext._startTime = new Date().getTime();
  29. (function() {
  30. var global = this,
  31. objectPrototype = Object.prototype,
  32. toString = objectPrototype.toString,
  33. enumerables = true,
  34. enumerablesTest = { toString: 1 },
  35. emptyFn = function () {},
  36. callOverrideParent = function () {
  37. var method = callOverrideParent.caller.caller;
  38. return method.$owner.prototype[method.$name].apply(this, arguments);
  39. },
  40. i;
  41. Ext.global = global;
  42. for (i in enumerablesTest) {
  43. enumerables = null;
  44. }
  45. if (enumerables) {
  46. enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
  47. 'toLocaleString', 'toString', 'constructor'];
  48. }
  49. Ext.enumerables = enumerables;
  50. Ext.apply = function(object, config, defaults) {
  51. if (defaults) {
  52. Ext.apply(object, defaults);
  53. }
  54. if (object && config && typeof config === 'object') {
  55. var i, j, k;
  56. for (i in config) {
  57. object[i] = config[i];
  58. }
  59. if (enumerables) {
  60. for (j = enumerables.length; j--;) {
  61. k = enumerables[j];
  62. if (config.hasOwnProperty(k)) {
  63. object[k] = config[k];
  64. }
  65. }
  66. }
  67. }
  68. return object;
  69. };
  70. Ext.buildSettings = Ext.apply({
  71. baseCSSPrefix: 'x-',
  72. scopeResetCSS: false
  73. }, Ext.buildSettings || {});
  74. Ext.apply(Ext, {
  75. name: Ext.sandboxName || 'Ext',
  76. emptyFn: emptyFn,
  77. emptyString: new String(),
  78. baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
  79. applyIf: function(object, config) {
  80. var property;
  81. if (object) {
  82. for (property in config) {
  83. if (object[property] === undefined) {
  84. object[property] = config[property];
  85. }
  86. }
  87. }
  88. return object;
  89. },
  90. iterate: function(object, fn, scope) {
  91. if (Ext.isEmpty(object)) {
  92. return;
  93. }
  94. if (scope === undefined) {
  95. scope = object;
  96. }
  97. if (Ext.isIterable(object)) {
  98. Ext.Array.each.call(Ext.Array, object, fn, scope);
  99. }
  100. else {
  101. Ext.Object.each.call(Ext.Object, object, fn, scope);
  102. }
  103. }
  104. });
  105. Ext.apply(Ext, {
  106. extend: (function() {
  107. var objectConstructor = objectPrototype.constructor,
  108. inlineOverrides = function(o) {
  109. for (var m in o) {
  110. if (!o.hasOwnProperty(m)) {
  111. continue;
  112. }
  113. this[m] = o[m];
  114. }
  115. };
  116. return function(subclass, superclass, overrides) {
  117. if (Ext.isObject(superclass)) {
  118. overrides = superclass;
  119. superclass = subclass;
  120. subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
  121. superclass.apply(this, arguments);
  122. };
  123. }
  124. var F = function() {},
  125. subclassProto, superclassProto = superclass.prototype;
  126. F.prototype = superclassProto;
  127. subclassProto = subclass.prototype = new F();
  128. subclassProto.constructor = subclass;
  129. subclass.superclass = superclassProto;
  130. if (superclassProto.constructor === objectConstructor) {
  131. superclassProto.constructor = superclass;
  132. }
  133. subclass.override = function(overrides) {
  134. Ext.override(subclass, overrides);
  135. };
  136. subclassProto.override = inlineOverrides;
  137. subclassProto.proto = subclassProto;
  138. subclass.override(overrides);
  139. subclass.extend = function(o) {
  140. return Ext.extend(subclass, o);
  141. };
  142. return subclass;
  143. };
  144. }()),
  145. override: function (target, overrides) {
  146. if (target.$isClass) {
  147. target.override(overrides);
  148. } else if (typeof target == 'function') {
  149. Ext.apply(target.prototype, overrides);
  150. } else {
  151. var owner = target.self,
  152. name, value;
  153. if (owner && owner.$isClass) {
  154. for (name in overrides) {
  155. if (overrides.hasOwnProperty(name)) {
  156. value = overrides[name];
  157. if (typeof value == 'function') {
  158. value.$name = name;
  159. value.$owner = owner;
  160. value.$previous = target.hasOwnProperty(name)
  161. ? target[name]
  162. : callOverrideParent;
  163. }
  164. target[name] = value;
  165. }
  166. }
  167. } else {
  168. Ext.apply(target, overrides);
  169. }
  170. }
  171. return target;
  172. }
  173. });
  174. Ext.apply(Ext, {
  175. valueFrom: function(value, defaultValue, allowBlank){
  176. return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
  177. },
  178. typeOf: function(value) {
  179. var type,
  180. typeToString;
  181. if (value === null) {
  182. return 'null';
  183. }
  184. type = typeof value;
  185. if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
  186. return type;
  187. }
  188. typeToString = toString.call(value);
  189. switch(typeToString) {
  190. case '[object Array]':
  191. return 'array';
  192. case '[object Date]':
  193. return 'date';
  194. case '[object Boolean]':
  195. return 'boolean';
  196. case '[object Number]':
  197. return 'number';
  198. case '[object RegExp]':
  199. return 'regexp';
  200. }
  201. if (type === 'function') {
  202. return 'function';
  203. }
  204. if (type === 'object') {
  205. if (value.nodeType !== undefined) {
  206. if (value.nodeType === 3) {
  207. return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
  208. }
  209. else {
  210. return 'element';
  211. }
  212. }
  213. return 'object';
  214. }
  215. },
  216. isEmpty: function(value, allowEmptyString) {
  217. return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
  218. },
  219. isArray: ('isArray' in Array) ? Array.isArray : function(value) {
  220. return toString.call(value) === '[object Array]';
  221. },
  222. isDate: function(value) {
  223. return toString.call(value) === '[object Date]';
  224. },
  225. isObject: (toString.call(null) === '[object Object]') ?
  226. function(value) {
  227. return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
  228. } :
  229. function(value) {
  230. return toString.call(value) === '[object Object]';
  231. },
  232. isSimpleObject: function(value) {
  233. return value instanceof Object && value.constructor === Object;
  234. },
  235. isPrimitive: function(value) {
  236. var type = typeof value;
  237. return type === 'string' || type === 'number' || type === 'boolean';
  238. },
  239. isFunction:
  240. (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
  241. return toString.call(value) === '[object Function]';
  242. } : function(value) {
  243. return typeof value === 'function';
  244. },
  245. isNumber: function(value) {
  246. return typeof value === 'number' && isFinite(value);
  247. },
  248. isNumeric: function(value) {
  249. return !isNaN(parseFloat(value)) && isFinite(value);
  250. },
  251. isString: function(value) {
  252. return typeof value === 'string';
  253. },
  254. isBoolean: function(value) {
  255. return typeof value === 'boolean';
  256. },
  257. isElement: function(value) {
  258. return value ? value.nodeType === 1 : false;
  259. },
  260. isTextNode: function(value) {
  261. return value ? value.nodeName === "#text" : false;
  262. },
  263. isDefined: function(value) {
  264. return typeof value !== 'undefined';
  265. },
  266. isIterable: function(value) {
  267. var type = typeof value,
  268. checkLength = false;
  269. if (value && type != 'string') {
  270. if (type == 'function') {
  271. if (Ext.isSafari) {
  272. checkLength = value instanceof NodeList || value instanceof HTMLCollection;
  273. }
  274. } else {
  275. checkLength = true;
  276. }
  277. }
  278. return checkLength ? value.length !== undefined : false;
  279. }
  280. });
  281. Ext.apply(Ext, {
  282. clone: function(item) {
  283. var type,
  284. i,
  285. j,
  286. k,
  287. clone,
  288. key;
  289. if (item === null || item === undefined) {
  290. return item;
  291. }
  292. if (item.nodeType && item.cloneNode) {
  293. return item.cloneNode(true);
  294. }
  295. type = toString.call(item);
  296. if (type === '[object Date]') {
  297. return new Date(item.getTime());
  298. }
  299. if (type === '[object Array]') {
  300. i = item.length;
  301. clone = [];
  302. while (i--) {
  303. clone[i] = Ext.clone(item[i]);
  304. }
  305. }
  306. else if (type === '[object Object]' && item.constructor === Object) {
  307. clone = {};
  308. for (key in item) {
  309. clone[key] = Ext.clone(item[key]);
  310. }
  311. if (enumerables) {
  312. for (j = enumerables.length; j--;) {
  313. k = enumerables[j];
  314. clone[k] = item[k];
  315. }
  316. }
  317. }
  318. return clone || item;
  319. },
  320. getUniqueGlobalNamespace: function() {
  321. var uniqueGlobalNamespace = this.uniqueGlobalNamespace,
  322. i;
  323. if (uniqueGlobalNamespace === undefined) {
  324. i = 0;
  325. do {
  326. uniqueGlobalNamespace = 'ExtBox' + (++i);
  327. } while (Ext.global[uniqueGlobalNamespace] !== undefined);
  328. Ext.global[uniqueGlobalNamespace] = Ext;
  329. this.uniqueGlobalNamespace = uniqueGlobalNamespace;
  330. }
  331. return uniqueGlobalNamespace;
  332. },
  333. functionFactoryCache: {},
  334. cacheableFunctionFactory: function() {
  335. var me = this,
  336. args = Array.prototype.slice.call(arguments),
  337. cache = me.functionFactoryCache,
  338. idx, fn, ln;
  339. if (Ext.isSandboxed) {
  340. ln = args.length;
  341. if (ln > 0) {
  342. ln--;
  343. args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
  344. }
  345. }
  346. idx = args.join('');
  347. fn = cache[idx];
  348. if (!fn) {
  349. fn = Function.prototype.constructor.apply(Function.prototype, args);
  350. cache[idx] = fn;
  351. }
  352. return fn;
  353. },
  354. functionFactory: function() {
  355. var me = this,
  356. args = Array.prototype.slice.call(arguments),
  357. ln;
  358. if (Ext.isSandboxed) {
  359. ln = args.length;
  360. if (ln > 0) {
  361. ln--;
  362. args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
  363. }
  364. }
  365. return Function.prototype.constructor.apply(Function.prototype, args);
  366. },
  367. Logger: {
  368. verbose: emptyFn,
  369. log: emptyFn,
  370. info: emptyFn,
  371. warn: emptyFn,
  372. error: function(message) {
  373. throw new Error(message);
  374. },
  375. deprecate: emptyFn
  376. }
  377. });
  378. Ext.type = Ext.typeOf;
  379. }());
  380. Ext.globalEval = Ext.global.execScript
  381. ? function(code) {
  382. execScript(code);
  383. }
  384. : function($$code) {
  385. (function(){
  386. eval($$code);
  387. }());
  388. };
  389. //@tag foundation,core
  390. //@require ../Ext.js
  391. (function() {
  392. var version = '4.1.1.1', Version;
  393. Ext.Version = Version = Ext.extend(Object, {
  394. constructor: function(version) {
  395. var parts, releaseStartIndex;
  396. if (version instanceof Version) {
  397. return version;
  398. }
  399. this.version = this.shortVersion = String(version).toLowerCase().replace(/_/g, '.').replace(/[\-+]/g, '');
  400. releaseStartIndex = this.version.search(/([^\d\.])/);
  401. if (releaseStartIndex !== -1) {
  402. this.release = this.version.substr(releaseStartIndex, version.length);
  403. this.shortVersion = this.version.substr(0, releaseStartIndex);
  404. }
  405. this.shortVersion = this.shortVersion.replace(/[^\d]/g, '');
  406. parts = this.version.split('.');
  407. this.major = parseInt(parts.shift() || 0, 10);
  408. this.minor = parseInt(parts.shift() || 0, 10);
  409. this.patch = parseInt(parts.shift() || 0, 10);
  410. this.build = parseInt(parts.shift() || 0, 10);
  411. return this;
  412. },
  413. toString: function() {
  414. return this.version;
  415. },
  416. valueOf: function() {
  417. return this.version;
  418. },
  419. getMajor: function() {
  420. return this.major || 0;
  421. },
  422. getMinor: function() {
  423. return this.minor || 0;
  424. },
  425. getPatch: function() {
  426. return this.patch || 0;
  427. },
  428. getBuild: function() {
  429. return this.build || 0;
  430. },
  431. getRelease: function() {
  432. return this.release || '';
  433. },
  434. isGreaterThan: function(target) {
  435. return Version.compare(this.version, target) === 1;
  436. },
  437. isGreaterThanOrEqual: function(target) {
  438. return Version.compare(this.version, target) >= 0;
  439. },
  440. isLessThan: function(target) {
  441. return Version.compare(this.version, target) === -1;
  442. },
  443. isLessThanOrEqual: function(target) {
  444. return Version.compare(this.version, target) <= 0;
  445. },
  446. equals: function(target) {
  447. return Version.compare(this.version, target) === 0;
  448. },
  449. match: function(target) {
  450. target = String(target);
  451. return this.version.substr(0, target.length) === target;
  452. },
  453. toArray: function() {
  454. return [this.getMajor(), this.getMinor(), this.getPatch(), this.getBuild(), this.getRelease()];
  455. },
  456. getShortVersion: function() {
  457. return this.shortVersion;
  458. },
  459. gt: function() {
  460. return this.isGreaterThan.apply(this, arguments);
  461. },
  462. lt: function() {
  463. return this.isLessThan.apply(this, arguments);
  464. },
  465. gtEq: function() {
  466. return this.isGreaterThanOrEqual.apply(this, arguments);
  467. },
  468. ltEq: function() {
  469. return this.isLessThanOrEqual.apply(this, arguments);
  470. }
  471. });
  472. Ext.apply(Version, {
  473. releaseValueMap: {
  474. 'dev': -6,
  475. 'alpha': -5,
  476. 'a': -5,
  477. 'beta': -4,
  478. 'b': -4,
  479. 'rc': -3,
  480. '#': -2,
  481. 'p': -1,
  482. 'pl': -1
  483. },
  484. getComponentValue: function(value) {
  485. return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
  486. },
  487. compare: function(current, target) {
  488. var currentValue, targetValue, i;
  489. current = new Version(current).toArray();
  490. target = new Version(target).toArray();
  491. for (i = 0; i < Math.max(current.length, target.length); i++) {
  492. currentValue = this.getComponentValue(current[i]);
  493. targetValue = this.getComponentValue(target[i]);
  494. if (currentValue < targetValue) {
  495. return -1;
  496. } else if (currentValue > targetValue) {
  497. return 1;
  498. }
  499. }
  500. return 0;
  501. }
  502. });
  503. Ext.apply(Ext, {
  504. versions: {},
  505. lastRegisteredVersion: null,
  506. setVersion: function(packageName, version) {
  507. Ext.versions[packageName] = new Version(version);
  508. Ext.lastRegisteredVersion = Ext.versions[packageName];
  509. return this;
  510. },
  511. getVersion: function(packageName) {
  512. if (packageName === undefined) {
  513. return Ext.lastRegisteredVersion;
  514. }
  515. return Ext.versions[packageName];
  516. },
  517. deprecate: function(packageName, since, closure, scope) {
  518. if (Version.compare(Ext.getVersion(packageName), since) < 1) {
  519. closure.call(scope);
  520. }
  521. }
  522. });
  523. Ext.setVersion('core', version);
  524. }());
  525. //@tag foundation,core
  526. //@require ../version/Version.js
  527. Ext.String = (function() {
  528. var trimRegex = /^[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+|[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000]+$/g,
  529. escapeRe = /('|\\)/g,
  530. formatRe = /\{(\d+)\}/g,
  531. escapeRegexRe = /([-.*+?\^${}()|\[\]\/\\])/g,
  532. basicTrimRe = /^\s+|\s+$/g,
  533. whitespaceRe = /\s+/,
  534. varReplace = /(^[^a-z]*|[^\w])/gi,
  535. charToEntity,
  536. entityToChar,
  537. charToEntityRegex,
  538. entityToCharRegex,
  539. htmlEncodeReplaceFn = function(match, capture) {
  540. return charToEntity[capture];
  541. },
  542. htmlDecodeReplaceFn = function(match, capture) {
  543. return (capture in entityToChar) ? entityToChar[capture] : String.fromCharCode(parseInt(capture.substr(2), 10));
  544. };
  545. return {
  546. createVarName: function(s) {
  547. return s.replace(varReplace, '');
  548. },
  549. htmlEncode: function(value) {
  550. return (!value) ? value : String(value).replace(charToEntityRegex, htmlEncodeReplaceFn);
  551. },
  552. htmlDecode: function(value) {
  553. return (!value) ? value : String(value).replace(entityToCharRegex, htmlDecodeReplaceFn);
  554. },
  555. addCharacterEntities: function(newEntities) {
  556. var charKeys = [],
  557. entityKeys = [],
  558. key, echar;
  559. for (key in newEntities) {
  560. echar = newEntities[key];
  561. entityToChar[key] = echar;
  562. charToEntity[echar] = key;
  563. charKeys.push(echar);
  564. entityKeys.push(key);
  565. }
  566. charToEntityRegex = new RegExp('(' + charKeys.join('|') + ')', 'g');
  567. entityToCharRegex = new RegExp('(' + entityKeys.join('|') + '|&#[0-9]{1,5};' + ')', 'g');
  568. },
  569. resetCharacterEntities: function() {
  570. charToEntity = {};
  571. entityToChar = {};
  572. this.addCharacterEntities({
  573. '&amp;' : '&',
  574. '&gt;' : '>',
  575. '&lt;' : '<',
  576. '&quot;' : '"',
  577. '&#39;' : "'"
  578. });
  579. },
  580. urlAppend : function(url, string) {
  581. if (!Ext.isEmpty(string)) {
  582. return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
  583. }
  584. return url;
  585. },
  586. trim: function(string) {
  587. return string.replace(trimRegex, "");
  588. },
  589. capitalize: function(string) {
  590. return string.charAt(0).toUpperCase() + string.substr(1);
  591. },
  592. uncapitalize: function(string) {
  593. return string.charAt(0).toLowerCase() + string.substr(1);
  594. },
  595. ellipsis: function(value, len, word) {
  596. if (value && value.length > len) {
  597. if (word) {
  598. var vs = value.substr(0, len - 2),
  599. index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
  600. if (index !== -1 && index >= (len - 15)) {
  601. return vs.substr(0, index) + "...";
  602. }
  603. }
  604. return value.substr(0, len - 3) + "...";
  605. }
  606. return value;
  607. },
  608. escapeRegex: function(string) {
  609. return string.replace(escapeRegexRe, "\\$1");
  610. },
  611. escape: function(string) {
  612. return string.replace(escapeRe, "\\$1");
  613. },
  614. toggle: function(string, value, other) {
  615. return string === value ? other : value;
  616. },
  617. leftPad: function(string, size, character) {
  618. var result = String(string);
  619. character = character || " ";
  620. while (result.length < size) {
  621. result = character + result;
  622. }
  623. return result;
  624. },
  625. format: function(format) {
  626. var args = Ext.Array.toArray(arguments, 1);
  627. return format.replace(formatRe, function(m, i) {
  628. return args[i];
  629. });
  630. },
  631. repeat: function(pattern, count, sep) {
  632. for (var buf = [], i = count; i--; ) {
  633. buf.push(pattern);
  634. }
  635. return buf.join(sep || '');
  636. },
  637. splitWords: function (words) {
  638. if (words && typeof words == 'string') {
  639. return words.replace(basicTrimRe, '').split(whitespaceRe);
  640. }
  641. return words || [];
  642. }
  643. };
  644. }());
  645. Ext.String.resetCharacterEntities();
  646. Ext.htmlEncode = Ext.String.htmlEncode;
  647. Ext.htmlDecode = Ext.String.htmlDecode;
  648. Ext.urlAppend = Ext.String.urlAppend;
  649. //@tag foundation,core
  650. //@require String.js
  651. //@define Ext.Number
  652. Ext.Number = new function() {
  653. var me = this,
  654. isToFixedBroken = (0.9).toFixed() !== '1',
  655. math = Math;
  656. Ext.apply(this, {
  657. constrain: function(number, min, max) {
  658. var x = parseFloat(number);
  659. return (x < min) ? min : ((x > max) ? max : x);
  660. },
  661. snap : function(value, increment, minValue, maxValue) {
  662. var m;
  663. if (value === undefined || value < minValue) {
  664. return minValue || 0;
  665. }
  666. if (increment) {
  667. m = value % increment;
  668. if (m !== 0) {
  669. value -= m;
  670. if (m * 2 >= increment) {
  671. value += increment;
  672. } else if (m * 2 < -increment) {
  673. value -= increment;
  674. }
  675. }
  676. }
  677. return me.constrain(value, minValue, maxValue);
  678. },
  679. snapInRange : function(value, increment, minValue, maxValue) {
  680. var tween;
  681. minValue = (minValue || 0);
  682. if (value === undefined || value < minValue) {
  683. return minValue;
  684. }
  685. if (increment && (tween = ((value - minValue) % increment))) {
  686. value -= tween;
  687. tween *= 2;
  688. if (tween >= increment) {
  689. value += increment;
  690. }
  691. }
  692. if (maxValue !== undefined) {
  693. if (value > (maxValue = me.snapInRange(maxValue, increment, minValue))) {
  694. value = maxValue;
  695. }
  696. }
  697. return value;
  698. },
  699. toFixed: isToFixedBroken ? function(value, precision) {
  700. precision = precision || 0;
  701. var pow = math.pow(10, precision);
  702. return (math.round(value * pow) / pow).toFixed(precision);
  703. } : function(value, precision) {
  704. return value.toFixed(precision);
  705. },
  706. from: function(value, defaultValue) {
  707. if (isFinite(value)) {
  708. value = parseFloat(value);
  709. }
  710. return !isNaN(value) ? value : defaultValue;
  711. },
  712. randomInt: function (from, to) {
  713. return math.floor(math.random() * (to - from + 1) + from);
  714. }
  715. });
  716. Ext.num = function() {
  717. return me.from.apply(this, arguments);
  718. };
  719. };
  720. //@tag foundation,core
  721. //@require Number.js
  722. (function() {
  723. var arrayPrototype = Array.prototype,
  724. slice = arrayPrototype.slice,
  725. supportsSplice = (function () {
  726. var array = [],
  727. lengthBefore,
  728. j = 20;
  729. if (!array.splice) {
  730. return false;
  731. }
  732. while (j--) {
  733. array.push("A");
  734. }
  735. array.splice(15, 0, "F", "F", "F", "F", "F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F","F");
  736. lengthBefore = array.length;
  737. array.splice(13, 0, "XXX");
  738. if (lengthBefore+1 != array.length) {
  739. return false;
  740. }
  741. return true;
  742. }()),
  743. supportsForEach = 'forEach' in arrayPrototype,
  744. supportsMap = 'map' in arrayPrototype,
  745. supportsIndexOf = 'indexOf' in arrayPrototype,
  746. supportsEvery = 'every' in arrayPrototype,
  747. supportsSome = 'some' in arrayPrototype,
  748. supportsFilter = 'filter' in arrayPrototype,
  749. supportsSort = (function() {
  750. var a = [1,2,3,4,5].sort(function(){ return 0; });
  751. return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
  752. }()),
  753. supportsSliceOnNodeList = true,
  754. ExtArray,
  755. erase,
  756. replace,
  757. splice;
  758. try {
  759. if (typeof document !== 'undefined') {
  760. slice.call(document.getElementsByTagName('body'));
  761. }
  762. } catch (e) {
  763. supportsSliceOnNodeList = false;
  764. }
  765. function fixArrayIndex (array, index) {
  766. return (index < 0) ? Math.max(0, array.length + index)
  767. : Math.min(array.length, index);
  768. }
  769. function replaceSim (array, index, removeCount, insert) {
  770. var add = insert ? insert.length : 0,
  771. length = array.length,
  772. pos = fixArrayIndex(array, index),
  773. remove,
  774. tailOldPos,
  775. tailNewPos,
  776. tailCount,
  777. lengthAfterRemove,
  778. i;
  779. if (pos === length) {
  780. if (add) {
  781. array.push.apply(array, insert);
  782. }
  783. } else {
  784. remove = Math.min(removeCount, length - pos);
  785. tailOldPos = pos + remove;
  786. tailNewPos = tailOldPos + add - remove;
  787. tailCount = length - tailOldPos;
  788. lengthAfterRemove = length - remove;
  789. if (tailNewPos < tailOldPos) {
  790. for (i = 0; i < tailCount; ++i) {
  791. array[tailNewPos+i] = array[tailOldPos+i];
  792. }
  793. } else if (tailNewPos > tailOldPos) {
  794. for (i = tailCount; i--; ) {
  795. array[tailNewPos+i] = array[tailOldPos+i];
  796. }
  797. }
  798. if (add && pos === lengthAfterRemove) {
  799. array.length = lengthAfterRemove;
  800. array.push.apply(array, insert);
  801. } else {
  802. array.length = lengthAfterRemove + add;
  803. for (i = 0; i < add; ++i) {
  804. array[pos+i] = insert[i];
  805. }
  806. }
  807. }
  808. return array;
  809. }
  810. function replaceNative (array, index, removeCount, insert) {
  811. if (insert && insert.length) {
  812. if (index < array.length) {
  813. array.splice.apply(array, [index, removeCount].concat(insert));
  814. } else {
  815. array.push.apply(array, insert);
  816. }
  817. } else {
  818. array.splice(index, removeCount);
  819. }
  820. return array;
  821. }
  822. function eraseSim (array, index, removeCount) {
  823. return replaceSim(array, index, removeCount);
  824. }
  825. function eraseNative (array, index, removeCount) {
  826. array.splice(index, removeCount);
  827. return array;
  828. }
  829. function spliceSim (array, index, removeCount) {
  830. var pos = fixArrayIndex(array, index),
  831. removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
  832. if (arguments.length < 4) {
  833. replaceSim(array, pos, removeCount);
  834. } else {
  835. replaceSim(array, pos, removeCount, slice.call(arguments, 3));
  836. }
  837. return removed;
  838. }
  839. function spliceNative (array) {
  840. return array.splice.apply(array, slice.call(arguments, 1));
  841. }
  842. erase = supportsSplice ? eraseNative : eraseSim;
  843. replace = supportsSplice ? replaceNative : replaceSim;
  844. splice = supportsSplice ? spliceNative : spliceSim;
  845. ExtArray = Ext.Array = {
  846. each: function(array, fn, scope, reverse) {
  847. array = ExtArray.from(array);
  848. var i,
  849. ln = array.length;
  850. if (reverse !== true) {
  851. for (i = 0; i < ln; i++) {
  852. if (fn.call(scope || array[i], array[i], i, array) === false) {
  853. return i;
  854. }
  855. }
  856. }
  857. else {
  858. for (i = ln - 1; i > -1; i--) {
  859. if (fn.call(scope || array[i], array[i], i, array) === false) {
  860. return i;
  861. }
  862. }
  863. }
  864. return true;
  865. },
  866. forEach: supportsForEach ? function(array, fn, scope) {
  867. return array.forEach(fn, scope);
  868. } : function(array, fn, scope) {
  869. var i = 0,
  870. ln = array.length;
  871. for (; i < ln; i++) {
  872. fn.call(scope, array[i], i, array);
  873. }
  874. },
  875. indexOf: supportsIndexOf ? function(array, item, from) {
  876. return array.indexOf(item, from);
  877. } : function(array, item, from) {
  878. var i, length = array.length;
  879. for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
  880. if (array[i] === item) {
  881. return i;
  882. }
  883. }
  884. return -1;
  885. },
  886. contains: supportsIndexOf ? function(array, item) {
  887. return array.indexOf(item) !== -1;
  888. } : function(array, item) {
  889. var i, ln;
  890. for (i = 0, ln = array.length; i < ln; i++) {
  891. if (array[i] === item) {
  892. return true;
  893. }
  894. }
  895. return false;
  896. },
  897. toArray: function(iterable, start, end){
  898. if (!iterable || !iterable.length) {
  899. return [];
  900. }
  901. if (typeof iterable === 'string') {
  902. iterable = iterable.split('');
  903. }
  904. if (supportsSliceOnNodeList) {
  905. return slice.call(iterable, start || 0, end || iterable.length);
  906. }
  907. var array = [],
  908. i;
  909. start = start || 0;
  910. end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
  911. for (i = start; i < end; i++) {
  912. array.push(iterable[i]);
  913. }
  914. return array;
  915. },
  916. pluck: function(array, propertyName) {
  917. var ret = [],
  918. i, ln, item;
  919. for (i = 0, ln = array.length; i < ln; i++) {
  920. item = array[i];
  921. ret.push(item[propertyName]);
  922. }
  923. return ret;
  924. },
  925. map: supportsMap ? function(array, fn, scope) {
  926. return array.map(fn, scope);
  927. } : function(array, fn, scope) {
  928. var results = [],
  929. i = 0,
  930. len = array.length;
  931. for (; i < len; i++) {
  932. results[i] = fn.call(scope, array[i], i, array);
  933. }
  934. return results;
  935. },
  936. every: supportsEvery ? function(array, fn, scope) {
  937. return array.every(fn, scope);
  938. } : function(array, fn, scope) {
  939. var i = 0,
  940. ln = array.length;
  941. for (; i < ln; ++i) {
  942. if (!fn.call(scope, array[i], i, array)) {
  943. return false;
  944. }
  945. }
  946. return true;
  947. },
  948. some: supportsSome ? function(array, fn, scope) {
  949. return array.some(fn, scope);
  950. } : function(array, fn, scope) {
  951. var i = 0,
  952. ln = array.length;
  953. for (; i < ln; ++i) {
  954. if (fn.call(scope, array[i], i, array)) {
  955. return true;
  956. }
  957. }
  958. return false;
  959. },
  960. clean: function(array) {
  961. var results = [],
  962. i = 0,
  963. ln = array.length,
  964. item;
  965. for (; i < ln; i++) {
  966. item = array[i];
  967. if (!Ext.isEmpty(item)) {
  968. results.push(item);
  969. }
  970. }
  971. return results;
  972. },
  973. unique: function(array) {
  974. var clone = [],
  975. i = 0,
  976. ln = array.length,
  977. item;
  978. for (; i < ln; i++) {
  979. item = array[i];
  980. if (ExtArray.indexOf(clone, item) === -1) {
  981. clone.push(item);
  982. }
  983. }
  984. return clone;
  985. },
  986. filter: supportsFilter ? function(array, fn, scope) {
  987. return array.filter(fn, scope);
  988. } : function(array, fn, scope) {
  989. var results = [],
  990. i = 0,
  991. ln = array.length;
  992. for (; i < ln; i++) {
  993. if (fn.call(scope, array[i], i, array)) {
  994. results.push(array[i]);
  995. }
  996. }
  997. return results;
  998. },
  999. from: function(value, newReference) {
  1000. if (value === undefined || value === null) {
  1001. return [];
  1002. }
  1003. if (Ext.isArray(value)) {
  1004. return (newReference) ? slice.call(value) : value;
  1005. }
  1006. var type = typeof value;
  1007. if (value && value.length !== undefined && type !== 'string' && (type !== 'function' || !value.apply)) {
  1008. return ExtArray.toArray(value);
  1009. }
  1010. return [value];
  1011. },
  1012. remove: function(array, item) {
  1013. var index = ExtArray.indexOf(array, item);
  1014. if (index !== -1) {
  1015. erase(array, index, 1);
  1016. }
  1017. return array;
  1018. },
  1019. include: function(array, item) {
  1020. if (!ExtArray.contains(array, item)) {
  1021. array.push(item);
  1022. }
  1023. },
  1024. clone: function(array) {
  1025. return slice.call(array);
  1026. },
  1027. merge: function() {
  1028. var args = slice.call(arguments),
  1029. array = [],
  1030. i, ln;
  1031. for (i = 0, ln = args.length; i < ln; i++) {
  1032. array = array.concat(args[i]);
  1033. }
  1034. return ExtArray.unique(array);
  1035. },
  1036. intersect: function() {
  1037. var intersection = [],
  1038. arrays = slice.call(arguments),
  1039. arraysLength,
  1040. array,
  1041. arrayLength,
  1042. minArray,
  1043. minArrayIndex,
  1044. minArrayCandidate,
  1045. minArrayLength,
  1046. element,
  1047. elementCandidate,
  1048. elementCount,
  1049. i, j, k;
  1050. if (!arrays.length) {
  1051. return intersection;
  1052. }
  1053. arraysLength = arrays.length;
  1054. for (i = minArrayIndex = 0; i < arraysLength; i++) {
  1055. minArrayCandidate = arrays[i];
  1056. if (!minArray || minArrayCandidate.length < minArray.length) {
  1057. minArray = minArrayCandidate;
  1058. minArrayIndex = i;
  1059. }
  1060. }
  1061. minArray = ExtArray.unique(minArray);
  1062. erase(arrays, minArrayIndex, 1);
  1063. minArrayLength = minArray.length;
  1064. arraysLength = arrays.length;
  1065. for (i = 0; i < minArrayLength; i++) {
  1066. element = minArray[i];
  1067. elementCount = 0;
  1068. for (j = 0; j < arraysLength; j++) {
  1069. array = arrays[j];
  1070. arrayLength = array.length;
  1071. for (k = 0; k < arrayLength; k++) {
  1072. elementCandidate = array[k];
  1073. if (element === elementCandidate) {
  1074. elementCount++;
  1075. break;
  1076. }
  1077. }
  1078. }
  1079. if (elementCount === arraysLength) {
  1080. intersection.push(element);
  1081. }
  1082. }
  1083. return intersection;
  1084. },
  1085. difference: function(arrayA, arrayB) {
  1086. var clone = slice.call(arrayA),
  1087. ln = clone.length,
  1088. i, j, lnB;
  1089. for (i = 0,lnB = arrayB.length; i < lnB; i++) {
  1090. for (j = 0; j < ln; j++) {
  1091. if (clone[j] === arrayB[i]) {
  1092. erase(clone, j, 1);
  1093. j--;
  1094. ln--;
  1095. }
  1096. }
  1097. }
  1098. return clone;
  1099. },
  1100. slice: ([1,2].slice(1, undefined).length ?
  1101. function (array, begin, end) {
  1102. return slice.call(array, begin, end);
  1103. } :
  1104. function (array, begin, end) {
  1105. if (typeof begin === 'undefined') {
  1106. return slice.call(array);
  1107. }
  1108. if (typeof end === 'undefined') {
  1109. return slice.call(array, begin);
  1110. }
  1111. return slice.call(array, begin, end);
  1112. }
  1113. ),
  1114. sort: supportsSort ? function(array, sortFn) {
  1115. if (sortFn) {
  1116. return array.sort(sortFn);
  1117. } else {
  1118. return array.sort();
  1119. }
  1120. } : function(array, sortFn) {
  1121. var length = array.length,
  1122. i = 0,
  1123. comparison,
  1124. j, min, tmp;
  1125. for (; i < length; i++) {
  1126. min = i;
  1127. for (j = i + 1; j < length; j++) {
  1128. if (sortFn) {
  1129. comparison = sortFn(array[j], array[min]);
  1130. if (comparison < 0) {
  1131. min = j;
  1132. }
  1133. } else if (array[j] < array[min]) {
  1134. min = j;
  1135. }
  1136. }
  1137. if (min !== i) {
  1138. tmp = array[i];
  1139. array[i] = array[min];
  1140. array[min] = tmp;
  1141. }
  1142. }
  1143. return array;
  1144. },
  1145. flatten: function(array) {
  1146. var worker = [];
  1147. function rFlatten(a) {
  1148. var i, ln, v;
  1149. for (i = 0, ln = a.length; i < ln; i++) {
  1150. v = a[i];
  1151. if (Ext.isArray(v)) {
  1152. rFlatten(v);
  1153. } else {
  1154. worker.push(v);
  1155. }
  1156. }
  1157. return worker;
  1158. }
  1159. return rFlatten(array);
  1160. },
  1161. min: function(array, comparisonFn) {
  1162. var min = array[0],
  1163. i, ln, item;
  1164. for (i = 0, ln = array.length; i < ln; i++) {
  1165. item = array[i];
  1166. if (comparisonFn) {
  1167. if (comparisonFn(min, item) === 1) {
  1168. min = item;
  1169. }
  1170. }
  1171. else {
  1172. if (item < min) {
  1173. min = item;
  1174. }
  1175. }
  1176. }
  1177. return min;
  1178. },
  1179. max: function(array, comparisonFn) {
  1180. var max = array[0],
  1181. i, ln, item;
  1182. for (i = 0, ln = array.length; i < ln; i++) {
  1183. item = array[i];
  1184. if (comparisonFn) {
  1185. if (comparisonFn(max, item) === -1) {
  1186. max = item;
  1187. }
  1188. }
  1189. else {
  1190. if (item > max) {
  1191. max = item;
  1192. }
  1193. }
  1194. }
  1195. return max;
  1196. },
  1197. mean: function(array) {
  1198. return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
  1199. },
  1200. sum: function(array) {
  1201. var sum = 0,
  1202. i, ln, item;
  1203. for (i = 0,ln = array.length; i < ln; i++) {
  1204. item = array[i];
  1205. sum += item;
  1206. }
  1207. return sum;
  1208. },
  1209. toMap: function(array, getKey, scope) {
  1210. var map = {},
  1211. i = array.length;
  1212. if (!getKey) {
  1213. while (i--) {
  1214. map[array[i]] = i+1;
  1215. }
  1216. } else if (typeof getKey == 'string') {
  1217. while (i--) {
  1218. map[array[i][getKey]] = i+1;
  1219. }
  1220. } else {
  1221. while (i--) {
  1222. map[getKey.call(scope, array[i])] = i+1;
  1223. }
  1224. }
  1225. return map;
  1226. },
  1227. erase: erase,
  1228. insert: function (array, index, items) {
  1229. return replace(array, index, 0, items);
  1230. },
  1231. replace: replace,
  1232. splice: splice,
  1233. push: function(array) {
  1234. var len = arguments.length,
  1235. i = 1,
  1236. newItem;
  1237. if (array === undefined) {
  1238. array = [];
  1239. } else if (!Ext.isArray(array)) {
  1240. array = [array];
  1241. }
  1242. for (; i < len; i++) {
  1243. newItem = arguments[i];
  1244. Array.prototype.push[Ext.isArray(newItem) ? 'apply' : 'call'](array, newItem);
  1245. }
  1246. return array;
  1247. }
  1248. };
  1249. Ext.each = ExtArray.each;
  1250. ExtArray.union = ExtArray.merge;
  1251. Ext.min = ExtArray.min;
  1252. Ext.max = ExtArray.max;
  1253. Ext.sum = ExtArray.sum;
  1254. Ext.mean = ExtArray.mean;
  1255. Ext.flatten = ExtArray.flatten;
  1256. Ext.clean = ExtArray.clean;
  1257. Ext.unique = ExtArray.unique;
  1258. Ext.pluck = ExtArray.pluck;
  1259. Ext.toArray = function() {
  1260. return ExtArray.toArray.apply(ExtArray, arguments);
  1261. };
  1262. }());
  1263. //@tag foundation,core
  1264. //@require Array.js
  1265. Ext.Function = {
  1266. flexSetter: function(fn) {
  1267. return function(a, b) {
  1268. var k, i;
  1269. if (a === null) {
  1270. return this;
  1271. }
  1272. if (typeof a !== 'string') {
  1273. for (k in a) {
  1274. if (a.hasOwnProperty(k)) {
  1275. fn.call(this, k, a[k]);
  1276. }
  1277. }
  1278. if (Ext.enumerables) {
  1279. for (i = Ext.enumerables.length; i--;) {
  1280. k = Ext.enumerables[i];
  1281. if (a.hasOwnProperty(k)) {
  1282. fn.call(this, k, a[k]);
  1283. }
  1284. }
  1285. }
  1286. } else {
  1287. fn.call(this, a, b);
  1288. }
  1289. return this;
  1290. };
  1291. },
  1292. bind: function(fn, scope, args, appendArgs) {
  1293. if (arguments.length === 2) {
  1294. return function() {
  1295. return fn.apply(scope, arguments);
  1296. };
  1297. }
  1298. var method = fn,
  1299. slice = Array.prototype.slice;
  1300. return function() {
  1301. var callArgs = args || arguments;
  1302. if (appendArgs === true) {
  1303. callArgs = slice.call(arguments, 0);
  1304. callArgs = callArgs.concat(args);
  1305. }
  1306. else if (typeof appendArgs == 'number') {
  1307. callArgs = slice.call(arguments, 0);
  1308. Ext.Array.insert(callArgs, appendArgs, args);
  1309. }
  1310. return method.apply(scope || Ext.global, callArgs);
  1311. };
  1312. },
  1313. pass: function(fn, args, scope) {
  1314. if (!Ext.isArray(args)) {
  1315. if (Ext.isIterable(args)) {
  1316. args = Ext.Array.clone(args);
  1317. } else {
  1318. args = args !== undefined ? [args] : [];
  1319. }
  1320. }
  1321. return function() {
  1322. var fnArgs = [].concat(args);
  1323. fnArgs.push.apply(fnArgs, arguments);
  1324. return fn.apply(scope || this, fnArgs);
  1325. };
  1326. },
  1327. alias: function(object, methodName) {
  1328. return function() {
  1329. return object[methodName].apply(object, arguments);
  1330. };
  1331. },
  1332. clone: function(method) {
  1333. return function() {
  1334. return method.apply(this, arguments);
  1335. };
  1336. },
  1337. createInterceptor: function(origFn, newFn, scope, returnValue) {
  1338. var method = origFn;
  1339. if (!Ext.isFunction(newFn)) {
  1340. return origFn;
  1341. }
  1342. else {
  1343. return function() {
  1344. var me = this,
  1345. args = arguments;
  1346. newFn.target = me;
  1347. newFn.method = origFn;
  1348. return (newFn.apply(scope || me || Ext.global, args) !== false) ? origFn.apply(me || Ext.global, args) : returnValue || null;
  1349. };
  1350. }
  1351. },
  1352. createDelayed: function(fn, delay, scope, args, appendArgs) {
  1353. if (scope || args) {
  1354. fn = Ext.Function.bind(fn, scope, args, appendArgs);
  1355. }
  1356. return function() {
  1357. var me = this,
  1358. args = Array.prototype.slice.call(arguments);
  1359. setTimeout(function() {
  1360. fn.apply(me, args);
  1361. }, delay);
  1362. };
  1363. },
  1364. defer: function(fn, millis, scope, args, appendArgs) {
  1365. fn = Ext.Function.bind(fn, scope, args, appendArgs);
  1366. if (millis > 0) {
  1367. return setTimeout(Ext.supports.TimeoutActualLateness ? function () {
  1368. fn();
  1369. } : fn, millis);
  1370. }
  1371. fn();
  1372. return 0;
  1373. },
  1374. createSequence: function(originalFn, newFn, scope) {
  1375. if (!newFn) {
  1376. return originalFn;
  1377. }
  1378. else {
  1379. return function() {
  1380. var result = originalFn.apply(this, arguments);
  1381. newFn.apply(scope || this, arguments);
  1382. return result;
  1383. };
  1384. }
  1385. },
  1386. createBuffered: function(fn, buffer, scope, args) {
  1387. var timerId;
  1388. return function() {
  1389. var callArgs = args || Array.prototype.slice.call(arguments, 0),
  1390. me = scope || this;
  1391. if (timerId) {
  1392. clearTimeout(timerId);
  1393. }
  1394. timerId = setTimeout(function(){
  1395. fn.apply(me, callArgs);
  1396. }, buffer);
  1397. };
  1398. },
  1399. createThrottled: function(fn, interval, scope) {
  1400. var lastCallTime, elapsed, lastArgs, timer, execute = function() {
  1401. fn.apply(scope || this, lastArgs);
  1402. lastCallTime = new Date().getTime();
  1403. };
  1404. return function() {
  1405. elapsed = new Date().getTime() - lastCallTime;
  1406. lastArgs = arguments;
  1407. clearTimeout(timer);
  1408. if (!lastCallTime || (elapsed >= interval)) {
  1409. execute();
  1410. } else {
  1411. timer = setTimeout(execute, interval - elapsed);
  1412. }
  1413. };
  1414. },
  1415. interceptBefore: function(object, methodName, fn, scope) {
  1416. var method = object[methodName] || Ext.emptyFn;
  1417. return (object[methodName] = function() {
  1418. var ret = fn.apply(scope || this, arguments);
  1419. method.apply(this, arguments);
  1420. return ret;
  1421. });
  1422. },
  1423. interceptAfter: function(object, methodName, fn, scope) {
  1424. var method = object[methodName] || Ext.emptyFn;
  1425. return (object[methodName] = function() {
  1426. method.apply(this, arguments);
  1427. return fn.apply(scope || this, arguments);
  1428. });
  1429. }
  1430. };
  1431. Ext.defer = Ext.Function.alias(Ext.Function, 'defer');
  1432. Ext.pass = Ext.Function.alias(Ext.Function, 'pass');
  1433. Ext.bind = Ext.Function.alias(Ext.Function, 'bind');
  1434. //@tag foundation,core
  1435. //@require Function.js
  1436. (function() {
  1437. var TemplateClass = function(){},
  1438. ExtObject = Ext.Object = {
  1439. chain: function (object) {
  1440. TemplateClass.prototype = object;
  1441. var result = new TemplateClass();
  1442. TemplateClass.prototype = null;
  1443. return result;
  1444. },
  1445. toQueryObjects: function(name, value, recursive) {
  1446. var self = ExtObject.toQueryObjects,
  1447. objects = [],
  1448. i, ln;
  1449. if (Ext.isArray(value)) {
  1450. for (i = 0, ln = value.length; i < ln; i++) {
  1451. if (recursive) {
  1452. objects = objects.concat(self(name + '[' + i + ']', value[i], true));
  1453. }
  1454. else {
  1455. objects.push({
  1456. name: name,
  1457. value: value[i]
  1458. });
  1459. }
  1460. }
  1461. }
  1462. else if (Ext.isObject(value)) {
  1463. for (i in value) {
  1464. if (value.hasOwnProperty(i)) {
  1465. if (recursive) {
  1466. objects = objects.concat(self(name + '[' + i + ']', value[i], true));
  1467. }
  1468. else {
  1469. objects.push({
  1470. name: name,
  1471. value: value[i]
  1472. });
  1473. }
  1474. }
  1475. }
  1476. }
  1477. else {
  1478. objects.push({
  1479. name: name,
  1480. value: value
  1481. });
  1482. }
  1483. return objects;
  1484. },
  1485. toQueryString: function(object, recursive) {
  1486. var paramObjects = [],
  1487. params = [],
  1488. i, j, ln, paramObject, value;
  1489. for (i in object) {
  1490. if (object.hasOwnProperty(i)) {
  1491. paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
  1492. }
  1493. }
  1494. for (j = 0, ln = paramObjects.length; j < ln; j++) {
  1495. paramObject = paramObjects[j];
  1496. value = paramObject.value;
  1497. if (Ext.isEmpty(value)) {
  1498. value = '';
  1499. }
  1500. else if (Ext.isDate(value)) {
  1501. value = Ext.Date.toString(value);
  1502. }
  1503. params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
  1504. }
  1505. return params.join('&');
  1506. },
  1507. fromQueryString: function(queryString, recursive) {
  1508. var parts = queryString.replace(/^\?/, '').split('&'),
  1509. object = {},
  1510. temp, components, name, value, i, ln,
  1511. part, j, subLn, matchedKeys, matchedName,
  1512. keys, key, nextKey;
  1513. for (i = 0, ln = parts.length; i < ln; i++) {
  1514. part = parts[i];
  1515. if (part.length > 0) {
  1516. components = part.split('=');
  1517. name = decodeURIComponent(components[0]);
  1518. value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
  1519. if (!recursive) {
  1520. if (object.hasOwnProperty(name)) {
  1521. if (!Ext.isArray(object[name])) {
  1522. object[name] = [object[name]];
  1523. }
  1524. object[name].push(value);
  1525. }
  1526. else {
  1527. object[name] = value;
  1528. }
  1529. }
  1530. else {
  1531. matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
  1532. matchedName = name.match(/^([^\[]+)/);
  1533. name = matchedName[0];
  1534. keys = [];
  1535. if (matchedKeys === null) {
  1536. object[name] = value;
  1537. continue;
  1538. }
  1539. for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
  1540. key = matchedKeys[j];
  1541. key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
  1542. keys.push(key);
  1543. }
  1544. keys.unshift(name);
  1545. temp = object;
  1546. for (j = 0, subLn = keys.length; j < subLn; j++) {
  1547. key = keys[j];
  1548. if (j === subLn - 1) {
  1549. if (Ext.isArray(temp) && key === '') {
  1550. temp.push(value);
  1551. }
  1552. else {
  1553. temp[key] = value;
  1554. }
  1555. }
  1556. else {
  1557. if (temp[key] === undefined || typeof temp[key] === 'string') {
  1558. nextKey = keys[j+1];
  1559. temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
  1560. }
  1561. temp = temp[key];
  1562. }
  1563. }
  1564. }
  1565. }
  1566. }
  1567. return object;
  1568. },
  1569. each: function(object, fn, scope) {
  1570. for (var property in object) {
  1571. if (object.hasOwnProperty(property)) {
  1572. if (fn.call(scope || object, property, object[property], object) === false) {
  1573. return;
  1574. }
  1575. }
  1576. }
  1577. },
  1578. merge: function(destination) {
  1579. var i = 1,
  1580. ln = arguments.length,
  1581. mergeFn = ExtObject.merge,
  1582. cloneFn = Ext.clone,
  1583. object, key, value, sourceKey;
  1584. for (; i < ln; i++) {
  1585. object = arguments[i];
  1586. for (key in object) {
  1587. value = object[key];
  1588. if (value && value.constructor === Object) {
  1589. sourceKey = destination[key];
  1590. if (sourceKey && sourceKey.constructor === Object) {
  1591. mergeFn(sourceKey, value);
  1592. }
  1593. else {
  1594. destination[key] = cloneFn(value);
  1595. }
  1596. }
  1597. else {
  1598. destination[key] = value;
  1599. }
  1600. }
  1601. }
  1602. return destination;
  1603. },
  1604. mergeIf: function(destination) {
  1605. var i = 1,
  1606. ln = arguments.length,
  1607. cloneFn = Ext.clone,
  1608. object, key, value;
  1609. for (; i < ln; i++) {
  1610. object = arguments[i];
  1611. for (key in object) {
  1612. if (!(key in destination)) {
  1613. value = object[key];
  1614. if (value && value.constructor === Object) {
  1615. destination[key] = cloneFn(value);
  1616. }
  1617. else {
  1618. destination[key] = value;
  1619. }
  1620. }
  1621. }
  1622. }
  1623. return destination;
  1624. },
  1625. getKey: function(object, value) {
  1626. for (var property in object) {
  1627. if (object.hasOwnProperty(property) && object[property] === value) {
  1628. return property;
  1629. }
  1630. }
  1631. return null;
  1632. },
  1633. getValues: function(object) {
  1634. var values = [],
  1635. property;
  1636. for (property in object) {
  1637. if (object.hasOwnProperty(property)) {
  1638. values.push(object[property]);
  1639. }
  1640. }
  1641. return values;
  1642. },
  1643. getKeys: (typeof Object.keys == 'function')
  1644. ? function(object){
  1645. if (!object) {
  1646. return [];
  1647. }
  1648. return Object.keys(object);
  1649. }
  1650. : function(object) {
  1651. var keys = [],
  1652. property;
  1653. for (property in object) {
  1654. if (object.hasOwnProperty(property)) {
  1655. keys.push(property);
  1656. }
  1657. }
  1658. return keys;
  1659. },
  1660. getSize: function(object) {
  1661. var size = 0,
  1662. property;
  1663. for (property in object) {
  1664. if (object.hasOwnProperty(property)) {
  1665. size++;
  1666. }
  1667. }
  1668. return size;
  1669. },
  1670. classify: function(object) {
  1671. var prototype = object,
  1672. objectProperties = [],
  1673. propertyClassesMap = {},
  1674. objectClass = function() {
  1675. var i = 0,
  1676. ln = objectProperties.length,
  1677. property;
  1678. for (; i < ln; i++) {
  1679. property = objectProperties[i];
  1680. this[property] = new propertyClassesMap[property]();
  1681. }
  1682. },
  1683. key, value;
  1684. for (key in object) {
  1685. if (object.hasOwnProperty(key)) {
  1686. value = object[key];
  1687. if (value && value.constructor === Object) {
  1688. objectProperties.push(key);
  1689. propertyClassesMap[key] = ExtObject.classify(value);
  1690. }
  1691. }
  1692. }
  1693. objectClass.prototype = prototype;
  1694. return objectClass;
  1695. }
  1696. };
  1697. Ext.merge = Ext.Object.merge;
  1698. Ext.mergeIf = Ext.Object.mergeIf;
  1699. Ext.urlEncode = function() {
  1700. var args = Ext.Array.from(arguments),
  1701. prefix = '';
  1702. if ((typeof args[1] === 'string')) {
  1703. prefix = args[1] + '&';
  1704. args[1] = false;
  1705. }
  1706. return prefix + ExtObject.toQueryString.apply(ExtObject, args);
  1707. };
  1708. Ext.urlDecode = function() {
  1709. return ExtObject.fromQueryString.apply(ExtObject, arguments);
  1710. };
  1711. }());
  1712. //@tag foundation,core
  1713. //@require Object.js
  1714. //@define Ext.Date
  1715. (function() {
  1716. function xf(format) {
  1717. var args = Array.prototype.slice.call(arguments, 1);
  1718. return format.replace(/\{(\d+)\}/g, function(m, i) {
  1719. return args[i];
  1720. });
  1721. }
  1722. Ext.Date = {
  1723. now: Date.now || function() {
  1724. return +new Date();
  1725. },
  1726. toString: function(date) {
  1727. var pad = Ext.String.leftPad;
  1728. return date.getFullYear() + "-"
  1729. + pad(date.getMonth() + 1, 2, '0') + "-"
  1730. + pad(date.getDate(), 2, '0') + "T"
  1731. + pad(date.getHours(), 2, '0') + ":"
  1732. + pad(date.getMinutes(), 2, '0') + ":"
  1733. + pad(date.getSeconds(), 2, '0');
  1734. },
  1735. getElapsed: function(dateA, dateB) {
  1736. return Math.abs(dateA - (dateB || new Date()));
  1737. },
  1738. useStrict: false,
  1739. formatCodeToRegex: function(character, currentGroup) {
  1740. var p = utilDate.parseCodes[character];
  1741. if (p) {
  1742. p = typeof p == 'function'? p() : p;
  1743. utilDate.parseCodes[character] = p;
  1744. }
  1745. return p ? Ext.applyIf({
  1746. c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
  1747. }, p) : {
  1748. g: 0,
  1749. c: null,
  1750. s: Ext.String.escapeRegex(character)
  1751. };
  1752. },
  1753. parseFunctions: {
  1754. "MS": function(input, strict) {
  1755. var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/'),
  1756. r = (input || '').match(re);
  1757. return r? new Date(((r[1] || '') + r[2]) * 1) : null;
  1758. }
  1759. },
  1760. parseRegexes: [],
  1761. formatFunctions: {
  1762. "MS": function() {
  1763. return '\\/Date(' + this.getTime() + ')\\/';
  1764. }
  1765. },
  1766. y2kYear : 50,
  1767. MILLI : "ms",
  1768. SECOND : "s",
  1769. MINUTE : "mi",
  1770. HOUR : "h",
  1771. DAY : "d",
  1772. MONTH : "mo",
  1773. YEAR : "y",
  1774. defaults: {},
  1775. dayNames : [
  1776. "Sunday",
  1777. "Monday",
  1778. "Tuesday",
  1779. "Wednesday",
  1780. "Thursday",
  1781. "Friday",
  1782. "Saturday"
  1783. ],
  1784. monthNames : [
  1785. "January",
  1786. "February",
  1787. "March",
  1788. "April",
  1789. "May",
  1790. "June",
  1791. "July",
  1792. "August",
  1793. "September",
  1794. "October",
  1795. "November",
  1796. "December"
  1797. ],
  1798. monthNumbers : {
  1799. January: 0,
  1800. Jan: 0,
  1801. February: 1,
  1802. Feb: 1,
  1803. March: 2,
  1804. Mar: 2,
  1805. April: 3,
  1806. Apr: 3,
  1807. May: 4,
  1808. June: 5,
  1809. Jun: 5,
  1810. July: 6,
  1811. Jul: 6,
  1812. August: 7,
  1813. Aug: 7,
  1814. September: 8,
  1815. Sep: 8,
  1816. October: 9,
  1817. Oct: 9,
  1818. November: 10,
  1819. Nov: 10,
  1820. December: 11,
  1821. Dec: 11
  1822. },
  1823. defaultFormat : "m/d/Y",
  1824. getShortMonthName : function(month) {
  1825. return Ext.Date.monthNames[month].substring(0, 3);
  1826. },
  1827. getShortDayName : function(day) {
  1828. return Ext.Date.dayNames[day].substring(0, 3);
  1829. },
  1830. getMonthNumber : function(name) {
  1831. return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
  1832. },
  1833. formatContainsHourInfo : (function(){
  1834. var stripEscapeRe = /(\\.)/g,
  1835. hourInfoRe = /([gGhHisucUOPZ]|MS)/;
  1836. return function(format){
  1837. return hourInfoRe.test(format.replace(stripEscapeRe, ''));
  1838. };
  1839. }()),
  1840. formatContainsDateInfo : (function(){
  1841. var stripEscapeRe = /(\\.)/g,
  1842. dateInfoRe = /([djzmnYycU]|MS)/;
  1843. return function(format){
  1844. return dateInfoRe.test(format.replace(stripEscapeRe, ''));
  1845. };
  1846. }()),
  1847. unescapeFormat: (function() {
  1848. var slashRe = /\\/gi;
  1849. return function(format) {
  1850. return format.replace(slashRe, '');
  1851. }
  1852. }()),
  1853. formatCodes : {
  1854. d: "Ext.String.leftPad(this.getDate(), 2, '0')",
  1855. D: "Ext.Date.getShortDayName(this.getDay())",
  1856. j: "this.getDate()",
  1857. l: "Ext.Date.dayNames[this.getDay()]",
  1858. N: "(this.getDay() ? this.getDay() : 7)",
  1859. S: "Ext.Date.getSuffix(this)",
  1860. w: "this.getDay()",
  1861. z: "Ext.Date.getDayOfYear(this)",
  1862. W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
  1863. F: "Ext.Date.monthNames[this.getMonth()]",
  1864. m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
  1865. M: "Ext.Date.getShortMonthName(this.getMonth())",
  1866. n: "(this.getMonth() + 1)",
  1867. t: "Ext.Date.getDaysInMonth(this)",
  1868. L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
  1869. o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
  1870. Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
  1871. y: "('' + this.getFullYear()).substring(2, 4)",
  1872. a: "(this.getHours() < 12 ? 'am' : 'pm')",
  1873. A: "(this.getHours() < 12 ? 'AM' : 'PM')",
  1874. g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
  1875. G: "this.getHours()",
  1876. h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
  1877. H: "Ext.String.leftPad(this.getHours(), 2, '0')",
  1878. i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
  1879. s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
  1880. u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
  1881. O: "Ext.Date.getGMTOffset(this)",
  1882. P: "Ext.Date.getGMTOffset(this, true)",
  1883. T: "Ext.Date.getTimezone(this)",
  1884. Z: "(this.getTimezoneOffset() * -60)",
  1885. c: function() {
  1886. var c, code, i, l, e;
  1887. for (c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
  1888. e = c.charAt(i);
  1889. code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e));
  1890. }
  1891. return code.join(" + ");
  1892. },
  1893. U: "Math.round(this.getTime() / 1000)"
  1894. },
  1895. isValid : function(y, m, d, h, i, s, ms) {
  1896. h = h || 0;
  1897. i = i || 0;
  1898. s = s || 0;
  1899. ms = ms || 0;
  1900. var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
  1901. return y == dt.getFullYear() &&
  1902. m == dt.getMonth() + 1 &&
  1903. d == dt.getDate() &&
  1904. h == dt.getHours() &&
  1905. i == dt.getMinutes() &&
  1906. s == dt.getSeconds() &&
  1907. ms == dt.getMilliseconds();
  1908. },
  1909. parse : function(input, format, strict) {
  1910. var p = utilDate.parseFunctions;
  1911. if (p[format] == null) {
  1912. utilDate.createParser(format);
  1913. }
  1914. return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
  1915. },
  1916. parseDate: function(input, format, strict){
  1917. return utilDate.parse(input, format, strict);
  1918. },
  1919. getFormatCode : function(character) {
  1920. var f = utilDate.formatCodes[character];
  1921. if (f) {
  1922. f = typeof f == 'function'? f() : f;
  1923. utilDate.formatCodes[character] = f;
  1924. }
  1925. return f || ("'" + Ext.String.escape(character) + "'");
  1926. },
  1927. createFormat : function(format) {
  1928. var code = [],
  1929. special = false,
  1930. ch = '',
  1931. i;
  1932. for (i = 0; i < format.length; ++i) {
  1933. ch = format.charAt(i);
  1934. if (!special && ch == "\\") {
  1935. special = true;
  1936. } else if (special) {
  1937. special = false;
  1938. code.push("'" + Ext.String.escape(ch) + "'");
  1939. } else {
  1940. code.push(utilDate.getFormatCode(ch));
  1941. }
  1942. }
  1943. utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
  1944. },
  1945. createParser : (function() {
  1946. var code = [
  1947. "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
  1948. "def = Ext.Date.defaults,",
  1949. "results = String(input).match(Ext.Date.parseRegexes[{0}]);",
  1950. "if(results){",
  1951. "{1}",
  1952. "if(u != null){",
  1953. "v = new Date(u * 1000);",
  1954. "}else{",
  1955. "dt = Ext.Date.clearTime(new Date);",
  1956. "y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
  1957. "m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
  1958. "d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
  1959. "h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
  1960. "i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
  1961. "s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
  1962. "ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
  1963. "if(z >= 0 && y >= 0){",
  1964. "v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
  1965. "v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
  1966. "}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){",
  1967. "v = null;",
  1968. "}else{",
  1969. "v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
  1970. "}",
  1971. "}",
  1972. "}",
  1973. "if(v){",
  1974. "if(zz != null){",
  1975. "v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
  1976. "}else if(o){",
  1977. "v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
  1978. "}",
  1979. "}",
  1980. "return v;"
  1981. ].join('\n');
  1982. return function(format) {
  1983. var regexNum = utilDate.parseRegexes.length,
  1984. currentGroup = 1,
  1985. calc = [],
  1986. regex = [],
  1987. special = false,
  1988. ch = "",
  1989. i = 0,
  1990. len = format.length,
  1991. atEnd = [],
  1992. obj;
  1993. for (; i < len; ++i) {
  1994. ch = format.charAt(i);
  1995. if (!special && ch == "\\") {
  1996. special = true;
  1997. } else if (special) {
  1998. special = false;
  1999. regex.push(Ext.String.escape(ch));
  2000. } else {
  2001. obj = utilDate.formatCodeToRegex(ch, currentGroup);
  2002. currentGroup += obj.g;
  2003. regex.push(obj.s);
  2004. if (obj.g && obj.c) {
  2005. if (obj.calcAtEnd) {
  2006. atEnd.push(obj.c);
  2007. } else {
  2008. calc.push(obj.c);
  2009. }
  2010. }
  2011. }
  2012. }
  2013. calc = calc.concat(atEnd);
  2014. utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
  2015. utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
  2016. };
  2017. }()),
  2018. parseCodes : {
  2019. d: {
  2020. g:1,
  2021. c:"d = parseInt(results[{0}], 10);\n",
  2022. s:"(3[0-1]|[1-2][0-9]|0[1-9])"
  2023. },
  2024. j: {
  2025. g:1,
  2026. c:"d = parseInt(results[{0}], 10);\n",
  2027. s:"(3[0-1]|[1-2][0-9]|[1-9])"
  2028. },
  2029. D: function() {
  2030. for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i);
  2031. return {
  2032. g:0,
  2033. c:null,
  2034. s:"(?:" + a.join("|") +")"
  2035. };
  2036. },
  2037. l: function() {
  2038. return {
  2039. g:0,
  2040. c:null,
  2041. s:"(?:" + utilDate.dayNames.join("|") + ")"
  2042. };
  2043. },
  2044. N: {
  2045. g:0,
  2046. c:null,
  2047. s:"[1-7]"
  2048. },
  2049. S: {
  2050. g:0,
  2051. c:null,
  2052. s:"(?:st|nd|rd|th)"
  2053. },
  2054. w: {
  2055. g:0,
  2056. c:null,
  2057. s:"[0-6]"
  2058. },
  2059. z: {
  2060. g:1,
  2061. c:"z = parseInt(results[{0}], 10);\n",
  2062. s:"(\\d{1,3})"
  2063. },
  2064. W: {
  2065. g:0,
  2066. c:null,
  2067. s:"(?:\\d{2})"
  2068. },
  2069. F: function() {
  2070. return {
  2071. g:1,
  2072. c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n",
  2073. s:"(" + utilDate.monthNames.join("|") + ")"
  2074. };
  2075. },
  2076. M: function() {
  2077. for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i);
  2078. return Ext.applyIf({
  2079. s:"(" + a.join("|") + ")"
  2080. }, utilDate.formatCodeToRegex("F"));
  2081. },
  2082. m: {
  2083. g:1,
  2084. c:"m = parseInt(results[{0}], 10) - 1;\n",
  2085. s:"(1[0-2]|0[1-9])"
  2086. },
  2087. n: {
  2088. g:1,
  2089. c:"m = parseInt(results[{0}], 10) - 1;\n",
  2090. s:"(1[0-2]|[1-9])"
  2091. },
  2092. t: {
  2093. g:0,
  2094. c:null,
  2095. s:"(?:\\d{2})"
  2096. },
  2097. L: {
  2098. g:0,
  2099. c:null,
  2100. s:"(?:1|0)"
  2101. },
  2102. o: function() {
  2103. return utilDate.formatCodeToRegex("Y");
  2104. },
  2105. Y: {
  2106. g:1,
  2107. c:"y = parseInt(results[{0}], 10);\n",
  2108. s:"(\\d{4})"
  2109. },
  2110. y: {
  2111. g:1,
  2112. c:"var ty = parseInt(results[{0}], 10);\n"
  2113. + "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
  2114. s:"(\\d{1,2})"
  2115. },
  2116. a: {
  2117. g:1,
  2118. c:"if (/(am)/i.test(results[{0}])) {\n"
  2119. + "if (!h || h == 12) { h = 0; }\n"
  2120. + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
  2121. s:"(am|pm|AM|PM)",
  2122. calcAtEnd: true
  2123. },
  2124. A: {
  2125. g:1,
  2126. c:"if (/(am)/i.test(results[{0}])) {\n"
  2127. + "if (!h || h == 12) { h = 0; }\n"
  2128. + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
  2129. s:"(AM|PM|am|pm)",
  2130. calcAtEnd: true
  2131. },
  2132. g: {
  2133. g:1,
  2134. c:"h = parseInt(results[{0}], 10);\n",
  2135. s:"(1[0-2]|[0-9])"
  2136. },
  2137. G: {
  2138. g:1,
  2139. c:"h = parseInt(results[{0}], 10);\n",
  2140. s:"(2[0-3]|1[0-9]|[0-9])"
  2141. },
  2142. h: {
  2143. g:1,
  2144. c:"h = parseInt(results[{0}], 10);\n",
  2145. s:"(1[0-2]|0[1-9])"
  2146. },
  2147. H: {
  2148. g:1,
  2149. c:"h = parseInt(results[{0}], 10);\n",
  2150. s:"(2[0-3]|[0-1][0-9])"
  2151. },
  2152. i: {
  2153. g:1,
  2154. c:"i = parseInt(results[{0}], 10);\n",
  2155. s:"([0-5][0-9])"
  2156. },
  2157. s: {
  2158. g:1,
  2159. c:"s = parseInt(results[{0}], 10);\n",
  2160. s:"([0-5][0-9])"
  2161. },
  2162. u: {
  2163. g:1,
  2164. c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
  2165. s:"(\\d+)"
  2166. },
  2167. O: {
  2168. g:1,
  2169. c:[
  2170. "o = results[{0}];",
  2171. "var sn = o.substring(0,1),",
  2172. "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),",
  2173. "mn = o.substring(3,5) % 60;",
  2174. "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
  2175. ].join("\n"),
  2176. s: "([+-]\\d{4})"
  2177. },
  2178. P: {
  2179. g:1,
  2180. c:[
  2181. "o = results[{0}];",
  2182. "var sn = o.substring(0,1),",
  2183. "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),",
  2184. "mn = o.substring(4,6) % 60;",
  2185. "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + Ext.String.leftPad(hr, 2, '0') + Ext.String.leftPad(mn, 2, '0')) : null;\n"
  2186. ].join("\n"),
  2187. s: "([+-]\\d{2}:\\d{2})"
  2188. },
  2189. T: {
  2190. g:0,
  2191. c:null,
  2192. s:"[A-Z]{1,4}"
  2193. },
  2194. Z: {
  2195. g:1,
  2196. c:"zz = results[{0}] * 1;\n"
  2197. + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
  2198. s:"([+-]?\\d{1,5})"
  2199. },
  2200. c: function() {
  2201. var calc = [],
  2202. arr = [
  2203. utilDate.formatCodeToRegex("Y", 1),
  2204. utilDate.formatCodeToRegex("m", 2),
  2205. utilDate.formatCodeToRegex("d", 3),
  2206. utilDate.formatCodeToRegex("H", 4),
  2207. utilDate.formatCodeToRegex("i", 5),
  2208. utilDate.formatCodeToRegex("s", 6),
  2209. {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},
  2210. {c:[
  2211. "if(results[8]) {",
  2212. "if(results[8] == 'Z'){",
  2213. "zz = 0;",
  2214. "}else if (results[8].indexOf(':') > -1){",
  2215. utilDate.formatCodeToRegex("P", 8).c,
  2216. "}else{",
  2217. utilDate.formatCodeToRegex("O", 8).c,
  2218. "}",
  2219. "}"
  2220. ].join('\n')}
  2221. ],
  2222. i,
  2223. l;
  2224. for (i = 0, l = arr.length; i < l; ++i) {
  2225. calc.push(arr[i].c);
  2226. }
  2227. return {
  2228. g:1,
  2229. c:calc.join(""),
  2230. s:[
  2231. arr[0].s,
  2232. "(?:", "-", arr[1].s,
  2233. "(?:", "-", arr[2].s,
  2234. "(?:",
  2235. "(?:T| )?",
  2236. arr[3].s, ":", arr[4].s,
  2237. "(?::", arr[5].s, ")?",
  2238. "(?:(?:\\.|,)(\\d+))?",
  2239. "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?",
  2240. ")?",
  2241. ")?",
  2242. ")?"
  2243. ].join("")
  2244. };
  2245. },
  2246. U: {
  2247. g:1,
  2248. c:"u = parseInt(results[{0}], 10);\n",
  2249. s:"(-?\\d+)"
  2250. }
  2251. },
  2252. dateFormat: function(date, format) {
  2253. return utilDate.format(date, format);
  2254. },
  2255. isEqual: function(date1, date2) {
  2256. if (date1 && date2) {
  2257. return (date1.getTime() === date2.getTime());
  2258. }
  2259. return !(date1 || date2);
  2260. },
  2261. format: function(date, format) {
  2262. var formatFunctions = utilDate.formatFunctions;
  2263. if (!Ext.isDate(date)) {
  2264. return '';
  2265. }
  2266. if (formatFunctions[format] == null) {
  2267. utilDate.createFormat(format);
  2268. }
  2269. return formatFunctions[format].call(date) + '';
  2270. },
  2271. getTimezone : function(date) {
  2272. return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
  2273. },
  2274. getGMTOffset : function(date, colon) {
  2275. var offset = date.getTimezoneOffset();
  2276. return (offset > 0 ? "-" : "+")
  2277. + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
  2278. + (colon ? ":" : "")
  2279. + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
  2280. },
  2281. getDayOfYear: function(date) {
  2282. var num = 0,
  2283. d = Ext.Date.clone(date),
  2284. m = date.getMonth(),
  2285. i;
  2286. for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
  2287. num += utilDate.getDaysInMonth(d);
  2288. }
  2289. return num + date.getDate() - 1;
  2290. },
  2291. getWeekOfYear : (function() {
  2292. var ms1d = 864e5,
  2293. ms7d = 7 * ms1d;
  2294. return function(date) {
  2295. var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d,
  2296. AWN = Math.floor(DC3 / 7),
  2297. Wyr = new Date(AWN * ms7d).getUTCFullYear();
  2298. return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
  2299. };
  2300. }()),
  2301. isLeapYear : function(date) {
  2302. var year = date.getFullYear();
  2303. return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
  2304. },
  2305. getFirstDayOfMonth : function(date) {
  2306. var day = (date.getDay() - (date.getDate() - 1)) % 7;
  2307. return (day < 0) ? (day + 7) : day;
  2308. },
  2309. getLastDayOfMonth : function(date) {
  2310. return utilDate.getLastDateOfMonth(date).getDay();
  2311. },
  2312. getFirstDateOfMonth : function(date) {
  2313. return new Date(date.getFullYear(), date.getMonth(), 1);
  2314. },
  2315. getLastDateOfMonth : function(date) {
  2316. return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
  2317. },
  2318. getDaysInMonth: (function() {
  2319. var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  2320. return function(date) {
  2321. var m = date.getMonth();
  2322. return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
  2323. };
  2324. }()),
  2325. getSuffix : function(date) {
  2326. switch (date.getDate()) {
  2327. case 1:
  2328. case 21:
  2329. case 31:
  2330. return "st";
  2331. case 2:
  2332. case 22:
  2333. return "nd";
  2334. case 3:
  2335. case 23:
  2336. return "rd";
  2337. default:
  2338. return "th";
  2339. }
  2340. },
  2341. clone : function(date) {
  2342. return new Date(date.getTime());
  2343. },
  2344. isDST : function(date) {
  2345. return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
  2346. },
  2347. clearTime : function(date, clone) {
  2348. if (clone) {
  2349. return Ext.Date.clearTime(Ext.Date.clone(date));
  2350. }
  2351. var d = date.getDate(),
  2352. hr,
  2353. c;
  2354. date.setHours(0);
  2355. date.setMinutes(0);
  2356. date.setSeconds(0);
  2357. date.setMilliseconds(0);
  2358. if (date.getDate() != d) {
  2359. for (hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
  2360. date.setDate(d);
  2361. date.setHours(c.getHours());
  2362. }
  2363. return date;
  2364. },
  2365. add : function(date, interval, value) {
  2366. var d = Ext.Date.clone(date),
  2367. Date = Ext.Date,
  2368. day;
  2369. if (!interval || value === 0) {
  2370. return d;
  2371. }
  2372. switch(interval.toLowerCase()) {
  2373. case Ext.Date.MILLI:
  2374. d.setMilliseconds(d.getMilliseconds() + value);
  2375. break;
  2376. case Ext.Date.SECOND:
  2377. d.setSeconds(d.getSeconds() + value);
  2378. break;
  2379. case Ext.Date.MINUTE:
  2380. d.setMinutes(d.getMinutes() + value);
  2381. break;
  2382. case Ext.Date.HOUR:
  2383. d.setHours(d.getHours() + value);
  2384. break;
  2385. case Ext.Date.DAY:
  2386. d.setDate(d.getDate() + value);
  2387. break;
  2388. case Ext.Date.MONTH:
  2389. day = date.getDate();
  2390. if (day > 28) {
  2391. day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.MONTH, value)).getDate());
  2392. }
  2393. d.setDate(day);
  2394. d.setMonth(date.getMonth() + value);
  2395. break;
  2396. case Ext.Date.YEAR:
  2397. day = date.getDate();
  2398. if (day > 28) {
  2399. day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.YEAR, value)).getDate());
  2400. }
  2401. d.setDate(day);
  2402. d.setFullYear(date.getFullYear() + value);
  2403. break;
  2404. }
  2405. return d;
  2406. },
  2407. between : function(date, start, end) {
  2408. var t = date.getTime();
  2409. return start.getTime() <= t && t <= end.getTime();
  2410. },
  2411. compat: function() {
  2412. var nativeDate = window.Date,
  2413. p, u,
  2414. statics = ['useStrict', 'formatCodeToRegex', 'parseFunctions', 'parseRegexes', 'formatFunctions', 'y2kYear', 'MILLI', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'MONTH', 'YEAR', 'defaults', 'dayNames', 'monthNames', 'monthNumbers', 'getShortMonthName', 'getShortDayName', 'getMonthNumber', 'formatCodes', 'isValid', 'parseDate', 'getFormatCode', 'createFormat', 'createParser', 'parseCodes'],
  2415. proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'],
  2416. sLen = statics.length,
  2417. pLen = proto.length,
  2418. stat, prot, s;
  2419. for (s = 0; s < sLen; s++) {
  2420. stat = statics[s];
  2421. nativeDate[stat] = utilDate[stat];
  2422. }
  2423. for (p = 0; p < pLen; p++) {
  2424. prot = proto[p];
  2425. nativeDate.prototype[prot] = function() {
  2426. var args = Array.prototype.slice.call(arguments);
  2427. args.unshift(this);
  2428. return utilDate[prot].apply(utilDate, args);
  2429. };
  2430. }
  2431. }
  2432. };
  2433. var utilDate = Ext.Date;
  2434. }());
  2435. //@tag foundation,core
  2436. //@require ../lang/Date.js
  2437. (function(flexSetter) {
  2438. var noArgs = [],
  2439. Base = function(){};
  2440. Ext.apply(Base, {
  2441. $className: 'Ext.Base',
  2442. $isClass: true,
  2443. create: function() {
  2444. return Ext.create.apply(Ext, [this].concat(Array.prototype.slice.call(arguments, 0)));
  2445. },
  2446. extend: function(parent) {
  2447. var parentPrototype = parent.prototype,
  2448. basePrototype, prototype, i, ln, name, statics;
  2449. prototype = this.prototype = Ext.Object.chain(parentPrototype);
  2450. prototype.self = this;
  2451. this.superclass = prototype.superclass = parentPrototype;
  2452. if (!parent.$isClass) {
  2453. basePrototype = Ext.Base.prototype;
  2454. for (i in basePrototype) {
  2455. if (i in prototype) {
  2456. prototype[i] = basePrototype[i];
  2457. }
  2458. }
  2459. }
  2460. statics = parentPrototype.$inheritableStatics;
  2461. if (statics) {
  2462. for (i = 0,ln = statics.length; i < ln; i++) {
  2463. name = statics[i];
  2464. if (!this.hasOwnProperty(name)) {
  2465. this[name] = parent[name];
  2466. }
  2467. }
  2468. }
  2469. if (parent.$onExtended) {
  2470. this.$onExtended = parent.$onExtended.slice();
  2471. }
  2472. prototype.config = new prototype.configClass();
  2473. prototype.initConfigList = prototype.initConfigList.slice();
  2474. prototype.initConfigMap = Ext.clone(prototype.initConfigMap);
  2475. prototype.configMap = Ext.Object.chain(prototype.configMap);
  2476. },
  2477. $onExtended: [],
  2478. triggerExtended: function() {
  2479. var callbacks = this.$onExtended,
  2480. ln = callbacks.length,
  2481. i, callback;
  2482. if (ln > 0) {
  2483. for (i = 0; i < ln; i++) {
  2484. callback = callbacks[i];
  2485. callback.fn.apply(callback.scope || this, arguments);
  2486. }
  2487. }
  2488. },
  2489. onExtended: function(fn, scope) {
  2490. this.$onExtended.push({
  2491. fn: fn,
  2492. scope: scope
  2493. });
  2494. return this;
  2495. },
  2496. addConfig: function(config, fullMerge) {
  2497. var prototype = this.prototype,
  2498. configNameCache = Ext.Class.configNameCache,
  2499. hasConfig = prototype.configMap,
  2500. initConfigList = prototype.initConfigList,
  2501. initConfigMap = prototype.initConfigMap,
  2502. defaultConfig = prototype.config,
  2503. initializedName, name, value;
  2504. for (name in config) {
  2505. if (config.hasOwnProperty(name)) {
  2506. if (!hasConfig[name]) {
  2507. hasConfig[name] = true;
  2508. }
  2509. value = config[name];
  2510. initializedName = configNameCache[name].initialized;
  2511. if (!initConfigMap[name] && value !== null && !prototype[initializedName]) {
  2512. initConfigMap[name] = true;
  2513. initConfigList.push(name);
  2514. }
  2515. }
  2516. }
  2517. if (fullMerge) {
  2518. Ext.merge(defaultConfig, config);
  2519. }
  2520. else {
  2521. Ext.mergeIf(defaultConfig, config);
  2522. }
  2523. prototype.configClass = Ext.Object.classify(defaultConfig);
  2524. },
  2525. addStatics: function(members) {
  2526. var member, name;
  2527. for (name in members) {
  2528. if (members.hasOwnProperty(name)) {
  2529. member = members[name];
  2530. if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn && member !== Ext.identityFn) {
  2531. member.$owner = this;
  2532. member.$name = name;
  2533. }
  2534. this[name] = member;
  2535. }
  2536. }
  2537. return this;
  2538. },
  2539. addInheritableStatics: function(members) {
  2540. var inheritableStatics,
  2541. hasInheritableStatics,
  2542. prototype = this.prototype,
  2543. name, member;
  2544. inheritableStatics = prototype.$inheritableStatics;
  2545. hasInheritableStatics = prototype.$hasInheritableStatics;
  2546. if (!inheritableStatics) {
  2547. inheritableStatics = prototype.$inheritableStatics = [];
  2548. hasInheritableStatics = prototype.$hasInheritableStatics = {};
  2549. }
  2550. for (name in members) {
  2551. if (members.hasOwnProperty(name)) {
  2552. member = members[name];
  2553. this[name] = member;
  2554. if (!hasInheritableStatics[name]) {
  2555. hasInheritableStatics[name] = true;
  2556. inheritableStatics.push(name);
  2557. }
  2558. }
  2559. }
  2560. return this;
  2561. },
  2562. addMembers: function(members) {
  2563. var prototype = this.prototype,
  2564. enumerables = Ext.enumerables,
  2565. names = [],
  2566. i, ln, name, member;
  2567. for (name in members) {
  2568. names.push(name);
  2569. }
  2570. if (enumerables) {
  2571. names.push.apply(names, enumerables);
  2572. }
  2573. for (i = 0,ln = names.length; i < ln; i++) {
  2574. name = names[i];
  2575. if (members.hasOwnProperty(name)) {
  2576. member = members[name];
  2577. if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
  2578. member.$owner = this;
  2579. member.$name = name;
  2580. }
  2581. prototype[name] = member;
  2582. }
  2583. }
  2584. return this;
  2585. },
  2586. addMember: function(name, member) {
  2587. if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
  2588. member.$owner = this;
  2589. member.$name = name;
  2590. }
  2591. this.prototype[name] = member;
  2592. return this;
  2593. },
  2594. implement: function() {
  2595. this.addMembers.apply(this, arguments);
  2596. },
  2597. borrow: function(fromClass, members) {
  2598. var prototype = this.prototype,
  2599. fromPrototype = fromClass.prototype,
  2600. i, ln, name, fn, toBorrow;
  2601. members = Ext.Array.from(members);
  2602. for (i = 0,ln = members.length; i < ln; i++) {
  2603. name = members[i];
  2604. toBorrow = fromPrototype[name];
  2605. if (typeof toBorrow == 'function') {
  2606. fn = Ext.Function.clone(toBorrow);
  2607. fn.$owner = this;
  2608. fn.$name = name;
  2609. prototype[name] = fn;
  2610. }
  2611. else {
  2612. prototype[name] = toBorrow;
  2613. }
  2614. }
  2615. return this;
  2616. },
  2617. override: function(members) {
  2618. var me = this,
  2619. enumerables = Ext.enumerables,
  2620. target = me.prototype,
  2621. cloneFunction = Ext.Function.clone,
  2622. name, index, member, statics, names, previous;
  2623. if (arguments.length === 2) {
  2624. name = members;
  2625. members = {};
  2626. members[name] = arguments[1];
  2627. enumerables = null;
  2628. }
  2629. do {
  2630. names = [];
  2631. statics = null;
  2632. for (name in members) {
  2633. if (name == 'statics') {
  2634. statics = members[name];
  2635. } else if (name == 'config') {
  2636. me.addConfig(members[name], true);
  2637. } else {
  2638. names.push(name);
  2639. }
  2640. }
  2641. if (enumerables) {
  2642. names.push.apply(names, enumerables);
  2643. }
  2644. for (index = names.length; index--; ) {
  2645. name = names[index];
  2646. if (members.hasOwnProperty(name)) {
  2647. member = members[name];
  2648. if (typeof member == 'function' && !member.$className && member !== Ext.emptyFn) {
  2649. if (typeof member.$owner != 'undefined') {
  2650. member = cloneFunction(member);
  2651. }
  2652. member.$owner = me;
  2653. member.$name = name;
  2654. previous = target[name];
  2655. if (previous) {
  2656. member.$previous = previous;
  2657. }
  2658. }
  2659. target[name] = member;
  2660. }
  2661. }
  2662. target = me;
  2663. members = statics;
  2664. } while (members);
  2665. return this;
  2666. },
  2667. callParent: function(args) {
  2668. var method;
  2669. return (method = this.callParent.caller) && (method.$previous ||
  2670. ((method = method.$owner ? method : method.caller) &&
  2671. method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
  2672. },
  2673. callSuper: function(args) {
  2674. var method;
  2675. return (method = this.callSuper.caller) &&
  2676. ((method = method.$owner ? method : method.caller) &&
  2677. method.$owner.superclass.self[method.$name]).apply(this, args || noArgs);
  2678. },
  2679. mixin: function(name, mixinClass) {
  2680. var mixin = mixinClass.prototype,
  2681. prototype = this.prototype,
  2682. key;
  2683. if (typeof mixin.onClassMixedIn != 'undefined') {
  2684. mixin.onClassMixedIn.call(mixinClass, this);
  2685. }
  2686. if (!prototype.hasOwnProperty('mixins')) {
  2687. if ('mixins' in prototype) {
  2688. prototype.mixins = Ext.Object.chain(prototype.mixins);
  2689. }
  2690. else {
  2691. prototype.mixins = {};
  2692. }
  2693. }
  2694. for (key in mixin) {
  2695. if (key === 'mixins') {
  2696. Ext.merge(prototype.mixins, mixin[key]);
  2697. }
  2698. else if (typeof prototype[key] == 'undefined' && key != 'mixinId' && key != 'config') {
  2699. prototype[key] = mixin[key];
  2700. }
  2701. }
  2702. if ('config' in mixin) {
  2703. this.addConfig(mixin.config, false);
  2704. }
  2705. prototype.mixins[name] = mixin;
  2706. },
  2707. getName: function() {
  2708. return Ext.getClassName(this);
  2709. },
  2710. createAlias: flexSetter(function(alias, origin) {
  2711. this.override(alias, function() {
  2712. return this[origin].apply(this, arguments);
  2713. });
  2714. }),
  2715. addXtype: function(xtype) {
  2716. var prototype = this.prototype,
  2717. xtypesMap = prototype.xtypesMap,
  2718. xtypes = prototype.xtypes,
  2719. xtypesChain = prototype.xtypesChain;
  2720. if (!prototype.hasOwnProperty('xtypesMap')) {
  2721. xtypesMap = prototype.xtypesMap = Ext.merge({}, prototype.xtypesMap || {});
  2722. xtypes = prototype.xtypes = prototype.xtypes ? [].concat(prototype.xtypes) : [];
  2723. xtypesChain = prototype.xtypesChain = prototype.xtypesChain ? [].concat(prototype.xtypesChain) : [];
  2724. prototype.xtype = xtype;
  2725. }
  2726. if (!xtypesMap[xtype]) {
  2727. xtypesMap[xtype] = true;
  2728. xtypes.push(xtype);
  2729. xtypesChain.push(xtype);
  2730. Ext.ClassManager.setAlias(this, 'widget.' + xtype);
  2731. }
  2732. return this;
  2733. }
  2734. });
  2735. Base.implement({
  2736. isInstance: true,
  2737. $className: 'Ext.Base',
  2738. configClass: Ext.emptyFn,
  2739. initConfigList: [],
  2740. configMap: {},
  2741. initConfigMap: {},
  2742. statics: function() {
  2743. var method = this.statics.caller,
  2744. self = this.self;
  2745. if (!method) {
  2746. return self;
  2747. }
  2748. return method.$owner;
  2749. },
  2750. callParent: function(args) {
  2751. var method,
  2752. superMethod = (method = this.callParent.caller) && (method.$previous ||
  2753. ((method = method.$owner ? method : method.caller) &&
  2754. method.$owner.superclass[method.$name]));
  2755. return superMethod.apply(this, args || noArgs);
  2756. },
  2757. callSuper: function(args) {
  2758. var method,
  2759. superMethod = (method = this.callSuper.caller) &&
  2760. ((method = method.$owner ? method : method.caller) &&
  2761. method.$owner.superclass[method.$name]);
  2762. return superMethod.apply(this, args || noArgs);
  2763. },
  2764. self: Base,
  2765. constructor: function() {
  2766. return this;
  2767. },
  2768. initConfig: function(config) {
  2769. var instanceConfig = config,
  2770. configNameCache = Ext.Class.configNameCache,
  2771. defaultConfig = new this.configClass(),
  2772. defaultConfigList = this.initConfigList,
  2773. hasConfig = this.configMap,
  2774. nameMap, i, ln, name, initializedName;
  2775. this.initConfig = Ext.emptyFn;
  2776. this.initialConfig = instanceConfig || {};
  2777. this.config = config = (instanceConfig) ? Ext.merge(defaultConfig, config) : defaultConfig;
  2778. if (instanceConfig) {
  2779. defaultConfigList = defaultConfigList.slice();
  2780. for (name in instanceConfig) {
  2781. if (hasConfig[name]) {
  2782. if (instanceConfig[name] !== null) {
  2783. defaultConfigList.push(name);
  2784. this[configNameCache[name].initialized] = false;
  2785. }
  2786. }
  2787. }
  2788. }
  2789. for (i = 0,ln = defaultConfigList.length; i < ln; i++) {
  2790. name = defaultConfigList[i];
  2791. nameMap = configNameCache[name];
  2792. initializedName = nameMap.initialized;
  2793. if (!this[initializedName]) {
  2794. this[initializedName] = true;
  2795. this[nameMap.set].call(this, config[name]);
  2796. }
  2797. }
  2798. return this;
  2799. },
  2800. hasConfig: function(name) {
  2801. return Boolean(this.configMap[name]);
  2802. },
  2803. setConfig: function(config, applyIfNotSet) {
  2804. if (!config) {
  2805. return this;
  2806. }
  2807. var configNameCache = Ext.Class.configNameCache,
  2808. currentConfig = this.config,
  2809. hasConfig = this.configMap,
  2810. initialConfig = this.initialConfig,
  2811. name, value;
  2812. applyIfNotSet = Boolean(applyIfNotSet);
  2813. for (name in config) {
  2814. if (applyIfNotSet && initialConfig.hasOwnProperty(name)) {
  2815. continue;
  2816. }
  2817. value = config[name];
  2818. currentConfig[name] = value;
  2819. if (hasConfig[name]) {
  2820. this[configNameCache[name].set](value);
  2821. }
  2822. }
  2823. return this;
  2824. },
  2825. getConfig: function(name) {
  2826. var configNameCache = Ext.Class.configNameCache;
  2827. return this[configNameCache[name].get]();
  2828. },
  2829. getInitialConfig: function(name) {
  2830. var config = this.config;
  2831. if (!name) {
  2832. return config;
  2833. }
  2834. else {
  2835. return config[name];
  2836. }
  2837. },
  2838. onConfigUpdate: function(names, callback, scope) {
  2839. var self = this.self,
  2840. i, ln, name,
  2841. updaterName, updater, newUpdater;
  2842. names = Ext.Array.from(names);
  2843. scope = scope || this;
  2844. for (i = 0,ln = names.length; i < ln; i++) {
  2845. name = names[i];
  2846. updaterName = 'update' + Ext.String.capitalize(name);
  2847. updater = this[updaterName] || Ext.emptyFn;
  2848. newUpdater = function() {
  2849. updater.apply(this, arguments);
  2850. scope[callback].apply(scope, arguments);
  2851. };
  2852. newUpdater.$name = updaterName;
  2853. newUpdater.$owner = self;
  2854. this[updaterName] = newUpdater;
  2855. }
  2856. },
  2857. destroy: function() {
  2858. this.destroy = Ext.emptyFn;
  2859. }
  2860. });
  2861. Base.prototype.callOverridden = Base.prototype.callParent;
  2862. Ext.Base = Base;
  2863. }(Ext.Function.flexSetter));
  2864. //@tag foundation,core
  2865. //@require Base.js
  2866. (function() {
  2867. var ExtClass,
  2868. Base = Ext.Base,
  2869. baseStaticMembers = [],
  2870. baseStaticMember, baseStaticMemberLength;
  2871. for (baseStaticMember in Base) {
  2872. if (Base.hasOwnProperty(baseStaticMember)) {
  2873. baseStaticMembers.push(baseStaticMember);
  2874. }
  2875. }
  2876. baseStaticMemberLength = baseStaticMembers.length;
  2877. function makeCtor (className) {
  2878. function constructor () {
  2879. return this.constructor.apply(this, arguments) || null;
  2880. }
  2881. return constructor;
  2882. }
  2883. Ext.Class = ExtClass = function(Class, data, onCreated) {
  2884. if (typeof Class != 'function') {
  2885. onCreated = data;
  2886. data = Class;
  2887. Class = null;
  2888. }
  2889. if (!data) {
  2890. data = {};
  2891. }
  2892. Class = ExtClass.create(Class, data);
  2893. ExtClass.process(Class, data, onCreated);
  2894. return Class;
  2895. };
  2896. Ext.apply(ExtClass, {
  2897. onBeforeCreated: function(Class, data, hooks) {
  2898. Class.addMembers(data);
  2899. hooks.onCreated.call(Class, Class);
  2900. },
  2901. create: function(Class, data) {
  2902. var name, i;
  2903. if (!Class) {
  2904. Class = makeCtor(
  2905. );
  2906. }
  2907. for (i = 0; i < baseStaticMemberLength; i++) {
  2908. name = baseStaticMembers[i];
  2909. Class[name] = Base[name];
  2910. }
  2911. return Class;
  2912. },
  2913. process: function(Class, data, onCreated) {
  2914. var preprocessorStack = data.preprocessors || ExtClass.defaultPreprocessors,
  2915. registeredPreprocessors = this.preprocessors,
  2916. hooks = {
  2917. onBeforeCreated: this.onBeforeCreated
  2918. },
  2919. preprocessors = [],
  2920. preprocessor, preprocessorsProperties,
  2921. i, ln, j, subLn, preprocessorProperty, process;
  2922. delete data.preprocessors;
  2923. for (i = 0,ln = preprocessorStack.length; i < ln; i++) {
  2924. preprocessor = preprocessorStack[i];
  2925. if (typeof preprocessor == 'string') {
  2926. preprocessor = registeredPreprocessors[preprocessor];
  2927. preprocessorsProperties = preprocessor.properties;
  2928. if (preprocessorsProperties === true) {
  2929. preprocessors.push(preprocessor.fn);
  2930. }
  2931. else if (preprocessorsProperties) {
  2932. for (j = 0,subLn = preprocessorsProperties.length; j < subLn; j++) {
  2933. preprocessorProperty = preprocessorsProperties[j];
  2934. if (data.hasOwnProperty(preprocessorProperty)) {
  2935. preprocessors.push(preprocessor.fn);
  2936. break;
  2937. }
  2938. }
  2939. }
  2940. }
  2941. else {
  2942. preprocessors.push(preprocessor);
  2943. }
  2944. }
  2945. hooks.onCreated = onCreated ? onCreated : Ext.emptyFn;
  2946. hooks.preprocessors = preprocessors;
  2947. this.doProcess(Class, data, hooks);
  2948. },
  2949. doProcess: function(Class, data, hooks){
  2950. var me = this,
  2951. preprocessor = hooks.preprocessors.shift();
  2952. if (!preprocessor) {
  2953. hooks.onBeforeCreated.apply(me, arguments);
  2954. return;
  2955. }
  2956. if (preprocessor.call(me, Class, data, hooks, me.doProcess) !== false) {
  2957. me.doProcess(Class, data, hooks);
  2958. }
  2959. },
  2960. preprocessors: {},
  2961. registerPreprocessor: function(name, fn, properties, position, relativeTo) {
  2962. if (!position) {
  2963. position = 'last';
  2964. }
  2965. if (!properties) {
  2966. properties = [name];
  2967. }
  2968. this.preprocessors[name] = {
  2969. name: name,
  2970. properties: properties || false,
  2971. fn: fn
  2972. };
  2973. this.setDefaultPreprocessorPosition(name, position, relativeTo);
  2974. return this;
  2975. },
  2976. getPreprocessor: function(name) {
  2977. return this.preprocessors[name];
  2978. },
  2979. getPreprocessors: function() {
  2980. return this.preprocessors;
  2981. },
  2982. defaultPreprocessors: [],
  2983. getDefaultPreprocessors: function() {
  2984. return this.defaultPreprocessors;
  2985. },
  2986. setDefaultPreprocessors: function(preprocessors) {
  2987. this.defaultPreprocessors = Ext.Array.from(preprocessors);
  2988. return this;
  2989. },
  2990. setDefaultPreprocessorPosition: function(name, offset, relativeName) {
  2991. var defaultPreprocessors = this.defaultPreprocessors,
  2992. index;
  2993. if (typeof offset == 'string') {
  2994. if (offset === 'first') {
  2995. defaultPreprocessors.unshift(name);
  2996. return this;
  2997. }
  2998. else if (offset === 'last') {
  2999. defaultPreprocessors.push(name);
  3000. return this;
  3001. }
  3002. offset = (offset === 'after') ? 1 : -1;
  3003. }
  3004. index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
  3005. if (index !== -1) {
  3006. Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
  3007. }
  3008. return this;
  3009. },
  3010. configNameCache: {},
  3011. getConfigNameMap: function(name) {
  3012. var cache = this.configNameCache,
  3013. map = cache[name],
  3014. capitalizedName;
  3015. if (!map) {
  3016. capitalizedName = name.charAt(0).toUpperCase() + name.substr(1);
  3017. map = cache[name] = {
  3018. internal: name,
  3019. initialized: '_is' + capitalizedName + 'Initialized',
  3020. apply: 'apply' + capitalizedName,
  3021. update: 'update' + capitalizedName,
  3022. 'set': 'set' + capitalizedName,
  3023. 'get': 'get' + capitalizedName,
  3024. doSet : 'doSet' + capitalizedName,
  3025. changeEvent: name.toLowerCase() + 'change'
  3026. };
  3027. }
  3028. return map;
  3029. }
  3030. });
  3031. ExtClass.registerPreprocessor('extend', function(Class, data) {
  3032. var Base = Ext.Base,
  3033. basePrototype = Base.prototype,
  3034. extend = data.extend,
  3035. Parent, parentPrototype, i;
  3036. delete data.extend;
  3037. if (extend && extend !== Object) {
  3038. Parent = extend;
  3039. }
  3040. else {
  3041. Parent = Base;
  3042. }
  3043. parentPrototype = Parent.prototype;
  3044. if (!Parent.$isClass) {
  3045. for (i in basePrototype) {
  3046. if (!parentPrototype[i]) {
  3047. parentPrototype[i] = basePrototype[i];
  3048. }
  3049. }
  3050. }
  3051. Class.extend(Parent);
  3052. Class.triggerExtended.apply(Class, arguments);
  3053. if (data.onClassExtended) {
  3054. Class.onExtended(data.onClassExtended, Class);
  3055. delete data.onClassExtended;
  3056. }
  3057. }, true);
  3058. ExtClass.registerPreprocessor('statics', function(Class, data) {
  3059. Class.addStatics(data.statics);
  3060. delete data.statics;
  3061. });
  3062. ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
  3063. Class.addInheritableStatics(data.inheritableStatics);
  3064. delete data.inheritableStatics;
  3065. });
  3066. ExtClass.registerPreprocessor('config', function(Class, data) {
  3067. var config = data.config,
  3068. prototype = Class.prototype;
  3069. delete data.config;
  3070. Ext.Object.each(config, function(name, value) {
  3071. var nameMap = ExtClass.getConfigNameMap(name),
  3072. internalName = nameMap.internal,
  3073. initializedName = nameMap.initialized,
  3074. applyName = nameMap.apply,
  3075. updateName = nameMap.update,
  3076. setName = nameMap.set,
  3077. getName = nameMap.get,
  3078. hasOwnSetter = (setName in prototype) || data.hasOwnProperty(setName),
  3079. hasOwnApplier = (applyName in prototype) || data.hasOwnProperty(applyName),
  3080. hasOwnUpdater = (updateName in prototype) || data.hasOwnProperty(updateName),
  3081. optimizedGetter, customGetter;
  3082. if (value === null || (!hasOwnSetter && !hasOwnApplier && !hasOwnUpdater)) {
  3083. prototype[internalName] = value;
  3084. prototype[initializedName] = true;
  3085. }
  3086. else {
  3087. prototype[initializedName] = false;
  3088. }
  3089. if (!hasOwnSetter) {
  3090. data[setName] = function(value) {
  3091. var oldValue = this[internalName],
  3092. applier = this[applyName],
  3093. updater = this[updateName];
  3094. if (!this[initializedName]) {
  3095. this[initializedName] = true;
  3096. }
  3097. if (applier) {
  3098. value = applier.call(this, value, oldValue);
  3099. }
  3100. if (typeof value != 'undefined') {
  3101. this[internalName] = value;
  3102. if (updater && value !== oldValue) {
  3103. updater.call(this, value, oldValue);
  3104. }
  3105. }
  3106. return this;
  3107. };
  3108. }
  3109. if (!(getName in prototype) || data.hasOwnProperty(getName)) {
  3110. customGetter = data[getName] || false;
  3111. if (customGetter) {
  3112. optimizedGetter = function() {
  3113. return customGetter.apply(this, arguments);
  3114. };
  3115. }
  3116. else {
  3117. optimizedGetter = function() {
  3118. return this[internalName];
  3119. };
  3120. }
  3121. data[getName] = function() {
  3122. var currentGetter;
  3123. if (!this[initializedName]) {
  3124. this[initializedName] = true;
  3125. this[setName](this.config[name]);
  3126. }
  3127. currentGetter = this[getName];
  3128. if ('$previous' in currentGetter) {
  3129. currentGetter.$previous = optimizedGetter;
  3130. }
  3131. else {
  3132. this[getName] = optimizedGetter;
  3133. }
  3134. return optimizedGetter.apply(this, arguments);
  3135. };
  3136. }
  3137. });
  3138. Class.addConfig(config, true);
  3139. });
  3140. ExtClass.registerPreprocessor('mixins', function(Class, data, hooks) {
  3141. var mixins = data.mixins,
  3142. name, mixin, i, ln;
  3143. delete data.mixins;
  3144. Ext.Function.interceptBefore(hooks, 'onCreated', function() {
  3145. if (mixins instanceof Array) {
  3146. for (i = 0,ln = mixins.length; i < ln; i++) {
  3147. mixin = mixins[i];
  3148. name = mixin.prototype.mixinId || mixin.$className;
  3149. Class.mixin(name, mixin);
  3150. }
  3151. }
  3152. else {
  3153. for (var mixinName in mixins) {
  3154. if (mixins.hasOwnProperty(mixinName)) {
  3155. Class.mixin(mixinName, mixins[mixinName]);
  3156. }
  3157. }
  3158. }
  3159. });
  3160. });
  3161. Ext.extend = function(Class, Parent, members) {
  3162. if (arguments.length === 2 && Ext.isObject(Parent)) {
  3163. members = Parent;
  3164. Parent = Class;
  3165. Class = null;
  3166. }
  3167. var cls;
  3168. if (!Parent) {
  3169. throw new Error("[Ext.extend] Attempting to extend from a class which has not been loaded on the page.");
  3170. }
  3171. members.extend = Parent;
  3172. members.preprocessors = [
  3173. 'extend'
  3174. ,'statics'
  3175. ,'inheritableStatics'
  3176. ,'mixins'
  3177. ,'config'
  3178. ];
  3179. if (Class) {
  3180. cls = new ExtClass(Class, members);
  3181. cls.prototype.constructor = Class;
  3182. } else {
  3183. cls = new ExtClass(members);
  3184. }
  3185. cls.prototype.override = function(o) {
  3186. for (var m in o) {
  3187. if (o.hasOwnProperty(m)) {
  3188. this[m] = o[m];
  3189. }
  3190. }
  3191. };
  3192. return cls;
  3193. };
  3194. }());
  3195. //@tag foundation,core
  3196. //@require Class.js
  3197. (function(Class, alias, arraySlice, arrayFrom, global) {
  3198. function makeCtor () {
  3199. function constructor () {
  3200. return this.constructor.apply(this, arguments) || null;
  3201. }
  3202. return constructor;
  3203. }
  3204. var Manager = Ext.ClassManager = {
  3205. classes: {},
  3206. existCache: {},
  3207. namespaceRewrites: [{
  3208. from: 'Ext.',
  3209. to: Ext
  3210. }],
  3211. maps: {
  3212. alternateToName: {},
  3213. aliasToName: {},
  3214. nameToAliases: {},
  3215. nameToAlternates: {}
  3216. },
  3217. enableNamespaceParseCache: true,
  3218. namespaceParseCache: {},
  3219. instantiators: [],
  3220. isCreated: function(className) {
  3221. var existCache = this.existCache,
  3222. i, ln, part, root, parts;
  3223. if (this.classes[className] || existCache[className]) {
  3224. return true;
  3225. }
  3226. root = global;
  3227. parts = this.parseNamespace(className);
  3228. for (i = 0, ln = parts.length; i < ln; i++) {
  3229. part = parts[i];
  3230. if (typeof part != 'string') {
  3231. root = part;
  3232. } else {
  3233. if (!root || !root[part]) {
  3234. return false;
  3235. }
  3236. root = root[part];
  3237. }
  3238. }
  3239. existCache[className] = true;
  3240. this.triggerCreated(className);
  3241. return true;
  3242. },
  3243. createdListeners: [],
  3244. nameCreatedListeners: {},
  3245. triggerCreated: function(className) {
  3246. var listeners = this.createdListeners,
  3247. nameListeners = this.nameCreatedListeners,
  3248. alternateNames = this.maps.nameToAlternates[className],
  3249. names = [className],
  3250. i, ln, j, subLn, listener, name;
  3251. for (i = 0,ln = listeners.length; i < ln; i++) {
  3252. listener = listeners[i];
  3253. listener.fn.call(listener.scope, className);
  3254. }
  3255. if (alternateNames) {
  3256. names.push.apply(names, alternateNames);
  3257. }
  3258. for (i = 0,ln = names.length; i < ln; i++) {
  3259. name = names[i];
  3260. listeners = nameListeners[name];
  3261. if (listeners) {
  3262. for (j = 0,subLn = listeners.length; j < subLn; j++) {
  3263. listener = listeners[j];
  3264. listener.fn.call(listener.scope, name);
  3265. }
  3266. delete nameListeners[name];
  3267. }
  3268. }
  3269. },
  3270. onCreated: function(fn, scope, className) {
  3271. var listeners = this.createdListeners,
  3272. nameListeners = this.nameCreatedListeners,
  3273. listener = {
  3274. fn: fn,
  3275. scope: scope
  3276. };
  3277. if (className) {
  3278. if (this.isCreated(className)) {
  3279. fn.call(scope, className);
  3280. return;
  3281. }
  3282. if (!nameListeners[className]) {
  3283. nameListeners[className] = [];
  3284. }
  3285. nameListeners[className].push(listener);
  3286. }
  3287. else {
  3288. listeners.push(listener);
  3289. }
  3290. },
  3291. parseNamespace: function(namespace) {
  3292. var cache = this.namespaceParseCache,
  3293. parts,
  3294. rewrites,
  3295. root,
  3296. name,
  3297. rewrite, from, to, i, ln;
  3298. if (this.enableNamespaceParseCache) {
  3299. if (cache.hasOwnProperty(namespace)) {
  3300. return cache[namespace];
  3301. }
  3302. }
  3303. parts = [];
  3304. rewrites = this.namespaceRewrites;
  3305. root = global;
  3306. name = namespace;
  3307. for (i = 0, ln = rewrites.length; i < ln; i++) {
  3308. rewrite = rewrites[i];
  3309. from = rewrite.from;
  3310. to = rewrite.to;
  3311. if (name === from || name.substring(0, from.length) === from) {
  3312. name = name.substring(from.length);
  3313. if (typeof to != 'string') {
  3314. root = to;
  3315. } else {
  3316. parts = parts.concat(to.split('.'));
  3317. }
  3318. break;
  3319. }
  3320. }
  3321. parts.push(root);
  3322. parts = parts.concat(name.split('.'));
  3323. if (this.enableNamespaceParseCache) {
  3324. cache[namespace] = parts;
  3325. }
  3326. return parts;
  3327. },
  3328. setNamespace: function(name, value) {
  3329. var root = global,
  3330. parts = this.parseNamespace(name),
  3331. ln = parts.length - 1,
  3332. leaf = parts[ln],
  3333. i, part;
  3334. for (i = 0; i < ln; i++) {
  3335. part = parts[i];
  3336. if (typeof part != 'string') {
  3337. root = part;
  3338. } else {
  3339. if (!root[part]) {
  3340. root[part] = {};
  3341. }
  3342. root = root[part];
  3343. }
  3344. }
  3345. root[leaf] = value;
  3346. return root[leaf];
  3347. },
  3348. createNamespaces: function() {
  3349. var root = global,
  3350. parts, part, i, j, ln, subLn;
  3351. for (i = 0, ln = arguments.length; i < ln; i++) {
  3352. parts = this.parseNamespace(arguments[i]);
  3353. for (j = 0, subLn = parts.length; j < subLn; j++) {
  3354. part = parts[j];
  3355. if (typeof part != 'string') {
  3356. root = part;
  3357. } else {
  3358. if (!root[part]) {
  3359. root[part] = {};
  3360. }
  3361. root = root[part];
  3362. }
  3363. }
  3364. }
  3365. return root;
  3366. },
  3367. set: function(name, value) {
  3368. var me = this,
  3369. maps = me.maps,
  3370. nameToAlternates = maps.nameToAlternates,
  3371. targetName = me.getName(value),
  3372. alternates;
  3373. me.classes[name] = me.setNamespace(name, value);
  3374. if (targetName && targetName !== name) {
  3375. maps.alternateToName[name] = targetName;
  3376. alternates = nameToAlternates[targetName] || (nameToAlternates[targetName] = []);
  3377. alternates.push(name);
  3378. }
  3379. return this;
  3380. },
  3381. get: function(name) {
  3382. var classes = this.classes,
  3383. root,
  3384. parts,
  3385. part, i, ln;
  3386. if (classes[name]) {
  3387. return classes[name];
  3388. }
  3389. root = global;
  3390. parts = this.parseNamespace(name);
  3391. for (i = 0, ln = parts.length; i < ln; i++) {
  3392. part = parts[i];
  3393. if (typeof part != 'string') {
  3394. root = part;
  3395. } else {
  3396. if (!root || !root[part]) {
  3397. return null;
  3398. }
  3399. root = root[part];
  3400. }
  3401. }
  3402. return root;
  3403. },
  3404. setAlias: function(cls, alias) {
  3405. var aliasToNameMap = this.maps.aliasToName,
  3406. nameToAliasesMap = this.maps.nameToAliases,
  3407. className;
  3408. if (typeof cls == 'string') {
  3409. className = cls;
  3410. } else {
  3411. className = this.getName(cls);
  3412. }
  3413. if (alias && aliasToNameMap[alias] !== className) {
  3414. aliasToNameMap[alias] = className;
  3415. }
  3416. if (!nameToAliasesMap[className]) {
  3417. nameToAliasesMap[className] = [];
  3418. }
  3419. if (alias) {
  3420. Ext.Array.include(nameToAliasesMap[className], alias);
  3421. }
  3422. return this;
  3423. },
  3424. addNameAliasMappings: function(aliases){
  3425. var aliasToNameMap = this.maps.aliasToName,
  3426. nameToAliasesMap = this.maps.nameToAliases,
  3427. className, aliasList, alias, i;
  3428. for (className in aliases) {
  3429. aliasList = nameToAliasesMap[className] ||
  3430. (nameToAliasesMap[className] = []);
  3431. for (i = 0; i < aliases[className].length; i++) {
  3432. alias = aliases[className][i];
  3433. if (!aliasToNameMap[alias]) {
  3434. aliasToNameMap[alias] = className;
  3435. aliasList.push(alias);
  3436. }
  3437. }
  3438. }
  3439. return this;
  3440. },
  3441. addNameAlternateMappings: function(alternates) {
  3442. var alternateToName = this.maps.alternateToName,
  3443. nameToAlternates = this.maps.nameToAlternates,
  3444. className, aliasList, alternate, i;
  3445. for (className in alternates) {
  3446. aliasList = nameToAlternates[className] ||
  3447. (nameToAlternates[className] = []);
  3448. for (i = 0; i < alternates[className].length; i++) {
  3449. alternate = alternates[className];
  3450. if (!alternateToName[alternate]) {
  3451. alternateToName[alternate] = className;
  3452. aliasList.push(alternate);
  3453. }
  3454. }
  3455. }
  3456. return this;
  3457. },
  3458. getByAlias: function(alias) {
  3459. return this.get(this.getNameByAlias(alias));
  3460. },
  3461. getNameByAlias: function(alias) {
  3462. return this.maps.aliasToName[alias] || '';
  3463. },
  3464. getNameByAlternate: function(alternate) {
  3465. return this.maps.alternateToName[alternate] || '';
  3466. },
  3467. getAliasesByName: function(name) {
  3468. return this.maps.nameToAliases[name] || [];
  3469. },
  3470. getName: function(object) {
  3471. return object && object.$className || '';
  3472. },
  3473. getClass: function(object) {
  3474. return object && object.self || null;
  3475. },
  3476. create: function(className, data, createdFn) {
  3477. var ctor = makeCtor();
  3478. if (typeof data == 'function') {
  3479. data = data(ctor);
  3480. }
  3481. data.$className = className;
  3482. return new Class(ctor, data, function() {
  3483. var postprocessorStack = data.postprocessors || Manager.defaultPostprocessors,
  3484. registeredPostprocessors = Manager.postprocessors,
  3485. postprocessors = [],
  3486. postprocessor, i, ln, j, subLn, postprocessorProperties, postprocessorProperty;
  3487. delete data.postprocessors;
  3488. for (i = 0,ln = postprocessorStack.length; i < ln; i++) {
  3489. postprocessor = postprocessorStack[i];
  3490. if (typeof postprocessor == 'string') {
  3491. postprocessor = registeredPostprocessors[postprocessor];
  3492. postprocessorProperties = postprocessor.properties;
  3493. if (postprocessorProperties === true) {
  3494. postprocessors.push(postprocessor.fn);
  3495. }
  3496. else if (postprocessorProperties) {
  3497. for (j = 0,subLn = postprocessorProperties.length; j < subLn; j++) {
  3498. postprocessorProperty = postprocessorProperties[j];
  3499. if (data.hasOwnProperty(postprocessorProperty)) {
  3500. postprocessors.push(postprocessor.fn);
  3501. break;
  3502. }
  3503. }
  3504. }
  3505. }
  3506. else {
  3507. postprocessors.push(postprocessor);
  3508. }
  3509. }
  3510. data.postprocessors = postprocessors;
  3511. data.createdFn = createdFn;
  3512. Manager.processCreate(className, this, data);
  3513. });
  3514. },
  3515. processCreate: function(className, cls, clsData){
  3516. var me = this,
  3517. postprocessor = clsData.postprocessors.shift(),
  3518. createdFn = clsData.createdFn;
  3519. if (!postprocessor) {
  3520. if (className) {
  3521. me.set(className, cls);
  3522. }
  3523. if (createdFn) {
  3524. createdFn.call(cls, cls);
  3525. }
  3526. if (className) {
  3527. me.triggerCreated(className);
  3528. }
  3529. return;
  3530. }
  3531. if (postprocessor.call(me, className, cls, clsData, me.processCreate) !== false) {
  3532. me.processCreate(className, cls, clsData);
  3533. }
  3534. },
  3535. createOverride: function (className, data, createdFn) {
  3536. var me = this,
  3537. overriddenClassName = data.override,
  3538. requires = data.requires,
  3539. uses = data.uses,
  3540. classReady = function () {
  3541. var cls, temp;
  3542. if (requires) {
  3543. temp = requires;
  3544. requires = null;
  3545. Ext.Loader.require(temp, classReady);
  3546. } else {
  3547. cls = me.get(overriddenClassName);
  3548. delete data.override;
  3549. delete data.requires;
  3550. delete data.uses;
  3551. Ext.override(cls, data);
  3552. me.triggerCreated(className);
  3553. if (uses) {
  3554. Ext.Loader.addUsedClasses(uses);
  3555. }
  3556. if (createdFn) {
  3557. createdFn.call(cls);
  3558. }
  3559. }
  3560. };
  3561. me.existCache[className] = true;
  3562. me.onCreated(classReady, me, overriddenClassName);
  3563. return me;
  3564. },
  3565. instantiateByAlias: function() {
  3566. var alias = arguments[0],
  3567. args = arraySlice.call(arguments),
  3568. className = this.getNameByAlias(alias);
  3569. if (!className) {
  3570. className = this.maps.aliasToName[alias];
  3571. Ext.syncRequire(className);
  3572. }
  3573. args[0] = className;
  3574. return this.instantiate.apply(this, args);
  3575. },
  3576. instantiate: function() {
  3577. var name = arguments[0],
  3578. nameType = typeof name,
  3579. args = arraySlice.call(arguments, 1),
  3580. alias = name,
  3581. possibleName, cls;
  3582. if (nameType != 'function') {
  3583. if (nameType != 'string' && args.length === 0) {
  3584. args = [name];
  3585. name = name.xclass;
  3586. }
  3587. cls = this.get(name);
  3588. }
  3589. else {
  3590. cls = name;
  3591. }
  3592. if (!cls) {
  3593. possibleName = this.getNameByAlias(name);
  3594. if (possibleName) {
  3595. name = possibleName;
  3596. cls = this.get(name);
  3597. }
  3598. }
  3599. if (!cls) {
  3600. possibleName = this.getNameByAlternate(name);
  3601. if (possibleName) {
  3602. name = possibleName;
  3603. cls = this.get(name);
  3604. }
  3605. }
  3606. if (!cls) {
  3607. Ext.syncRequire(name);
  3608. cls = this.get(name);
  3609. }
  3610. return this.getInstantiator(args.length)(cls, args);
  3611. },
  3612. dynInstantiate: function(name, args) {
  3613. args = arrayFrom(args, true);
  3614. args.unshift(name);
  3615. return this.instantiate.apply(this, args);
  3616. },
  3617. getInstantiator: function(length) {
  3618. var instantiators = this.instantiators,
  3619. instantiator,
  3620. i,
  3621. args;
  3622. instantiator = instantiators[length];
  3623. if (!instantiator) {
  3624. i = length;
  3625. args = [];
  3626. for (i = 0; i < length; i++) {
  3627. args.push('a[' + i + ']');
  3628. }
  3629. instantiator = instantiators[length] = new Function('c', 'a', 'return new c(' + args.join(',') + ')');
  3630. }
  3631. return instantiator;
  3632. },
  3633. postprocessors: {},
  3634. defaultPostprocessors: [],
  3635. registerPostprocessor: function(name, fn, properties, position, relativeTo) {
  3636. if (!position) {
  3637. position = 'last';
  3638. }
  3639. if (!properties) {
  3640. properties = [name];
  3641. }
  3642. this.postprocessors[name] = {
  3643. name: name,
  3644. properties: properties || false,
  3645. fn: fn
  3646. };
  3647. this.setDefaultPostprocessorPosition(name, position, relativeTo);
  3648. return this;
  3649. },
  3650. setDefaultPostprocessors: function(postprocessors) {
  3651. this.defaultPostprocessors = arrayFrom(postprocessors);
  3652. return this;
  3653. },
  3654. setDefaultPostprocessorPosition: function(name, offset, relativeName) {
  3655. var defaultPostprocessors = this.defaultPostprocessors,
  3656. index;
  3657. if (typeof offset == 'string') {
  3658. if (offset === 'first') {
  3659. defaultPostprocessors.unshift(name);
  3660. return this;
  3661. }
  3662. else if (offset === 'last') {
  3663. defaultPostprocessors.push(name);
  3664. return this;
  3665. }
  3666. offset = (offset === 'after') ? 1 : -1;
  3667. }
  3668. index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
  3669. if (index !== -1) {
  3670. Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
  3671. }
  3672. return this;
  3673. },
  3674. getNamesByExpression: function(expression) {
  3675. var nameToAliasesMap = this.maps.nameToAliases,
  3676. names = [],
  3677. name, alias, aliases, possibleName, regex, i, ln;
  3678. if (expression.indexOf('*') !== -1) {
  3679. expression = expression.replace(/\*/g, '(.*?)');
  3680. regex = new RegExp('^' + expression + '$');
  3681. for (name in nameToAliasesMap) {
  3682. if (nameToAliasesMap.hasOwnProperty(name)) {
  3683. aliases = nameToAliasesMap[name];
  3684. if (name.search(regex) !== -1) {
  3685. names.push(name);
  3686. }
  3687. else {
  3688. for (i = 0, ln = aliases.length; i < ln; i++) {
  3689. alias = aliases[i];
  3690. if (alias.search(regex) !== -1) {
  3691. names.push(name);
  3692. break;
  3693. }
  3694. }
  3695. }
  3696. }
  3697. }
  3698. } else {
  3699. possibleName = this.getNameByAlias(expression);
  3700. if (possibleName) {
  3701. names.push(possibleName);
  3702. } else {
  3703. possibleName = this.getNameByAlternate(expression);
  3704. if (possibleName) {
  3705. names.push(possibleName);
  3706. } else {
  3707. names.push(expression);
  3708. }
  3709. }
  3710. }
  3711. return names;
  3712. }
  3713. };
  3714. Manager.registerPostprocessor('alias', function(name, cls, data) {
  3715. var aliases = data.alias,
  3716. i, ln;
  3717. for (i = 0,ln = aliases.length; i < ln; i++) {
  3718. alias = aliases[i];
  3719. this.setAlias(cls, alias);
  3720. }
  3721. }, ['xtype', 'alias']);
  3722. Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
  3723. fn.call(this, name, new cls(), data);
  3724. return false;
  3725. });
  3726. Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
  3727. var alternates = data.alternateClassName,
  3728. i, ln, alternate;
  3729. if (!(alternates instanceof Array)) {
  3730. alternates = [alternates];
  3731. }
  3732. for (i = 0, ln = alternates.length; i < ln; i++) {
  3733. alternate = alternates[i];
  3734. this.set(alternate, cls);
  3735. }
  3736. });
  3737. Ext.apply(Ext, {
  3738. create: alias(Manager, 'instantiate'),
  3739. widget: function(name, config) {
  3740. var xtype = name,
  3741. alias, className, T, load;
  3742. if (typeof xtype != 'string') {
  3743. config = name;
  3744. xtype = config.xtype;
  3745. } else {
  3746. config = config || {};
  3747. }
  3748. if (config.isComponent) {
  3749. return config;
  3750. }
  3751. alias = 'widget.' + xtype;
  3752. className = Manager.getNameByAlias(alias);
  3753. if (!className) {
  3754. load = true;
  3755. }
  3756. T = Manager.get(className);
  3757. if (load || !T) {
  3758. return Manager.instantiateByAlias(alias, config);
  3759. }
  3760. return new T(config);
  3761. },
  3762. createByAlias: alias(Manager, 'instantiateByAlias'),
  3763. define: function (className, data, createdFn) {
  3764. if (data.override) {
  3765. return Manager.createOverride.apply(Manager, arguments);
  3766. }
  3767. return Manager.create.apply(Manager, arguments);
  3768. },
  3769. getClassName: alias(Manager, 'getName'),
  3770. getDisplayName: function(object) {
  3771. if (object) {
  3772. if (object.displayName) {
  3773. return object.displayName;
  3774. }
  3775. if (object.$name && object.$class) {
  3776. return Ext.getClassName(object.$class) + '#' + object.$name;
  3777. }
  3778. if (object.$className) {
  3779. return object.$className;
  3780. }
  3781. }
  3782. return 'Anonymous';
  3783. },
  3784. getClass: alias(Manager, 'getClass'),
  3785. namespace: alias(Manager, 'createNamespaces')
  3786. });
  3787. Ext.createWidget = Ext.widget;
  3788. Ext.ns = Ext.namespace;
  3789. Class.registerPreprocessor('className', function(cls, data) {
  3790. if (data.$className) {
  3791. cls.$className = data.$className;
  3792. }
  3793. }, true, 'first');
  3794. Class.registerPreprocessor('alias', function(cls, data) {
  3795. var prototype = cls.prototype,
  3796. xtypes = arrayFrom(data.xtype),
  3797. aliases = arrayFrom(data.alias),
  3798. widgetPrefix = 'widget.',
  3799. widgetPrefixLength = widgetPrefix.length,
  3800. xtypesChain = Array.prototype.slice.call(prototype.xtypesChain || []),
  3801. xtypesMap = Ext.merge({}, prototype.xtypesMap || {}),
  3802. i, ln, alias, xtype;
  3803. for (i = 0,ln = aliases.length; i < ln; i++) {
  3804. alias = aliases[i];
  3805. if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
  3806. xtype = alias.substring(widgetPrefixLength);
  3807. Ext.Array.include(xtypes, xtype);
  3808. }
  3809. }
  3810. cls.xtype = data.xtype = xtypes[0];
  3811. data.xtypes = xtypes;
  3812. for (i = 0,ln = xtypes.length; i < ln; i++) {
  3813. xtype = xtypes[i];
  3814. if (!xtypesMap[xtype]) {
  3815. xtypesMap[xtype] = true;
  3816. xtypesChain.push(xtype);
  3817. }
  3818. }
  3819. data.xtypesChain = xtypesChain;
  3820. data.xtypesMap = xtypesMap;
  3821. Ext.Function.interceptAfter(data, 'onClassCreated', function() {
  3822. var mixins = prototype.mixins,
  3823. key, mixin;
  3824. for (key in mixins) {
  3825. if (mixins.hasOwnProperty(key)) {
  3826. mixin = mixins[key];
  3827. xtypes = mixin.xtypes;
  3828. if (xtypes) {
  3829. for (i = 0,ln = xtypes.length; i < ln; i++) {
  3830. xtype = xtypes[i];
  3831. if (!xtypesMap[xtype]) {
  3832. xtypesMap[xtype] = true;
  3833. xtypesChain.push(xtype);
  3834. }
  3835. }
  3836. }
  3837. }
  3838. }
  3839. });
  3840. for (i = 0,ln = xtypes.length; i < ln; i++) {
  3841. xtype = xtypes[i];
  3842. Ext.Array.include(aliases, widgetPrefix + xtype);
  3843. }
  3844. data.alias = aliases;
  3845. }, ['xtype', 'alias']);
  3846. }(Ext.Class, Ext.Function.alias, Array.prototype.slice, Ext.Array.from, Ext.global));
  3847. //@tag foundation,core
  3848. //@require ClassManager.js
  3849. //@define Ext.Loader
  3850. Ext.Loader = new function() {
  3851. var Loader = this,
  3852. Manager = Ext.ClassManager,
  3853. Class = Ext.Class,
  3854. flexSetter = Ext.Function.flexSetter,
  3855. alias = Ext.Function.alias,
  3856. pass = Ext.Function.pass,
  3857. defer = Ext.Function.defer,
  3858. arrayErase = Ext.Array.erase,
  3859. dependencyProperties = ['extend', 'mixins', 'requires'],
  3860. isInHistory = {},
  3861. history = [],
  3862. slashDotSlashRe = /\/\.\//g,
  3863. dotRe = /\./g;
  3864. Ext.apply(Loader, {
  3865. isInHistory: isInHistory,
  3866. history: history,
  3867. config: {
  3868. enabled: false,
  3869. scriptChainDelay : false,
  3870. disableCaching: true,
  3871. disableCachingParam: '_dc',
  3872. garbageCollect : false,
  3873. paths: {
  3874. 'Ext': '.'
  3875. },
  3876. preserveScripts : true,
  3877. scriptCharset : undefined
  3878. },
  3879. setConfig: function(name, value) {
  3880. if (Ext.isObject(name) && arguments.length === 1) {
  3881. Ext.merge(Loader.config, name);
  3882. }
  3883. else {
  3884. Loader.config[name] = (Ext.isObject(value)) ? Ext.merge(Loader.config[name], value) : value;
  3885. }
  3886. return Loader;
  3887. },
  3888. getConfig: function(name) {
  3889. if (name) {
  3890. return Loader.config[name];
  3891. }
  3892. return Loader.config;
  3893. },
  3894. setPath: flexSetter(function(name, path) {
  3895. Loader.config.paths[name] = path;
  3896. return Loader;
  3897. }),
  3898. addClassPathMappings: function(paths) {
  3899. var name;
  3900. for(name in paths){
  3901. Loader.config.paths[name] = paths[name];
  3902. }
  3903. return Loader;
  3904. },
  3905. getPath: function(className) {
  3906. var path = '',
  3907. paths = Loader.config.paths,
  3908. prefix = Loader.getPrefix(className);
  3909. if (prefix.length > 0) {
  3910. if (prefix === className) {
  3911. return paths[prefix];
  3912. }
  3913. path = paths[prefix];
  3914. className = className.substring(prefix.length + 1);
  3915. }
  3916. if (path.length > 0) {
  3917. path += '/';
  3918. }
  3919. return path.replace(slashDotSlashRe, '/') + className.replace(dotRe, "/") + '.js';
  3920. },
  3921. getPrefix: function(className) {
  3922. var paths = Loader.config.paths,
  3923. prefix, deepestPrefix = '';
  3924. if (paths.hasOwnProperty(className)) {
  3925. return className;
  3926. }
  3927. for (prefix in paths) {
  3928. if (paths.hasOwnProperty(prefix) && prefix + '.' === className.substring(0, prefix.length + 1)) {
  3929. if (prefix.length > deepestPrefix.length) {
  3930. deepestPrefix = prefix;
  3931. }
  3932. }
  3933. }
  3934. return deepestPrefix;
  3935. },
  3936. isAClassNameWithAKnownPrefix: function(className) {
  3937. var prefix = Loader.getPrefix(className);
  3938. return prefix !== '' && prefix !== className;
  3939. },
  3940. require: function(expressions, fn, scope, excludes) {
  3941. if (fn) {
  3942. fn.call(scope);
  3943. }
  3944. },
  3945. syncRequire: function() {},
  3946. exclude: function(excludes) {
  3947. return {
  3948. require: function(expressions, fn, scope) {
  3949. return Loader.require(expressions, fn, scope, excludes);
  3950. },
  3951. syncRequire: function(expressions, fn, scope) {
  3952. return Loader.syncRequire(expressions, fn, scope, excludes);
  3953. }
  3954. };
  3955. },
  3956. onReady: function(fn, scope, withDomReady, options) {
  3957. var oldFn;
  3958. if (withDomReady !== false && Ext.onDocumentReady) {
  3959. oldFn = fn;
  3960. fn = function() {
  3961. Ext.onDocumentReady(oldFn, scope, options);
  3962. };
  3963. }
  3964. fn.call(scope);
  3965. }
  3966. });
  3967. var queue = [],
  3968. isClassFileLoaded = {},
  3969. isFileLoaded = {},
  3970. classNameToFilePathMap = {},
  3971. scriptElements = {},
  3972. readyListeners = [],
  3973. usedClasses = [],
  3974. requiresMap = {};
  3975. Ext.apply(Loader, {
  3976. documentHead: typeof document != 'undefined' && (document.head || document.getElementsByTagName('head')[0]),
  3977. isLoading: false,
  3978. queue: queue,
  3979. isClassFileLoaded: isClassFileLoaded,
  3980. isFileLoaded: isFileLoaded,
  3981. readyListeners: readyListeners,
  3982. optionalRequires: usedClasses,
  3983. requiresMap: requiresMap,
  3984. numPendingFiles: 0,
  3985. numLoadedFiles: 0,
  3986. hasFileLoadError: false,
  3987. classNameToFilePathMap: classNameToFilePathMap,
  3988. scriptsLoading: 0,
  3989. syncModeEnabled: false,
  3990. scriptElements: scriptElements,
  3991. refreshQueue: function() {
  3992. var ln = queue.length,
  3993. i, item, j, requires;
  3994. if (!ln && !Loader.scriptsLoading) {
  3995. return Loader.triggerReady();
  3996. }
  3997. for (i = 0; i < ln; i++) {
  3998. item = queue[i];
  3999. if (item) {
  4000. requires = item.requires;
  4001. if (requires.length > Loader.numLoadedFiles) {
  4002. continue;
  4003. }
  4004. for (j = 0; j < requires.length; ) {
  4005. if (Manager.isCreated(requires[j])) {
  4006. arrayErase(requires, j, 1);
  4007. }
  4008. else {
  4009. j++;
  4010. }
  4011. }
  4012. if (item.requires.length === 0) {
  4013. arrayErase(queue, i, 1);
  4014. item.callback.call(item.scope);
  4015. Loader.refreshQueue();
  4016. break;
  4017. }
  4018. }
  4019. }
  4020. return Loader;
  4021. },
  4022. injectScriptElement: function(url, onLoad, onError, scope, charset) {
  4023. var script = document.createElement('script'),
  4024. dispatched = false,
  4025. config = Loader.config,
  4026. onLoadFn = function() {
  4027. if(!dispatched) {
  4028. dispatched = true;
  4029. script.onload = script.onreadystatechange = script.onerror = null;
  4030. if (typeof config.scriptChainDelay == 'number') {
  4031. defer(onLoad, config.scriptChainDelay, scope);
  4032. } else {
  4033. onLoad.call(scope);
  4034. }
  4035. Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
  4036. }
  4037. },
  4038. onErrorFn = function(arg) {
  4039. defer(onError, 1, scope);
  4040. Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
  4041. };
  4042. script.type = 'text/javascript';
  4043. script.onerror = onErrorFn;
  4044. charset = charset || config.scriptCharset;
  4045. if (charset) {
  4046. script.charset = charset;
  4047. }
  4048. if ('addEventListener' in script ) {
  4049. script.onload = onLoadFn;
  4050. } else if ('readyState' in script) {
  4051. script.onreadystatechange = function() {
  4052. if ( this.readyState == 'loaded' || this.readyState == 'complete' ) {
  4053. onLoadFn();
  4054. }
  4055. };
  4056. } else {
  4057. script.onload = onLoadFn;
  4058. }
  4059. script.src = url;
  4060. (Loader.documentHead || document.getElementsByTagName('head')[0]).appendChild(script);
  4061. return script;
  4062. },
  4063. removeScriptElement: function(url) {
  4064. if (scriptElements[url]) {
  4065. Loader.cleanupScriptElement(scriptElements[url], true, !!Loader.getConfig('garbageCollect'));
  4066. delete scriptElements[url];
  4067. }
  4068. return Loader;
  4069. },
  4070. cleanupScriptElement: function(script, remove, collect) {
  4071. var prop;
  4072. script.onload = script.onreadystatechange = script.onerror = null;
  4073. if (remove) {
  4074. Ext.removeNode(script);
  4075. if (collect) {
  4076. for (prop in script) {
  4077. try {
  4078. script[prop] = null;
  4079. delete script[prop];
  4080. } catch (cleanEx) {
  4081. }
  4082. }
  4083. }
  4084. }
  4085. return Loader;
  4086. },
  4087. loadScript: function (options) {
  4088. var config = Loader.getConfig(),
  4089. isString = typeof options == 'string',
  4090. url = isString ? options : options.url,
  4091. onError = !isString && options.onError,
  4092. onLoad = !isString && options.onLoad,
  4093. scope = !isString && options.scope,
  4094. onScriptError = function() {
  4095. Loader.numPendingFiles--;
  4096. Loader.scriptsLoading--;
  4097. if (onError) {
  4098. onError.call(scope, "Failed loading '" + url + "', please verify that the file exists");
  4099. }
  4100. if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
  4101. Loader.refreshQueue();
  4102. }
  4103. },
  4104. onScriptLoad = function () {
  4105. Loader.numPendingFiles--;
  4106. Loader.scriptsLoading--;
  4107. if (onLoad) {
  4108. onLoad.call(scope);
  4109. }
  4110. if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
  4111. Loader.refreshQueue();
  4112. }
  4113. },
  4114. src;
  4115. Loader.isLoading = true;
  4116. Loader.numPendingFiles++;
  4117. Loader.scriptsLoading++;
  4118. src = config.disableCaching ?
  4119. (url + '?' + config.disableCachingParam + '=' + Ext.Date.now()) : url;
  4120. scriptElements[url] = Loader.injectScriptElement(src, onScriptLoad, onScriptError);
  4121. },
  4122. loadScriptFile: function(url, onLoad, onError, scope, synchronous) {
  4123. if (isFileLoaded[url]) {
  4124. return Loader;
  4125. }
  4126. var config = Loader.getConfig(),
  4127. noCacheUrl = url + (config.disableCaching ? ('?' + config.disableCachingParam + '=' + Ext.Date.now()) : ''),
  4128. isCrossOriginRestricted = false,
  4129. xhr, status, onScriptError,
  4130. debugSourceURL = "";
  4131. scope = scope || Loader;
  4132. Loader.isLoading = true;
  4133. if (!synchronous) {
  4134. onScriptError = function() {
  4135. };
  4136. scriptElements[url] = Loader.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
  4137. } else {
  4138. if (typeof XMLHttpRequest != 'undefined') {
  4139. xhr = new XMLHttpRequest();
  4140. } else {
  4141. xhr = new ActiveXObject('Microsoft.XMLHTTP');
  4142. }
  4143. try {
  4144. xhr.open('GET', noCacheUrl, false);
  4145. xhr.send(null);
  4146. } catch (e) {
  4147. isCrossOriginRestricted = true;
  4148. }
  4149. status = (xhr.status === 1223) ? 204 :
  4150. (xhr.status === 0 && (self.location || {}).protocol == 'file:') ? 200 : xhr.status;
  4151. isCrossOriginRestricted = isCrossOriginRestricted || (status === 0);
  4152. if (isCrossOriginRestricted
  4153. ) {
  4154. }
  4155. else if ((status >= 200 && status < 300) || (status === 304)
  4156. ) {
  4157. if (!Ext.isIE) {
  4158. debugSourceURL = "\n//@ sourceURL=" + url;
  4159. }
  4160. Ext.globalEval(xhr.responseText + debugSourceURL);
  4161. onLoad.call(scope);
  4162. }
  4163. else {
  4164. }
  4165. xhr = null;
  4166. }
  4167. },
  4168. syncRequire: function() {
  4169. var syncModeEnabled = Loader.syncModeEnabled;
  4170. if (!syncModeEnabled) {
  4171. Loader.syncModeEnabled = true;
  4172. }
  4173. Loader.require.apply(Loader, arguments);
  4174. if (!syncModeEnabled) {
  4175. Loader.syncModeEnabled = false;
  4176. }
  4177. Loader.refreshQueue();
  4178. },
  4179. require: function(expressions, fn, scope, excludes) {
  4180. var excluded = {},
  4181. included = {},
  4182. excludedClassNames = [],
  4183. possibleClassNames = [],
  4184. classNames = [],
  4185. references = [],
  4186. callback,
  4187. syncModeEnabled,
  4188. filePath, expression, exclude, className,
  4189. possibleClassName, i, j, ln, subLn;
  4190. if (excludes) {
  4191. excludes = (typeof excludes === 'string') ? [ excludes ] : excludes;
  4192. for (i = 0,ln = excludes.length; i < ln; i++) {
  4193. exclude = excludes[i];
  4194. if (typeof exclude == 'string' && exclude.length > 0) {
  4195. excludedClassNames = Manager.getNamesByExpression(exclude);
  4196. for (j = 0,subLn = excludedClassNames.length; j < subLn; j++) {
  4197. excluded[excludedClassNames[j]] = true;
  4198. }
  4199. }
  4200. }
  4201. }
  4202. expressions = (typeof expressions === 'string') ? [ expressions ] : (expressions ? expressions : []);
  4203. if (fn) {
  4204. if (fn.length > 0) {
  4205. callback = function() {
  4206. var classes = [],
  4207. i, ln;
  4208. for (i = 0,ln = references.length; i < ln; i++) {
  4209. classes.push(Manager.get(references[i]));
  4210. }
  4211. return fn.apply(this, classes);
  4212. };
  4213. }
  4214. else {
  4215. callback = fn;
  4216. }
  4217. }
  4218. else {
  4219. callback = Ext.emptyFn;
  4220. }
  4221. scope = scope || Ext.global;
  4222. for (i = 0,ln = expressions.length; i < ln; i++) {
  4223. expression = expressions[i];
  4224. if (typeof expression == 'string' && expression.length > 0) {
  4225. possibleClassNames = Manager.getNamesByExpression(expression);
  4226. subLn = possibleClassNames.length;
  4227. for (j = 0; j < subLn; j++) {
  4228. possibleClassName = possibleClassNames[j];
  4229. if (excluded[possibleClassName] !== true) {
  4230. references.push(possibleClassName);
  4231. if (!Manager.isCreated(possibleClassName) && !included[possibleClassName]) {
  4232. included[possibleClassName] = true;
  4233. classNames.push(possibleClassName);
  4234. }
  4235. }
  4236. }
  4237. }
  4238. }
  4239. if (classNames.length > 0) {
  4240. if (!Loader.config.enabled) {
  4241. throw new Error("Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. " +
  4242. "Missing required class" + ((classNames.length > 1) ? "es" : "") + ": " + classNames.join(', '));
  4243. }
  4244. }
  4245. else {
  4246. callback.call(scope);
  4247. return Loader;
  4248. }
  4249. syncModeEnabled = Loader.syncModeEnabled;
  4250. if (!syncModeEnabled) {
  4251. queue.push({
  4252. requires: classNames.slice(),
  4253. callback: callback,
  4254. scope: scope
  4255. });
  4256. }
  4257. ln = classNames.length;
  4258. for (i = 0; i < ln; i++) {
  4259. className = classNames[i];
  4260. filePath = Loader.getPath(className);
  4261. if (syncModeEnabled && isClassFileLoaded.hasOwnProperty(className)) {
  4262. Loader.numPendingFiles--;
  4263. Loader.removeScriptElement(filePath);
  4264. delete isClassFileLoaded[className];
  4265. }
  4266. if (!isClassFileLoaded.hasOwnProperty(className)) {
  4267. isClassFileLoaded[className] = false;
  4268. classNameToFilePathMap[className] = filePath;
  4269. Loader.numPendingFiles++;
  4270. Loader.loadScriptFile(
  4271. filePath,
  4272. pass(Loader.onFileLoaded, [className, filePath], Loader),
  4273. pass(Loader.onFileLoadError, [className, filePath], Loader),
  4274. Loader,
  4275. syncModeEnabled
  4276. );
  4277. }
  4278. }
  4279. if (syncModeEnabled) {
  4280. callback.call(scope);
  4281. if (ln === 1) {
  4282. return Manager.get(className);
  4283. }
  4284. }
  4285. return Loader;
  4286. },
  4287. onFileLoaded: function(className, filePath) {
  4288. Loader.numLoadedFiles++;
  4289. isClassFileLoaded[className] = true;
  4290. isFileLoaded[filePath] = true;
  4291. Loader.numPendingFiles--;
  4292. if (Loader.numPendingFiles === 0) {
  4293. Loader.refreshQueue();
  4294. }
  4295. },
  4296. onFileLoadError: function(className, filePath, errorMessage, isSynchronous) {
  4297. Loader.numPendingFiles--;
  4298. Loader.hasFileLoadError = true;
  4299. },
  4300. addUsedClasses: function (classes) {
  4301. var cls, i, ln;
  4302. if (classes) {
  4303. classes = (typeof classes == 'string') ? [classes] : classes;
  4304. for (i = 0, ln = classes.length; i < ln; i++) {
  4305. cls = classes[i];
  4306. if (typeof cls == 'string' && !Ext.Array.contains(usedClasses, cls)) {
  4307. usedClasses.push(cls);
  4308. }
  4309. }
  4310. }
  4311. return Loader;
  4312. },
  4313. triggerReady: function() {
  4314. var listener,
  4315. i, refClasses = usedClasses;
  4316. if (Loader.isLoading) {
  4317. Loader.isLoading = false;
  4318. if (refClasses.length !== 0) {
  4319. refClasses = refClasses.slice();
  4320. usedClasses.length = 0;
  4321. Loader.require(refClasses, Loader.triggerReady, Loader);
  4322. return Loader;
  4323. }
  4324. }
  4325. while (readyListeners.length && !Loader.isLoading) {
  4326. listener = readyListeners.shift();
  4327. listener.fn.call(listener.scope);
  4328. }
  4329. return Loader;
  4330. },
  4331. onReady: function(fn, scope, withDomReady, options) {
  4332. var oldFn;
  4333. if (withDomReady !== false && Ext.onDocumentReady) {
  4334. oldFn = fn;
  4335. fn = function() {
  4336. Ext.onDocumentReady(oldFn, scope, options);
  4337. };
  4338. }
  4339. if (!Loader.isLoading) {
  4340. fn.call(scope);
  4341. }
  4342. else {
  4343. readyListeners.push({
  4344. fn: fn,
  4345. scope: scope
  4346. });
  4347. }
  4348. },
  4349. historyPush: function(className) {
  4350. if (className && isClassFileLoaded.hasOwnProperty(className) && !isInHistory[className]) {
  4351. isInHistory[className] = true;
  4352. history.push(className);
  4353. }
  4354. return Loader;
  4355. }
  4356. });
  4357. Ext.disableCacheBuster = function (disable, path) {
  4358. var date = new Date();
  4359. date.setTime(date.getTime() + (disable ? 10*365 : -1) * 24*60*60*1000);
  4360. date = date.toGMTString();
  4361. document.cookie = 'ext-cache=1; expires=' + date + '; path='+(path || '/');
  4362. };
  4363. Ext.require = alias(Loader, 'require');
  4364. Ext.syncRequire = alias(Loader, 'syncRequire');
  4365. Ext.exclude = alias(Loader, 'exclude');
  4366. Ext.onReady = function(fn, scope, options) {
  4367. Loader.onReady(fn, scope, true, options);
  4368. };
  4369. Class.registerPreprocessor('loader', function(cls, data, hooks, continueFn) {
  4370. var me = this,
  4371. dependencies = [],
  4372. dependency,
  4373. className = Manager.getName(cls),
  4374. i, j, ln, subLn, value, propertyName, propertyValue,
  4375. requiredMap, requiredDep;
  4376. for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
  4377. propertyName = dependencyProperties[i];
  4378. if (data.hasOwnProperty(propertyName)) {
  4379. propertyValue = data[propertyName];
  4380. if (typeof propertyValue == 'string') {
  4381. dependencies.push(propertyValue);
  4382. }
  4383. else if (propertyValue instanceof Array) {
  4384. for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
  4385. value = propertyValue[j];
  4386. if (typeof value == 'string') {
  4387. dependencies.push(value);
  4388. }
  4389. }
  4390. }
  4391. else if (typeof propertyValue != 'function') {
  4392. for (j in propertyValue) {
  4393. if (propertyValue.hasOwnProperty(j)) {
  4394. value = propertyValue[j];
  4395. if (typeof value == 'string') {
  4396. dependencies.push(value);
  4397. }
  4398. }
  4399. }
  4400. }
  4401. }
  4402. }
  4403. if (dependencies.length === 0) {
  4404. return;
  4405. }
  4406. Loader.require(dependencies, function() {
  4407. for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
  4408. propertyName = dependencyProperties[i];
  4409. if (data.hasOwnProperty(propertyName)) {
  4410. propertyValue = data[propertyName];
  4411. if (typeof propertyValue == 'string') {
  4412. data[propertyName] = Manager.get(propertyValue);
  4413. }
  4414. else if (propertyValue instanceof Array) {
  4415. for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
  4416. value = propertyValue[j];
  4417. if (typeof value == 'string') {
  4418. data[propertyName][j] = Manager.get(value);
  4419. }
  4420. }
  4421. }
  4422. else if (typeof propertyValue != 'function') {
  4423. for (var k in propertyValue) {
  4424. if (propertyValue.hasOwnProperty(k)) {
  4425. value = propertyValue[k];
  4426. if (typeof value == 'string') {
  4427. data[propertyName][k] = Manager.get(value);
  4428. }
  4429. }
  4430. }
  4431. }
  4432. }
  4433. }
  4434. continueFn.call(me, cls, data, hooks);
  4435. });
  4436. return false;
  4437. }, true, 'after', 'className');
  4438. Manager.registerPostprocessor('uses', function(name, cls, data) {
  4439. var uses = data.uses;
  4440. if (uses) {
  4441. Loader.addUsedClasses(uses);
  4442. }
  4443. });
  4444. Manager.onCreated(Loader.historyPush);
  4445. };
  4446. if (Ext._classPathMetadata) {
  4447. Ext.Loader.addClassPathMappings(Ext._classPathMetadata);
  4448. Ext._classPathMetadata = null;
  4449. }
  4450. (function() {
  4451. var scripts = document.getElementsByTagName('script'),
  4452. currentScript = scripts[scripts.length - 1],
  4453. src = currentScript.src,
  4454. path = src.substring(0, src.lastIndexOf('/') + 1),
  4455. Loader = Ext.Loader;
  4456. Loader.setConfig({
  4457. enabled: true,
  4458. disableCaching: true,
  4459. paths: {
  4460. 'Ext': path + 'src'
  4461. }
  4462. });
  4463. })();
  4464. Ext._endTime = new Date().getTime();
  4465. if (Ext._beforereadyhandler){
  4466. Ext._beforereadyhandler();
  4467. }
  4468. //@tag foundation,core
  4469. //@require ../class/Loader.js
  4470. Ext.Error = Ext.extend(Error, {
  4471. statics: {
  4472. ignore: false,
  4473. raise: function(err){
  4474. err = err || {};
  4475. if (Ext.isString(err)) {
  4476. err = { msg: err };
  4477. }
  4478. var method = this.raise.caller,
  4479. msg;
  4480. if (method) {
  4481. if (method.$name) {
  4482. err.sourceMethod = method.$name;
  4483. }
  4484. if (method.$owner) {
  4485. err.sourceClass = method.$owner.$className;
  4486. }
  4487. }
  4488. if (Ext.Error.handle(err) !== true) {
  4489. msg = Ext.Error.prototype.toString.call(err);
  4490. Ext.log({
  4491. msg: msg,
  4492. level: 'error',
  4493. dump: err,
  4494. stack: true
  4495. });
  4496. throw new Ext.Error(err);
  4497. }
  4498. },
  4499. handle: function(){
  4500. return Ext.Error.ignore;
  4501. }
  4502. },
  4503. name: 'Ext.Error',
  4504. constructor: function(config){
  4505. if (Ext.isString(config)) {
  4506. config = { msg: config };
  4507. }
  4508. var me = this;
  4509. Ext.apply(me, config);
  4510. me.message = me.message || me.msg;
  4511. },
  4512. toString: function(){
  4513. var me = this,
  4514. className = me.sourceClass ? me.sourceClass : '',
  4515. methodName = me.sourceMethod ? '.' + me.sourceMethod + '(): ' : '',
  4516. msg = me.msg || '(No description provided)';
  4517. return className + methodName + msg;
  4518. }
  4519. });
  4520. Ext.deprecated = function (suggestion) {
  4521. return Ext.emptyFn;
  4522. };