12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356 |
- /*
- Ext JS 4.1 - JavaScript Library
- Copyright (c) 2006-2012, Sencha Inc.
- All rights reserved.
- licensing@sencha.com
- http://www.sencha.com/license
- Open Source License
- ------------------------------------------------------------------------------------------
- This version of Ext JS is licensed under the terms of the Open Source GPL 3.0 license.
- http://www.gnu.org/licenses/gpl.html
- There are several FLOSS exceptions available for use with this release for
- open source applications that are distributed under a license other than GPL.
- * Open Source License Exception for Applications
- http://www.sencha.com/products/floss-exception.php
- * Open Source License Exception for Development
- http://www.sencha.com/products/ux-exception.php
- Alternate Licensing
- ------------------------------------------------------------------------------------------
- Commercial and OEM Licenses are available for an alternate download of Ext JS.
- This is the appropriate option if you are creating proprietary applications and you are
- not prepared to distribute and share the source code of your application under the
- GPL v3 license. Please visit http://www.sencha.com/license for more details.
- --
- 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.
- */
- //@tag foundation,core
- var Ext = Ext || {};
- Ext._startTime = new Date().getTime();
- (function() {
- var global = this,
- objectPrototype = Object.prototype,
- toString = objectPrototype.toString,
- enumerables = true,
- enumerablesTest = { toString: 1 },
- emptyFn = function () {},
-
-
- callOverrideParent = function () {
- var method = callOverrideParent.caller.caller;
- return method.$owner.prototype[method.$name].apply(this, arguments);
- },
- i;
- Ext.global = global;
- for (i in enumerablesTest) {
- enumerables = null;
- }
- if (enumerables) {
- enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable',
- 'toLocaleString', 'toString', 'constructor'];
- }
-
- Ext.enumerables = enumerables;
-
- Ext.apply = function(object, config, defaults) {
- if (defaults) {
- Ext.apply(object, defaults);
- }
- if (object && config && typeof config === 'object') {
- var i, j, k;
- for (i in config) {
- object[i] = config[i];
- }
- if (enumerables) {
- for (j = enumerables.length; j--;) {
- k = enumerables[j];
- if (config.hasOwnProperty(k)) {
- object[k] = config[k];
- }
- }
- }
- }
- return object;
- };
- Ext.buildSettings = Ext.apply({
- baseCSSPrefix: 'x-',
- scopeResetCSS: false
- }, Ext.buildSettings || {});
- Ext.apply(Ext, {
-
- name: Ext.sandboxName || 'Ext',
-
- emptyFn: emptyFn,
-
- emptyString: new String(),
- baseCSSPrefix: Ext.buildSettings.baseCSSPrefix,
-
- applyIf: function(object, config) {
- var property;
- if (object) {
- for (property in config) {
- if (object[property] === undefined) {
- object[property] = config[property];
- }
- }
- }
- return object;
- },
-
- iterate: function(object, fn, scope) {
- if (Ext.isEmpty(object)) {
- return;
- }
- if (scope === undefined) {
- scope = object;
- }
- if (Ext.isIterable(object)) {
- Ext.Array.each.call(Ext.Array, object, fn, scope);
- }
- else {
- Ext.Object.each.call(Ext.Object, object, fn, scope);
- }
- }
- });
- Ext.apply(Ext, {
-
- extend: (function() {
-
- var objectConstructor = objectPrototype.constructor,
- inlineOverrides = function(o) {
- for (var m in o) {
- if (!o.hasOwnProperty(m)) {
- continue;
- }
- this[m] = o[m];
- }
- };
- return function(subclass, superclass, overrides) {
-
- if (Ext.isObject(superclass)) {
- overrides = superclass;
- superclass = subclass;
- subclass = overrides.constructor !== objectConstructor ? overrides.constructor : function() {
- superclass.apply(this, arguments);
- };
- }
-
- var F = function() {},
- subclassProto, superclassProto = superclass.prototype;
- F.prototype = superclassProto;
- subclassProto = subclass.prototype = new F();
- subclassProto.constructor = subclass;
- subclass.superclass = superclassProto;
- if (superclassProto.constructor === objectConstructor) {
- superclassProto.constructor = superclass;
- }
- subclass.override = function(overrides) {
- Ext.override(subclass, overrides);
- };
- subclassProto.override = inlineOverrides;
- subclassProto.proto = subclassProto;
- subclass.override(overrides);
- subclass.extend = function(o) {
- return Ext.extend(subclass, o);
- };
- return subclass;
- };
- }()),
-
- override: function (target, overrides) {
- if (target.$isClass) {
- target.override(overrides);
- } else if (typeof target == 'function') {
- Ext.apply(target.prototype, overrides);
- } else {
- var owner = target.self,
- name, value;
- if (owner && owner.$isClass) {
- for (name in overrides) {
- if (overrides.hasOwnProperty(name)) {
- value = overrides[name];
- if (typeof value == 'function') {
- value.$name = name;
- value.$owner = owner;
- value.$previous = target.hasOwnProperty(name)
- ? target[name]
- : callOverrideParent;
- }
- target[name] = value;
- }
- }
- } else {
- Ext.apply(target, overrides);
- }
- }
- return target;
- }
- });
-
- Ext.apply(Ext, {
-
- valueFrom: function(value, defaultValue, allowBlank){
- return Ext.isEmpty(value, allowBlank) ? defaultValue : value;
- },
-
- typeOf: function(value) {
- var type,
- typeToString;
-
- if (value === null) {
- return 'null';
- }
- type = typeof value;
- if (type === 'undefined' || type === 'string' || type === 'number' || type === 'boolean') {
- return type;
- }
- typeToString = toString.call(value);
- switch(typeToString) {
- case '[object Array]':
- return 'array';
- case '[object Date]':
- return 'date';
- case '[object Boolean]':
- return 'boolean';
- case '[object Number]':
- return 'number';
- case '[object RegExp]':
- return 'regexp';
- }
- if (type === 'function') {
- return 'function';
- }
- if (type === 'object') {
- if (value.nodeType !== undefined) {
- if (value.nodeType === 3) {
- return (/\S/).test(value.nodeValue) ? 'textnode' : 'whitespace';
- }
- else {
- return 'element';
- }
- }
- return 'object';
- }
- },
-
- isEmpty: function(value, allowEmptyString) {
- return (value === null) || (value === undefined) || (!allowEmptyString ? value === '' : false) || (Ext.isArray(value) && value.length === 0);
- },
-
- isArray: ('isArray' in Array) ? Array.isArray : function(value) {
- return toString.call(value) === '[object Array]';
- },
-
- isDate: function(value) {
- return toString.call(value) === '[object Date]';
- },
-
- isObject: (toString.call(null) === '[object Object]') ?
- function(value) {
-
- return value !== null && value !== undefined && toString.call(value) === '[object Object]' && value.ownerDocument === undefined;
- } :
- function(value) {
- return toString.call(value) === '[object Object]';
- },
-
- isSimpleObject: function(value) {
- return value instanceof Object && value.constructor === Object;
- },
-
- isPrimitive: function(value) {
- var type = typeof value;
- return type === 'string' || type === 'number' || type === 'boolean';
- },
-
- isFunction:
-
-
- (typeof document !== 'undefined' && typeof document.getElementsByTagName('body') === 'function') ? function(value) {
- return toString.call(value) === '[object Function]';
- } : function(value) {
- return typeof value === 'function';
- },
-
- isNumber: function(value) {
- return typeof value === 'number' && isFinite(value);
- },
-
- isNumeric: function(value) {
- return !isNaN(parseFloat(value)) && isFinite(value);
- },
-
- isString: function(value) {
- return typeof value === 'string';
- },
-
- isBoolean: function(value) {
- return typeof value === 'boolean';
- },
-
- isElement: function(value) {
- return value ? value.nodeType === 1 : false;
- },
-
- isTextNode: function(value) {
- return value ? value.nodeName === "#text" : false;
- },
-
- isDefined: function(value) {
- return typeof value !== 'undefined';
- },
-
- isIterable: function(value) {
- var type = typeof value,
- checkLength = false;
- if (value && type != 'string') {
-
- if (type == 'function') {
-
-
- if (Ext.isSafari) {
- checkLength = value instanceof NodeList || value instanceof HTMLCollection;
- }
- } else {
- checkLength = true;
- }
- }
- return checkLength ? value.length !== undefined : false;
- }
- });
- Ext.apply(Ext, {
-
- clone: function(item) {
- var type,
- i,
- j,
- k,
- clone,
- key;
-
- if (item === null || item === undefined) {
- return item;
- }
-
-
-
- if (item.nodeType && item.cloneNode) {
- return item.cloneNode(true);
- }
- type = toString.call(item);
-
- if (type === '[object Date]') {
- return new Date(item.getTime());
- }
-
- if (type === '[object Array]') {
- i = item.length;
- clone = [];
- while (i--) {
- clone[i] = Ext.clone(item[i]);
- }
- }
-
- else if (type === '[object Object]' && item.constructor === Object) {
- clone = {};
- for (key in item) {
- clone[key] = Ext.clone(item[key]);
- }
- if (enumerables) {
- for (j = enumerables.length; j--;) {
- k = enumerables[j];
- clone[k] = item[k];
- }
- }
- }
- return clone || item;
- },
-
- getUniqueGlobalNamespace: function() {
- var uniqueGlobalNamespace = this.uniqueGlobalNamespace,
- i;
- if (uniqueGlobalNamespace === undefined) {
- i = 0;
- do {
- uniqueGlobalNamespace = 'ExtBox' + (++i);
- } while (Ext.global[uniqueGlobalNamespace] !== undefined);
- Ext.global[uniqueGlobalNamespace] = Ext;
- this.uniqueGlobalNamespace = uniqueGlobalNamespace;
- }
- return uniqueGlobalNamespace;
- },
-
-
- functionFactoryCache: {},
-
- cacheableFunctionFactory: function() {
- var me = this,
- args = Array.prototype.slice.call(arguments),
- cache = me.functionFactoryCache,
- idx, fn, ln;
-
- if (Ext.isSandboxed) {
- ln = args.length;
- if (ln > 0) {
- ln--;
- args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
- }
- }
- idx = args.join('');
- fn = cache[idx];
- if (!fn) {
- fn = Function.prototype.constructor.apply(Function.prototype, args);
-
- cache[idx] = fn;
- }
- return fn;
- },
-
- functionFactory: function() {
- var me = this,
- args = Array.prototype.slice.call(arguments),
- ln;
-
- if (Ext.isSandboxed) {
- ln = args.length;
- if (ln > 0) {
- ln--;
- args[ln] = 'var Ext=window.' + Ext.name + ';' + args[ln];
- }
- }
-
- return Function.prototype.constructor.apply(Function.prototype, args);
- },
-
- Logger: {
- verbose: emptyFn,
- log: emptyFn,
- info: emptyFn,
- warn: emptyFn,
- error: function(message) {
- throw new Error(message);
- },
- deprecate: emptyFn
- }
- });
-
- Ext.type = Ext.typeOf;
- }());
- Ext.globalEval = Ext.global.execScript
- ? function(code) {
- execScript(code);
- }
- : function($$code) {
-
-
- (function(){
- eval($$code);
- }());
- };
- //@tag foundation,core
- //@require ../Ext.js
- (function() {
- var version = '4.1.1.1', Version;
- Ext.Version = Version = Ext.extend(Object, {
-
- constructor: function(version) {
- var parts, releaseStartIndex;
- if (version instanceof Version) {
- return version;
- }
- this.version = this.shortVersion = String(version).toLowerCase().replace(/_/g, '.').replace(/[\-+]/g, '');
- releaseStartIndex = this.version.search(/([^\d\.])/);
- if (releaseStartIndex !== -1) {
- this.release = this.version.substr(releaseStartIndex, version.length);
- this.shortVersion = this.version.substr(0, releaseStartIndex);
- }
- this.shortVersion = this.shortVersion.replace(/[^\d]/g, '');
- parts = this.version.split('.');
- this.major = parseInt(parts.shift() || 0, 10);
- this.minor = parseInt(parts.shift() || 0, 10);
- this.patch = parseInt(parts.shift() || 0, 10);
- this.build = parseInt(parts.shift() || 0, 10);
- return this;
- },
-
- toString: function() {
- return this.version;
- },
-
- valueOf: function() {
- return this.version;
- },
-
- getMajor: function() {
- return this.major || 0;
- },
-
- getMinor: function() {
- return this.minor || 0;
- },
-
- getPatch: function() {
- return this.patch || 0;
- },
-
- getBuild: function() {
- return this.build || 0;
- },
-
- getRelease: function() {
- return this.release || '';
- },
-
- isGreaterThan: function(target) {
- return Version.compare(this.version, target) === 1;
- },
-
- isGreaterThanOrEqual: function(target) {
- return Version.compare(this.version, target) >= 0;
- },
-
- isLessThan: function(target) {
- return Version.compare(this.version, target) === -1;
- },
-
- isLessThanOrEqual: function(target) {
- return Version.compare(this.version, target) <= 0;
- },
-
- equals: function(target) {
- return Version.compare(this.version, target) === 0;
- },
-
- match: function(target) {
- target = String(target);
- return this.version.substr(0, target.length) === target;
- },
-
- toArray: function() {
- return [this.getMajor(), this.getMinor(), this.getPatch(), this.getBuild(), this.getRelease()];
- },
-
- getShortVersion: function() {
- return this.shortVersion;
- },
-
- gt: function() {
- return this.isGreaterThan.apply(this, arguments);
- },
-
- lt: function() {
- return this.isLessThan.apply(this, arguments);
- },
-
- gtEq: function() {
- return this.isGreaterThanOrEqual.apply(this, arguments);
- },
-
- ltEq: function() {
- return this.isLessThanOrEqual.apply(this, arguments);
- }
- });
- Ext.apply(Version, {
-
- releaseValueMap: {
- 'dev': -6,
- 'alpha': -5,
- 'a': -5,
- 'beta': -4,
- 'b': -4,
- 'rc': -3,
- '#': -2,
- 'p': -1,
- 'pl': -1
- },
-
- getComponentValue: function(value) {
- return !value ? 0 : (isNaN(value) ? this.releaseValueMap[value] || value : parseInt(value, 10));
- },
-
- compare: function(current, target) {
- var currentValue, targetValue, i;
- current = new Version(current).toArray();
- target = new Version(target).toArray();
- for (i = 0; i < Math.max(current.length, target.length); i++) {
- currentValue = this.getComponentValue(current[i]);
- targetValue = this.getComponentValue(target[i]);
- if (currentValue < targetValue) {
- return -1;
- } else if (currentValue > targetValue) {
- return 1;
- }
- }
- return 0;
- }
- });
-
- Ext.apply(Ext, {
-
- versions: {},
-
- lastRegisteredVersion: null,
-
- setVersion: function(packageName, version) {
- Ext.versions[packageName] = new Version(version);
- Ext.lastRegisteredVersion = Ext.versions[packageName];
- return this;
- },
-
- getVersion: function(packageName) {
- if (packageName === undefined) {
- return Ext.lastRegisteredVersion;
- }
- return Ext.versions[packageName];
- },
-
- deprecate: function(packageName, since, closure, scope) {
- if (Version.compare(Ext.getVersion(packageName), since) < 1) {
- closure.call(scope);
- }
- }
- });
- Ext.setVersion('core', version);
- }());
- //@tag foundation,core
- //@require ../version/Version.js
- Ext.String = (function() {
- 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,
- escapeRe = /('|\\)/g,
- formatRe = /\{(\d+)\}/g,
- escapeRegexRe = /([-.*+?\^${}()|\[\]\/\\])/g,
- basicTrimRe = /^\s+|\s+$/g,
- whitespaceRe = /\s+/,
- varReplace = /(^[^a-z]*|[^\w])/gi,
- charToEntity,
- entityToChar,
- charToEntityRegex,
- entityToCharRegex,
- htmlEncodeReplaceFn = function(match, capture) {
- return charToEntity[capture];
- },
- htmlDecodeReplaceFn = function(match, capture) {
- return (capture in entityToChar) ? entityToChar[capture] : String.fromCharCode(parseInt(capture.substr(2), 10));
- };
- return {
-
- createVarName: function(s) {
- return s.replace(varReplace, '');
- },
-
- htmlEncode: function(value) {
- return (!value) ? value : String(value).replace(charToEntityRegex, htmlEncodeReplaceFn);
- },
-
- htmlDecode: function(value) {
- return (!value) ? value : String(value).replace(entityToCharRegex, htmlDecodeReplaceFn);
- },
-
- addCharacterEntities: function(newEntities) {
- var charKeys = [],
- entityKeys = [],
- key, echar;
- for (key in newEntities) {
- echar = newEntities[key];
- entityToChar[key] = echar;
- charToEntity[echar] = key;
- charKeys.push(echar);
- entityKeys.push(key);
- }
- charToEntityRegex = new RegExp('(' + charKeys.join('|') + ')', 'g');
- entityToCharRegex = new RegExp('(' + entityKeys.join('|') + '|&#[0-9]{1,5};' + ')', 'g');
- },
-
- resetCharacterEntities: function() {
- charToEntity = {};
- entityToChar = {};
-
- this.addCharacterEntities({
- '&' : '&',
- '>' : '>',
- '<' : '<',
- '"' : '"',
- ''' : "'"
- });
- },
-
- urlAppend : function(url, string) {
- if (!Ext.isEmpty(string)) {
- return url + (url.indexOf('?') === -1 ? '?' : '&') + string;
- }
- return url;
- },
-
- trim: function(string) {
- return string.replace(trimRegex, "");
- },
-
- capitalize: function(string) {
- return string.charAt(0).toUpperCase() + string.substr(1);
- },
-
- uncapitalize: function(string) {
- return string.charAt(0).toLowerCase() + string.substr(1);
- },
-
- ellipsis: function(value, len, word) {
- if (value && value.length > len) {
- if (word) {
- var vs = value.substr(0, len - 2),
- index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));
- if (index !== -1 && index >= (len - 15)) {
- return vs.substr(0, index) + "...";
- }
- }
- return value.substr(0, len - 3) + "...";
- }
- return value;
- },
-
- escapeRegex: function(string) {
- return string.replace(escapeRegexRe, "\\$1");
- },
-
- escape: function(string) {
- return string.replace(escapeRe, "\\$1");
- },
-
- toggle: function(string, value, other) {
- return string === value ? other : value;
- },
-
- leftPad: function(string, size, character) {
- var result = String(string);
- character = character || " ";
- while (result.length < size) {
- result = character + result;
- }
- return result;
- },
-
- format: function(format) {
- var args = Ext.Array.toArray(arguments, 1);
- return format.replace(formatRe, function(m, i) {
- return args[i];
- });
- },
-
- repeat: function(pattern, count, sep) {
- for (var buf = [], i = count; i--; ) {
- buf.push(pattern);
- }
- return buf.join(sep || '');
- },
-
- splitWords: function (words) {
- if (words && typeof words == 'string') {
- return words.replace(basicTrimRe, '').split(whitespaceRe);
- }
- return words || [];
- }
- };
- }());
- Ext.String.resetCharacterEntities();
- Ext.htmlEncode = Ext.String.htmlEncode;
- Ext.htmlDecode = Ext.String.htmlDecode;
- Ext.urlAppend = Ext.String.urlAppend;
- //@tag foundation,core
- //@require String.js
- //@define Ext.Number
- Ext.Number = new function() {
- var me = this,
- isToFixedBroken = (0.9).toFixed() !== '1',
- math = Math;
- Ext.apply(this, {
-
- constrain: function(number, min, max) {
- var x = parseFloat(number);
-
-
-
-
-
-
-
- return (x < min) ? min : ((x > max) ? max : x);
- },
-
- snap : function(value, increment, minValue, maxValue) {
- var m;
-
-
- if (value === undefined || value < minValue) {
- return minValue || 0;
- }
- if (increment) {
- m = value % increment;
- if (m !== 0) {
- value -= m;
- if (m * 2 >= increment) {
- value += increment;
- } else if (m * 2 < -increment) {
- value -= increment;
- }
- }
- }
- return me.constrain(value, minValue, maxValue);
- },
-
- snapInRange : function(value, increment, minValue, maxValue) {
- var tween;
-
- minValue = (minValue || 0);
-
- if (value === undefined || value < minValue) {
- return minValue;
- }
-
- if (increment && (tween = ((value - minValue) % increment))) {
- value -= tween;
- tween *= 2;
- if (tween >= increment) {
- value += increment;
- }
- }
-
- if (maxValue !== undefined) {
- if (value > (maxValue = me.snapInRange(maxValue, increment, minValue))) {
- value = maxValue;
- }
- }
- return value;
- },
-
- toFixed: isToFixedBroken ? function(value, precision) {
- precision = precision || 0;
- var pow = math.pow(10, precision);
- return (math.round(value * pow) / pow).toFixed(precision);
- } : function(value, precision) {
- return value.toFixed(precision);
- },
-
- from: function(value, defaultValue) {
- if (isFinite(value)) {
- value = parseFloat(value);
- }
- return !isNaN(value) ? value : defaultValue;
- },
-
- randomInt: function (from, to) {
- return math.floor(math.random() * (to - from + 1) + from);
- }
- });
-
- Ext.num = function() {
- return me.from.apply(this, arguments);
- };
- };
- //@tag foundation,core
- //@require Number.js
- (function() {
- var arrayPrototype = Array.prototype,
- slice = arrayPrototype.slice,
- supportsSplice = (function () {
- var array = [],
- lengthBefore,
- j = 20;
- if (!array.splice) {
- return false;
- }
-
-
- while (j--) {
- array.push("A");
- }
- 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");
- lengthBefore = array.length;
- array.splice(13, 0, "XXX");
- if (lengthBefore+1 != array.length) {
- return false;
- }
-
- return true;
- }()),
- supportsForEach = 'forEach' in arrayPrototype,
- supportsMap = 'map' in arrayPrototype,
- supportsIndexOf = 'indexOf' in arrayPrototype,
- supportsEvery = 'every' in arrayPrototype,
- supportsSome = 'some' in arrayPrototype,
- supportsFilter = 'filter' in arrayPrototype,
- supportsSort = (function() {
- var a = [1,2,3,4,5].sort(function(){ return 0; });
- return a[0] === 1 && a[1] === 2 && a[2] === 3 && a[3] === 4 && a[4] === 5;
- }()),
- supportsSliceOnNodeList = true,
- ExtArray,
- erase,
- replace,
- splice;
- try {
-
- if (typeof document !== 'undefined') {
- slice.call(document.getElementsByTagName('body'));
- }
- } catch (e) {
- supportsSliceOnNodeList = false;
- }
- function fixArrayIndex (array, index) {
- return (index < 0) ? Math.max(0, array.length + index)
- : Math.min(array.length, index);
- }
-
- function replaceSim (array, index, removeCount, insert) {
- var add = insert ? insert.length : 0,
- length = array.length,
- pos = fixArrayIndex(array, index),
- remove,
- tailOldPos,
- tailNewPos,
- tailCount,
- lengthAfterRemove,
- i;
-
- if (pos === length) {
- if (add) {
- array.push.apply(array, insert);
- }
- } else {
- remove = Math.min(removeCount, length - pos);
- tailOldPos = pos + remove;
- tailNewPos = tailOldPos + add - remove;
- tailCount = length - tailOldPos;
- lengthAfterRemove = length - remove;
- if (tailNewPos < tailOldPos) {
- for (i = 0; i < tailCount; ++i) {
- array[tailNewPos+i] = array[tailOldPos+i];
- }
- } else if (tailNewPos > tailOldPos) {
- for (i = tailCount; i--; ) {
- array[tailNewPos+i] = array[tailOldPos+i];
- }
- }
- if (add && pos === lengthAfterRemove) {
- array.length = lengthAfterRemove;
- array.push.apply(array, insert);
- } else {
- array.length = lengthAfterRemove + add;
- for (i = 0; i < add; ++i) {
- array[pos+i] = insert[i];
- }
- }
- }
- return array;
- }
- function replaceNative (array, index, removeCount, insert) {
- if (insert && insert.length) {
- if (index < array.length) {
- array.splice.apply(array, [index, removeCount].concat(insert));
- } else {
- array.push.apply(array, insert);
- }
- } else {
- array.splice(index, removeCount);
- }
- return array;
- }
- function eraseSim (array, index, removeCount) {
- return replaceSim(array, index, removeCount);
- }
- function eraseNative (array, index, removeCount) {
- array.splice(index, removeCount);
- return array;
- }
- function spliceSim (array, index, removeCount) {
- var pos = fixArrayIndex(array, index),
- removed = array.slice(index, fixArrayIndex(array, pos+removeCount));
- if (arguments.length < 4) {
- replaceSim(array, pos, removeCount);
- } else {
- replaceSim(array, pos, removeCount, slice.call(arguments, 3));
- }
- return removed;
- }
- function spliceNative (array) {
- return array.splice.apply(array, slice.call(arguments, 1));
- }
- erase = supportsSplice ? eraseNative : eraseSim;
- replace = supportsSplice ? replaceNative : replaceSim;
- splice = supportsSplice ? spliceNative : spliceSim;
-
- ExtArray = Ext.Array = {
-
- each: function(array, fn, scope, reverse) {
- array = ExtArray.from(array);
- var i,
- ln = array.length;
- if (reverse !== true) {
- for (i = 0; i < ln; i++) {
- if (fn.call(scope || array[i], array[i], i, array) === false) {
- return i;
- }
- }
- }
- else {
- for (i = ln - 1; i > -1; i--) {
- if (fn.call(scope || array[i], array[i], i, array) === false) {
- return i;
- }
- }
- }
- return true;
- },
-
- forEach: supportsForEach ? function(array, fn, scope) {
- return array.forEach(fn, scope);
- } : function(array, fn, scope) {
- var i = 0,
- ln = array.length;
- for (; i < ln; i++) {
- fn.call(scope, array[i], i, array);
- }
- },
-
- indexOf: supportsIndexOf ? function(array, item, from) {
- return array.indexOf(item, from);
- } : function(array, item, from) {
- var i, length = array.length;
- for (i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++) {
- if (array[i] === item) {
- return i;
- }
- }
- return -1;
- },
-
- contains: supportsIndexOf ? function(array, item) {
- return array.indexOf(item) !== -1;
- } : function(array, item) {
- var i, ln;
- for (i = 0, ln = array.length; i < ln; i++) {
- if (array[i] === item) {
- return true;
- }
- }
- return false;
- },
-
- toArray: function(iterable, start, end){
- if (!iterable || !iterable.length) {
- return [];
- }
- if (typeof iterable === 'string') {
- iterable = iterable.split('');
- }
- if (supportsSliceOnNodeList) {
- return slice.call(iterable, start || 0, end || iterable.length);
- }
- var array = [],
- i;
- start = start || 0;
- end = end ? ((end < 0) ? iterable.length + end : end) : iterable.length;
- for (i = start; i < end; i++) {
- array.push(iterable[i]);
- }
- return array;
- },
-
- pluck: function(array, propertyName) {
- var ret = [],
- i, ln, item;
- for (i = 0, ln = array.length; i < ln; i++) {
- item = array[i];
- ret.push(item[propertyName]);
- }
- return ret;
- },
-
- map: supportsMap ? function(array, fn, scope) {
- return array.map(fn, scope);
- } : function(array, fn, scope) {
- var results = [],
- i = 0,
- len = array.length;
- for (; i < len; i++) {
- results[i] = fn.call(scope, array[i], i, array);
- }
- return results;
- },
-
- every: supportsEvery ? function(array, fn, scope) {
- return array.every(fn, scope);
- } : function(array, fn, scope) {
- var i = 0,
- ln = array.length;
- for (; i < ln; ++i) {
- if (!fn.call(scope, array[i], i, array)) {
- return false;
- }
- }
- return true;
- },
-
- some: supportsSome ? function(array, fn, scope) {
- return array.some(fn, scope);
- } : function(array, fn, scope) {
- var i = 0,
- ln = array.length;
- for (; i < ln; ++i) {
- if (fn.call(scope, array[i], i, array)) {
- return true;
- }
- }
- return false;
- },
-
- clean: function(array) {
- var results = [],
- i = 0,
- ln = array.length,
- item;
- for (; i < ln; i++) {
- item = array[i];
- if (!Ext.isEmpty(item)) {
- results.push(item);
- }
- }
- return results;
- },
-
- unique: function(array) {
- var clone = [],
- i = 0,
- ln = array.length,
- item;
- for (; i < ln; i++) {
- item = array[i];
- if (ExtArray.indexOf(clone, item) === -1) {
- clone.push(item);
- }
- }
- return clone;
- },
-
- filter: supportsFilter ? function(array, fn, scope) {
- return array.filter(fn, scope);
- } : function(array, fn, scope) {
- var results = [],
- i = 0,
- ln = array.length;
- for (; i < ln; i++) {
- if (fn.call(scope, array[i], i, array)) {
- results.push(array[i]);
- }
- }
- return results;
- },
-
- from: function(value, newReference) {
- if (value === undefined || value === null) {
- return [];
- }
- if (Ext.isArray(value)) {
- return (newReference) ? slice.call(value) : value;
- }
- var type = typeof value;
-
-
- if (value && value.length !== undefined && type !== 'string' && (type !== 'function' || !value.apply)) {
- return ExtArray.toArray(value);
- }
- return [value];
- },
-
- remove: function(array, item) {
- var index = ExtArray.indexOf(array, item);
- if (index !== -1) {
- erase(array, index, 1);
- }
- return array;
- },
-
- include: function(array, item) {
- if (!ExtArray.contains(array, item)) {
- array.push(item);
- }
- },
-
- clone: function(array) {
- return slice.call(array);
- },
-
- merge: function() {
- var args = slice.call(arguments),
- array = [],
- i, ln;
- for (i = 0, ln = args.length; i < ln; i++) {
- array = array.concat(args[i]);
- }
- return ExtArray.unique(array);
- },
-
- intersect: function() {
- var intersection = [],
- arrays = slice.call(arguments),
- arraysLength,
- array,
- arrayLength,
- minArray,
- minArrayIndex,
- minArrayCandidate,
- minArrayLength,
- element,
- elementCandidate,
- elementCount,
- i, j, k;
- if (!arrays.length) {
- return intersection;
- }
-
- arraysLength = arrays.length;
- for (i = minArrayIndex = 0; i < arraysLength; i++) {
- minArrayCandidate = arrays[i];
- if (!minArray || minArrayCandidate.length < minArray.length) {
- minArray = minArrayCandidate;
- minArrayIndex = i;
- }
- }
- minArray = ExtArray.unique(minArray);
- erase(arrays, minArrayIndex, 1);
-
-
-
- minArrayLength = minArray.length;
- arraysLength = arrays.length;
- for (i = 0; i < minArrayLength; i++) {
- element = minArray[i];
- elementCount = 0;
- for (j = 0; j < arraysLength; j++) {
- array = arrays[j];
- arrayLength = array.length;
- for (k = 0; k < arrayLength; k++) {
- elementCandidate = array[k];
- if (element === elementCandidate) {
- elementCount++;
- break;
- }
- }
- }
- if (elementCount === arraysLength) {
- intersection.push(element);
- }
- }
- return intersection;
- },
-
- difference: function(arrayA, arrayB) {
- var clone = slice.call(arrayA),
- ln = clone.length,
- i, j, lnB;
- for (i = 0,lnB = arrayB.length; i < lnB; i++) {
- for (j = 0; j < ln; j++) {
- if (clone[j] === arrayB[i]) {
- erase(clone, j, 1);
- j--;
- ln--;
- }
- }
- }
- return clone;
- },
-
-
- slice: ([1,2].slice(1, undefined).length ?
- function (array, begin, end) {
- return slice.call(array, begin, end);
- } :
-
- function (array, begin, end) {
-
-
- if (typeof begin === 'undefined') {
- return slice.call(array);
- }
- if (typeof end === 'undefined') {
- return slice.call(array, begin);
- }
- return slice.call(array, begin, end);
- }
- ),
-
- sort: supportsSort ? function(array, sortFn) {
- if (sortFn) {
- return array.sort(sortFn);
- } else {
- return array.sort();
- }
- } : function(array, sortFn) {
- var length = array.length,
- i = 0,
- comparison,
- j, min, tmp;
- for (; i < length; i++) {
- min = i;
- for (j = i + 1; j < length; j++) {
- if (sortFn) {
- comparison = sortFn(array[j], array[min]);
- if (comparison < 0) {
- min = j;
- }
- } else if (array[j] < array[min]) {
- min = j;
- }
- }
- if (min !== i) {
- tmp = array[i];
- array[i] = array[min];
- array[min] = tmp;
- }
- }
- return array;
- },
-
- flatten: function(array) {
- var worker = [];
- function rFlatten(a) {
- var i, ln, v;
- for (i = 0, ln = a.length; i < ln; i++) {
- v = a[i];
- if (Ext.isArray(v)) {
- rFlatten(v);
- } else {
- worker.push(v);
- }
- }
- return worker;
- }
- return rFlatten(array);
- },
-
- min: function(array, comparisonFn) {
- var min = array[0],
- i, ln, item;
- for (i = 0, ln = array.length; i < ln; i++) {
- item = array[i];
- if (comparisonFn) {
- if (comparisonFn(min, item) === 1) {
- min = item;
- }
- }
- else {
- if (item < min) {
- min = item;
- }
- }
- }
- return min;
- },
-
- max: function(array, comparisonFn) {
- var max = array[0],
- i, ln, item;
- for (i = 0, ln = array.length; i < ln; i++) {
- item = array[i];
- if (comparisonFn) {
- if (comparisonFn(max, item) === -1) {
- max = item;
- }
- }
- else {
- if (item > max) {
- max = item;
- }
- }
- }
- return max;
- },
-
- mean: function(array) {
- return array.length > 0 ? ExtArray.sum(array) / array.length : undefined;
- },
-
- sum: function(array) {
- var sum = 0,
- i, ln, item;
- for (i = 0,ln = array.length; i < ln; i++) {
- item = array[i];
- sum += item;
- }
- return sum;
- },
-
- toMap: function(array, getKey, scope) {
- var map = {},
- i = array.length;
- if (!getKey) {
- while (i--) {
- map[array[i]] = i+1;
- }
- } else if (typeof getKey == 'string') {
- while (i--) {
- map[array[i][getKey]] = i+1;
- }
- } else {
- while (i--) {
- map[getKey.call(scope, array[i])] = i+1;
- }
- }
- return map;
- },
-
- erase: erase,
-
- insert: function (array, index, items) {
- return replace(array, index, 0, items);
- },
-
- replace: replace,
-
- splice: splice,
-
- push: function(array) {
- var len = arguments.length,
- i = 1,
- newItem;
- if (array === undefined) {
- array = [];
- } else if (!Ext.isArray(array)) {
- array = [array];
- }
- for (; i < len; i++) {
- newItem = arguments[i];
- Array.prototype.push[Ext.isArray(newItem) ? 'apply' : 'call'](array, newItem);
- }
- return array;
- }
- };
-
- Ext.each = ExtArray.each;
-
- ExtArray.union = ExtArray.merge;
-
- Ext.min = ExtArray.min;
-
- Ext.max = ExtArray.max;
-
- Ext.sum = ExtArray.sum;
-
- Ext.mean = ExtArray.mean;
-
- Ext.flatten = ExtArray.flatten;
-
- Ext.clean = ExtArray.clean;
-
- Ext.unique = ExtArray.unique;
-
- Ext.pluck = ExtArray.pluck;
-
- Ext.toArray = function() {
- return ExtArray.toArray.apply(ExtArray, arguments);
- };
- }());
- //@tag foundation,core
- //@require Array.js
- Ext.Function = {
-
- flexSetter: function(fn) {
- return function(a, b) {
- var k, i;
- if (a === null) {
- return this;
- }
- if (typeof a !== 'string') {
- for (k in a) {
- if (a.hasOwnProperty(k)) {
- fn.call(this, k, a[k]);
- }
- }
- if (Ext.enumerables) {
- for (i = Ext.enumerables.length; i--;) {
- k = Ext.enumerables[i];
- if (a.hasOwnProperty(k)) {
- fn.call(this, k, a[k]);
- }
- }
- }
- } else {
- fn.call(this, a, b);
- }
- return this;
- };
- },
-
- bind: function(fn, scope, args, appendArgs) {
- if (arguments.length === 2) {
- return function() {
- return fn.apply(scope, arguments);
- };
- }
- var method = fn,
- slice = Array.prototype.slice;
- return function() {
- var callArgs = args || arguments;
- if (appendArgs === true) {
- callArgs = slice.call(arguments, 0);
- callArgs = callArgs.concat(args);
- }
- else if (typeof appendArgs == 'number') {
- callArgs = slice.call(arguments, 0);
- Ext.Array.insert(callArgs, appendArgs, args);
- }
- return method.apply(scope || Ext.global, callArgs);
- };
- },
-
- pass: function(fn, args, scope) {
- if (!Ext.isArray(args)) {
- if (Ext.isIterable(args)) {
- args = Ext.Array.clone(args);
- } else {
- args = args !== undefined ? [args] : [];
- }
- }
- return function() {
- var fnArgs = [].concat(args);
- fnArgs.push.apply(fnArgs, arguments);
- return fn.apply(scope || this, fnArgs);
- };
- },
-
- alias: function(object, methodName) {
- return function() {
- return object[methodName].apply(object, arguments);
- };
- },
-
- clone: function(method) {
- return function() {
- return method.apply(this, arguments);
- };
- },
-
- createInterceptor: function(origFn, newFn, scope, returnValue) {
- var method = origFn;
- if (!Ext.isFunction(newFn)) {
- return origFn;
- }
- else {
- return function() {
- var me = this,
- args = arguments;
- newFn.target = me;
- newFn.method = origFn;
- return (newFn.apply(scope || me || Ext.global, args) !== false) ? origFn.apply(me || Ext.global, args) : returnValue || null;
- };
- }
- },
-
- createDelayed: function(fn, delay, scope, args, appendArgs) {
- if (scope || args) {
- fn = Ext.Function.bind(fn, scope, args, appendArgs);
- }
- return function() {
- var me = this,
- args = Array.prototype.slice.call(arguments);
- setTimeout(function() {
- fn.apply(me, args);
- }, delay);
- };
- },
-
- defer: function(fn, millis, scope, args, appendArgs) {
- fn = Ext.Function.bind(fn, scope, args, appendArgs);
- if (millis > 0) {
- return setTimeout(Ext.supports.TimeoutActualLateness ? function () {
- fn();
- } : fn, millis);
- }
- fn();
- return 0;
- },
-
- createSequence: function(originalFn, newFn, scope) {
- if (!newFn) {
- return originalFn;
- }
- else {
- return function() {
- var result = originalFn.apply(this, arguments);
- newFn.apply(scope || this, arguments);
- return result;
- };
- }
- },
-
- createBuffered: function(fn, buffer, scope, args) {
- var timerId;
- return function() {
- var callArgs = args || Array.prototype.slice.call(arguments, 0),
- me = scope || this;
- if (timerId) {
- clearTimeout(timerId);
- }
- timerId = setTimeout(function(){
- fn.apply(me, callArgs);
- }, buffer);
- };
- },
-
- createThrottled: function(fn, interval, scope) {
- var lastCallTime, elapsed, lastArgs, timer, execute = function() {
- fn.apply(scope || this, lastArgs);
- lastCallTime = new Date().getTime();
- };
- return function() {
- elapsed = new Date().getTime() - lastCallTime;
- lastArgs = arguments;
- clearTimeout(timer);
- if (!lastCallTime || (elapsed >= interval)) {
- execute();
- } else {
- timer = setTimeout(execute, interval - elapsed);
- }
- };
- },
-
- interceptBefore: function(object, methodName, fn, scope) {
- var method = object[methodName] || Ext.emptyFn;
- return (object[methodName] = function() {
- var ret = fn.apply(scope || this, arguments);
- method.apply(this, arguments);
- return ret;
- });
- },
-
- interceptAfter: function(object, methodName, fn, scope) {
- var method = object[methodName] || Ext.emptyFn;
- return (object[methodName] = function() {
- method.apply(this, arguments);
- return fn.apply(scope || this, arguments);
- });
- }
- };
- Ext.defer = Ext.Function.alias(Ext.Function, 'defer');
- Ext.pass = Ext.Function.alias(Ext.Function, 'pass');
- Ext.bind = Ext.Function.alias(Ext.Function, 'bind');
- //@tag foundation,core
- //@require Function.js
- (function() {
- var TemplateClass = function(){},
- ExtObject = Ext.Object = {
-
- chain: function (object) {
- TemplateClass.prototype = object;
- var result = new TemplateClass();
- TemplateClass.prototype = null;
- return result;
- },
-
- toQueryObjects: function(name, value, recursive) {
- var self = ExtObject.toQueryObjects,
- objects = [],
- i, ln;
- if (Ext.isArray(value)) {
- for (i = 0, ln = value.length; i < ln; i++) {
- if (recursive) {
- objects = objects.concat(self(name + '[' + i + ']', value[i], true));
- }
- else {
- objects.push({
- name: name,
- value: value[i]
- });
- }
- }
- }
- else if (Ext.isObject(value)) {
- for (i in value) {
- if (value.hasOwnProperty(i)) {
- if (recursive) {
- objects = objects.concat(self(name + '[' + i + ']', value[i], true));
- }
- else {
- objects.push({
- name: name,
- value: value[i]
- });
- }
- }
- }
- }
- else {
- objects.push({
- name: name,
- value: value
- });
- }
- return objects;
- },
-
- toQueryString: function(object, recursive) {
- var paramObjects = [],
- params = [],
- i, j, ln, paramObject, value;
- for (i in object) {
- if (object.hasOwnProperty(i)) {
- paramObjects = paramObjects.concat(ExtObject.toQueryObjects(i, object[i], recursive));
- }
- }
- for (j = 0, ln = paramObjects.length; j < ln; j++) {
- paramObject = paramObjects[j];
- value = paramObject.value;
- if (Ext.isEmpty(value)) {
- value = '';
- }
- else if (Ext.isDate(value)) {
- value = Ext.Date.toString(value);
- }
- params.push(encodeURIComponent(paramObject.name) + '=' + encodeURIComponent(String(value)));
- }
- return params.join('&');
- },
-
- fromQueryString: function(queryString, recursive) {
- var parts = queryString.replace(/^\?/, '').split('&'),
- object = {},
- temp, components, name, value, i, ln,
- part, j, subLn, matchedKeys, matchedName,
- keys, key, nextKey;
- for (i = 0, ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (part.length > 0) {
- components = part.split('=');
- name = decodeURIComponent(components[0]);
- value = (components[1] !== undefined) ? decodeURIComponent(components[1]) : '';
- if (!recursive) {
- if (object.hasOwnProperty(name)) {
- if (!Ext.isArray(object[name])) {
- object[name] = [object[name]];
- }
- object[name].push(value);
- }
- else {
- object[name] = value;
- }
- }
- else {
- matchedKeys = name.match(/(\[):?([^\]]*)\]/g);
- matchedName = name.match(/^([^\[]+)/);
- name = matchedName[0];
- keys = [];
- if (matchedKeys === null) {
- object[name] = value;
- continue;
- }
- for (j = 0, subLn = matchedKeys.length; j < subLn; j++) {
- key = matchedKeys[j];
- key = (key.length === 2) ? '' : key.substring(1, key.length - 1);
- keys.push(key);
- }
- keys.unshift(name);
- temp = object;
- for (j = 0, subLn = keys.length; j < subLn; j++) {
- key = keys[j];
- if (j === subLn - 1) {
- if (Ext.isArray(temp) && key === '') {
- temp.push(value);
- }
- else {
- temp[key] = value;
- }
- }
- else {
- if (temp[key] === undefined || typeof temp[key] === 'string') {
- nextKey = keys[j+1];
- temp[key] = (Ext.isNumeric(nextKey) || nextKey === '') ? [] : {};
- }
- temp = temp[key];
- }
- }
- }
- }
- }
- return object;
- },
-
- each: function(object, fn, scope) {
- for (var property in object) {
- if (object.hasOwnProperty(property)) {
- if (fn.call(scope || object, property, object[property], object) === false) {
- return;
- }
- }
- }
- },
-
- merge: function(destination) {
- var i = 1,
- ln = arguments.length,
- mergeFn = ExtObject.merge,
- cloneFn = Ext.clone,
- object, key, value, sourceKey;
- for (; i < ln; i++) {
- object = arguments[i];
- for (key in object) {
- value = object[key];
- if (value && value.constructor === Object) {
- sourceKey = destination[key];
- if (sourceKey && sourceKey.constructor === Object) {
- mergeFn(sourceKey, value);
- }
- else {
- destination[key] = cloneFn(value);
- }
- }
- else {
- destination[key] = value;
- }
- }
- }
- return destination;
- },
-
- mergeIf: function(destination) {
- var i = 1,
- ln = arguments.length,
- cloneFn = Ext.clone,
- object, key, value;
- for (; i < ln; i++) {
- object = arguments[i];
- for (key in object) {
- if (!(key in destination)) {
- value = object[key];
- if (value && value.constructor === Object) {
- destination[key] = cloneFn(value);
- }
- else {
- destination[key] = value;
- }
- }
- }
- }
- return destination;
- },
-
- getKey: function(object, value) {
- for (var property in object) {
- if (object.hasOwnProperty(property) && object[property] === value) {
- return property;
- }
- }
- return null;
- },
-
- getValues: function(object) {
- var values = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- values.push(object[property]);
- }
- }
- return values;
- },
-
- getKeys: (typeof Object.keys == 'function')
- ? function(object){
- if (!object) {
- return [];
- }
- return Object.keys(object);
- }
- : function(object) {
- var keys = [],
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- keys.push(property);
- }
- }
- return keys;
- },
-
- getSize: function(object) {
- var size = 0,
- property;
- for (property in object) {
- if (object.hasOwnProperty(property)) {
- size++;
- }
- }
- return size;
- },
-
- classify: function(object) {
- var prototype = object,
- objectProperties = [],
- propertyClassesMap = {},
- objectClass = function() {
- var i = 0,
- ln = objectProperties.length,
- property;
- for (; i < ln; i++) {
- property = objectProperties[i];
- this[property] = new propertyClassesMap[property]();
- }
- },
- key, value;
- for (key in object) {
- if (object.hasOwnProperty(key)) {
- value = object[key];
- if (value && value.constructor === Object) {
- objectProperties.push(key);
- propertyClassesMap[key] = ExtObject.classify(value);
- }
- }
- }
- objectClass.prototype = prototype;
- return objectClass;
- }
- };
- Ext.merge = Ext.Object.merge;
- Ext.mergeIf = Ext.Object.mergeIf;
- Ext.urlEncode = function() {
- var args = Ext.Array.from(arguments),
- prefix = '';
-
- if ((typeof args[1] === 'string')) {
- prefix = args[1] + '&';
- args[1] = false;
- }
- return prefix + ExtObject.toQueryString.apply(ExtObject, args);
- };
- Ext.urlDecode = function() {
- return ExtObject.fromQueryString.apply(ExtObject, arguments);
- };
- }());
- //@tag foundation,core
- //@require Object.js
- //@define Ext.Date
- (function() {
- function xf(format) {
- var args = Array.prototype.slice.call(arguments, 1);
- return format.replace(/\{(\d+)\}/g, function(m, i) {
- return args[i];
- });
- }
- Ext.Date = {
-
- now: Date.now || function() {
- return +new Date();
- },
-
- toString: function(date) {
- var pad = Ext.String.leftPad;
- return date.getFullYear() + "-"
- + pad(date.getMonth() + 1, 2, '0') + "-"
- + pad(date.getDate(), 2, '0') + "T"
- + pad(date.getHours(), 2, '0') + ":"
- + pad(date.getMinutes(), 2, '0') + ":"
- + pad(date.getSeconds(), 2, '0');
- },
-
- getElapsed: function(dateA, dateB) {
- return Math.abs(dateA - (dateB || new Date()));
- },
-
- useStrict: false,
-
- formatCodeToRegex: function(character, currentGroup) {
-
- var p = utilDate.parseCodes[character];
- if (p) {
- p = typeof p == 'function'? p() : p;
- utilDate.parseCodes[character] = p;
- }
- return p ? Ext.applyIf({
- c: p.c ? xf(p.c, currentGroup || "{0}") : p.c
- }, p) : {
- g: 0,
- c: null,
- s: Ext.String.escapeRegex(character)
- };
- },
-
- parseFunctions: {
- "MS": function(input, strict) {
-
-
- var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/'),
- r = (input || '').match(re);
- return r? new Date(((r[1] || '') + r[2]) * 1) : null;
- }
- },
- parseRegexes: [],
-
- formatFunctions: {
- "MS": function() {
-
- return '\\/Date(' + this.getTime() + ')\\/';
- }
- },
- y2kYear : 50,
-
- MILLI : "ms",
-
- SECOND : "s",
-
- MINUTE : "mi",
-
- HOUR : "h",
-
- DAY : "d",
-
- MONTH : "mo",
-
- YEAR : "y",
-
- defaults: {},
-
-
- dayNames : [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- ],
-
-
-
- monthNames : [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December"
- ],
-
-
-
- monthNumbers : {
- January: 0,
- Jan: 0,
- February: 1,
- Feb: 1,
- March: 2,
- Mar: 2,
- April: 3,
- Apr: 3,
- May: 4,
- June: 5,
- Jun: 5,
- July: 6,
- Jul: 6,
- August: 7,
- Aug: 7,
- September: 8,
- Sep: 8,
- October: 9,
- Oct: 9,
- November: 10,
- Nov: 10,
- December: 11,
- Dec: 11
- },
-
-
-
-
- defaultFormat : "m/d/Y",
-
-
-
- getShortMonthName : function(month) {
- return Ext.Date.monthNames[month].substring(0, 3);
- },
-
-
-
- getShortDayName : function(day) {
- return Ext.Date.dayNames[day].substring(0, 3);
- },
-
-
-
- getMonthNumber : function(name) {
-
- return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
- },
-
-
- formatContainsHourInfo : (function(){
- var stripEscapeRe = /(\\.)/g,
- hourInfoRe = /([gGhHisucUOPZ]|MS)/;
- return function(format){
- return hourInfoRe.test(format.replace(stripEscapeRe, ''));
- };
- }()),
-
- formatContainsDateInfo : (function(){
- var stripEscapeRe = /(\\.)/g,
- dateInfoRe = /([djzmnYycU]|MS)/;
- return function(format){
- return dateInfoRe.test(format.replace(stripEscapeRe, ''));
- };
- }()),
-
-
- unescapeFormat: (function() {
- var slashRe = /\\/gi;
- return function(format) {
-
-
-
- return format.replace(slashRe, '');
- }
- }()),
-
- formatCodes : {
- d: "Ext.String.leftPad(this.getDate(), 2, '0')",
- D: "Ext.Date.getShortDayName(this.getDay())",
- j: "this.getDate()",
- l: "Ext.Date.dayNames[this.getDay()]",
- N: "(this.getDay() ? this.getDay() : 7)",
- S: "Ext.Date.getSuffix(this)",
- w: "this.getDay()",
- z: "Ext.Date.getDayOfYear(this)",
- W: "Ext.String.leftPad(Ext.Date.getWeekOfYear(this), 2, '0')",
- F: "Ext.Date.monthNames[this.getMonth()]",
- m: "Ext.String.leftPad(this.getMonth() + 1, 2, '0')",
- M: "Ext.Date.getShortMonthName(this.getMonth())",
- n: "(this.getMonth() + 1)",
- t: "Ext.Date.getDaysInMonth(this)",
- L: "(Ext.Date.isLeapYear(this) ? 1 : 0)",
- o: "(this.getFullYear() + (Ext.Date.getWeekOfYear(this) == 1 && this.getMonth() > 0 ? +1 : (Ext.Date.getWeekOfYear(this) >= 52 && this.getMonth() < 11 ? -1 : 0)))",
- Y: "Ext.String.leftPad(this.getFullYear(), 4, '0')",
- y: "('' + this.getFullYear()).substring(2, 4)",
- a: "(this.getHours() < 12 ? 'am' : 'pm')",
- A: "(this.getHours() < 12 ? 'AM' : 'PM')",
- g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
- G: "this.getHours()",
- h: "Ext.String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
- H: "Ext.String.leftPad(this.getHours(), 2, '0')",
- i: "Ext.String.leftPad(this.getMinutes(), 2, '0')",
- s: "Ext.String.leftPad(this.getSeconds(), 2, '0')",
- u: "Ext.String.leftPad(this.getMilliseconds(), 3, '0')",
- O: "Ext.Date.getGMTOffset(this)",
- P: "Ext.Date.getGMTOffset(this, true)",
- T: "Ext.Date.getTimezone(this)",
- Z: "(this.getTimezoneOffset() * -60)",
- c: function() {
- var c, code, i, l, e;
- for (c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
- e = c.charAt(i);
- code.push(e == "T" ? "'T'" : utilDate.getFormatCode(e));
- }
- return code.join(" + ");
- },
-
- U: "Math.round(this.getTime() / 1000)"
- },
-
- isValid : function(y, m, d, h, i, s, ms) {
-
- h = h || 0;
- i = i || 0;
- s = s || 0;
- ms = ms || 0;
-
- var dt = utilDate.add(new Date(y < 100 ? 100 : y, m - 1, d, h, i, s, ms), utilDate.YEAR, y < 100 ? y - 100 : 0);
- return y == dt.getFullYear() &&
- m == dt.getMonth() + 1 &&
- d == dt.getDate() &&
- h == dt.getHours() &&
- i == dt.getMinutes() &&
- s == dt.getSeconds() &&
- ms == dt.getMilliseconds();
- },
-
- parse : function(input, format, strict) {
- var p = utilDate.parseFunctions;
- if (p[format] == null) {
- utilDate.createParser(format);
- }
- return p[format](input, Ext.isDefined(strict) ? strict : utilDate.useStrict);
- },
-
- parseDate: function(input, format, strict){
- return utilDate.parse(input, format, strict);
- },
-
- getFormatCode : function(character) {
- var f = utilDate.formatCodes[character];
- if (f) {
- f = typeof f == 'function'? f() : f;
- utilDate.formatCodes[character] = f;
- }
-
- return f || ("'" + Ext.String.escape(character) + "'");
- },
-
- createFormat : function(format) {
- var code = [],
- special = false,
- ch = '',
- i;
- for (i = 0; i < format.length; ++i) {
- ch = format.charAt(i);
- if (!special && ch == "\\") {
- special = true;
- } else if (special) {
- special = false;
- code.push("'" + Ext.String.escape(ch) + "'");
- } else {
- code.push(utilDate.getFormatCode(ch));
- }
- }
- utilDate.formatFunctions[format] = Ext.functionFactory("return " + code.join('+'));
- },
-
- createParser : (function() {
- var code = [
- "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
- "def = Ext.Date.defaults,",
- "results = String(input).match(Ext.Date.parseRegexes[{0}]);",
- "if(results){",
- "{1}",
- "if(u != null){",
- "v = new Date(u * 1000);",
- "}else{",
-
-
-
- "dt = Ext.Date.clearTime(new Date);",
-
- "y = Ext.Number.from(y, Ext.Number.from(def.y, dt.getFullYear()));",
- "m = Ext.Number.from(m, Ext.Number.from(def.m - 1, dt.getMonth()));",
- "d = Ext.Number.from(d, Ext.Number.from(def.d, dt.getDate()));",
-
- "h = Ext.Number.from(h, Ext.Number.from(def.h, dt.getHours()));",
- "i = Ext.Number.from(i, Ext.Number.from(def.i, dt.getMinutes()));",
- "s = Ext.Number.from(s, Ext.Number.from(def.s, dt.getSeconds()));",
- "ms = Ext.Number.from(ms, Ext.Number.from(def.ms, dt.getMilliseconds()));",
- "if(z >= 0 && y >= 0){",
-
-
-
-
- "v = Ext.Date.add(new Date(y < 100 ? 100 : y, 0, 1, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
-
- "v = !strict? v : (strict === true && (z <= 364 || (Ext.Date.isLeapYear(v) && z <= 365))? Ext.Date.add(v, Ext.Date.DAY, z) : null);",
- "}else if(strict === true && !Ext.Date.isValid(y, m + 1, d, h, i, s, ms)){",
- "v = null;",
- "}else{",
-
-
- "v = Ext.Date.add(new Date(y < 100 ? 100 : y, m, d, h, i, s, ms), Ext.Date.YEAR, y < 100 ? y - 100 : 0);",
- "}",
- "}",
- "}",
- "if(v){",
-
- "if(zz != null){",
-
- "v = Ext.Date.add(v, Ext.Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
- "}else if(o){",
-
- "v = Ext.Date.add(v, Ext.Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
- "}",
- "}",
- "return v;"
- ].join('\n');
- return function(format) {
- var regexNum = utilDate.parseRegexes.length,
- currentGroup = 1,
- calc = [],
- regex = [],
- special = false,
- ch = "",
- i = 0,
- len = format.length,
- atEnd = [],
- obj;
- for (; i < len; ++i) {
- ch = format.charAt(i);
- if (!special && ch == "\\") {
- special = true;
- } else if (special) {
- special = false;
- regex.push(Ext.String.escape(ch));
- } else {
- obj = utilDate.formatCodeToRegex(ch, currentGroup);
- currentGroup += obj.g;
- regex.push(obj.s);
- if (obj.g && obj.c) {
- if (obj.calcAtEnd) {
- atEnd.push(obj.c);
- } else {
- calc.push(obj.c);
- }
- }
- }
- }
-
- calc = calc.concat(atEnd);
- utilDate.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", 'i');
- utilDate.parseFunctions[format] = Ext.functionFactory("input", "strict", xf(code, regexNum, calc.join('')));
- };
- }()),
-
- parseCodes : {
-
- d: {
- g:1,
- c:"d = parseInt(results[{0}], 10);\n",
- s:"(3[0-1]|[1-2][0-9]|0[1-9])"
- },
- j: {
- g:1,
- c:"d = parseInt(results[{0}], 10);\n",
- s:"(3[0-1]|[1-2][0-9]|[1-9])"
- },
- D: function() {
- for (var a = [], i = 0; i < 7; a.push(utilDate.getShortDayName(i)), ++i);
- return {
- g:0,
- c:null,
- s:"(?:" + a.join("|") +")"
- };
- },
- l: function() {
- return {
- g:0,
- c:null,
- s:"(?:" + utilDate.dayNames.join("|") + ")"
- };
- },
- N: {
- g:0,
- c:null,
- s:"[1-7]"
- },
-
- S: {
- g:0,
- c:null,
- s:"(?:st|nd|rd|th)"
- },
-
- w: {
- g:0,
- c:null,
- s:"[0-6]"
- },
- z: {
- g:1,
- c:"z = parseInt(results[{0}], 10);\n",
- s:"(\\d{1,3})"
- },
- W: {
- g:0,
- c:null,
- s:"(?:\\d{2})"
- },
- F: function() {
- return {
- g:1,
- c:"m = parseInt(Ext.Date.getMonthNumber(results[{0}]), 10);\n",
- s:"(" + utilDate.monthNames.join("|") + ")"
- };
- },
- M: function() {
- for (var a = [], i = 0; i < 12; a.push(utilDate.getShortMonthName(i)), ++i);
- return Ext.applyIf({
- s:"(" + a.join("|") + ")"
- }, utilDate.formatCodeToRegex("F"));
- },
- m: {
- g:1,
- c:"m = parseInt(results[{0}], 10) - 1;\n",
- s:"(1[0-2]|0[1-9])"
- },
- n: {
- g:1,
- c:"m = parseInt(results[{0}], 10) - 1;\n",
- s:"(1[0-2]|[1-9])"
- },
- t: {
- g:0,
- c:null,
- s:"(?:\\d{2})"
- },
- L: {
- g:0,
- c:null,
- s:"(?:1|0)"
- },
- o: function() {
- return utilDate.formatCodeToRegex("Y");
- },
- Y: {
- g:1,
- c:"y = parseInt(results[{0}], 10);\n",
- s:"(\\d{4})"
- },
- y: {
- g:1,
- c:"var ty = parseInt(results[{0}], 10);\n"
- + "y = ty > Ext.Date.y2kYear ? 1900 + ty : 2000 + ty;\n",
- s:"(\\d{1,2})"
- },
-
-
- a: {
- g:1,
- c:"if (/(am)/i.test(results[{0}])) {\n"
- + "if (!h || h == 12) { h = 0; }\n"
- + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
- s:"(am|pm|AM|PM)",
- calcAtEnd: true
- },
-
-
- A: {
- g:1,
- c:"if (/(am)/i.test(results[{0}])) {\n"
- + "if (!h || h == 12) { h = 0; }\n"
- + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
- s:"(AM|PM|am|pm)",
- calcAtEnd: true
- },
-
- g: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(1[0-2]|[0-9])"
- },
- G: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(2[0-3]|1[0-9]|[0-9])"
- },
- h: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(1[0-2]|0[1-9])"
- },
- H: {
- g:1,
- c:"h = parseInt(results[{0}], 10);\n",
- s:"(2[0-3]|[0-1][0-9])"
- },
- i: {
- g:1,
- c:"i = parseInt(results[{0}], 10);\n",
- s:"([0-5][0-9])"
- },
- s: {
- g:1,
- c:"s = parseInt(results[{0}], 10);\n",
- s:"([0-5][0-9])"
- },
- u: {
- g:1,
- c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
- s:"(\\d+)"
- },
- O: {
- g:1,
- c:[
- "o = results[{0}];",
- "var sn = o.substring(0,1),",
- "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),",
- "mn = o.substring(3,5) % 60;",
- "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"
- ].join("\n"),
- s: "([+-]\\d{4})"
- },
- P: {
- g:1,
- c:[
- "o = results[{0}];",
- "var sn = o.substring(0,1),",
- "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),",
- "mn = o.substring(4,6) % 60;",
- "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"
- ].join("\n"),
- s: "([+-]\\d{2}:\\d{2})"
- },
- T: {
- g:0,
- c:null,
- s:"[A-Z]{1,4}"
- },
- Z: {
- g:1,
- c:"zz = results[{0}] * 1;\n"
- + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
- s:"([+-]?\\d{1,5})"
- },
- c: function() {
- var calc = [],
- arr = [
- utilDate.formatCodeToRegex("Y", 1),
- utilDate.formatCodeToRegex("m", 2),
- utilDate.formatCodeToRegex("d", 3),
- utilDate.formatCodeToRegex("H", 4),
- utilDate.formatCodeToRegex("i", 5),
- utilDate.formatCodeToRegex("s", 6),
- {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"},
- {c:[
- "if(results[8]) {",
- "if(results[8] == 'Z'){",
- "zz = 0;",
- "}else if (results[8].indexOf(':') > -1){",
- utilDate.formatCodeToRegex("P", 8).c,
- "}else{",
- utilDate.formatCodeToRegex("O", 8).c,
- "}",
- "}"
- ].join('\n')}
- ],
- i,
- l;
- for (i = 0, l = arr.length; i < l; ++i) {
- calc.push(arr[i].c);
- }
- return {
- g:1,
- c:calc.join(""),
- s:[
- arr[0].s,
- "(?:", "-", arr[1].s,
- "(?:", "-", arr[2].s,
- "(?:",
- "(?:T| )?",
- arr[3].s, ":", arr[4].s,
- "(?::", arr[5].s, ")?",
- "(?:(?:\\.|,)(\\d+))?",
- "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?",
- ")?",
- ")?",
- ")?"
- ].join("")
- };
- },
- U: {
- g:1,
- c:"u = parseInt(results[{0}], 10);\n",
- s:"(-?\\d+)"
- }
- },
-
-
- dateFormat: function(date, format) {
- return utilDate.format(date, format);
- },
-
- isEqual: function(date1, date2) {
-
- if (date1 && date2) {
- return (date1.getTime() === date2.getTime());
- }
-
- return !(date1 || date2);
- },
-
- format: function(date, format) {
- var formatFunctions = utilDate.formatFunctions;
- if (!Ext.isDate(date)) {
- return '';
- }
- if (formatFunctions[format] == null) {
- utilDate.createFormat(format);
- }
- return formatFunctions[format].call(date) + '';
- },
-
- getTimezone : function(date) {
-
-
-
-
-
-
-
-
-
-
-
-
- return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
- },
-
- getGMTOffset : function(date, colon) {
- var offset = date.getTimezoneOffset();
- return (offset > 0 ? "-" : "+")
- + Ext.String.leftPad(Math.floor(Math.abs(offset) / 60), 2, "0")
- + (colon ? ":" : "")
- + Ext.String.leftPad(Math.abs(offset % 60), 2, "0");
- },
-
- getDayOfYear: function(date) {
- var num = 0,
- d = Ext.Date.clone(date),
- m = date.getMonth(),
- i;
- for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
- num += utilDate.getDaysInMonth(d);
- }
- return num + date.getDate() - 1;
- },
-
- getWeekOfYear : (function() {
-
- var ms1d = 864e5,
- ms7d = 7 * ms1d;
- return function(date) {
- var DC3 = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate() + 3) / ms1d,
- AWN = Math.floor(DC3 / 7),
- Wyr = new Date(AWN * ms7d).getUTCFullYear();
- return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
- };
- }()),
-
- isLeapYear : function(date) {
- var year = date.getFullYear();
- return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
- },
-
- getFirstDayOfMonth : function(date) {
- var day = (date.getDay() - (date.getDate() - 1)) % 7;
- return (day < 0) ? (day + 7) : day;
- },
-
- getLastDayOfMonth : function(date) {
- return utilDate.getLastDateOfMonth(date).getDay();
- },
-
- getFirstDateOfMonth : function(date) {
- return new Date(date.getFullYear(), date.getMonth(), 1);
- },
-
- getLastDateOfMonth : function(date) {
- return new Date(date.getFullYear(), date.getMonth(), utilDate.getDaysInMonth(date));
- },
-
- getDaysInMonth: (function() {
- var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
- return function(date) {
- var m = date.getMonth();
- return m == 1 && utilDate.isLeapYear(date) ? 29 : daysInMonth[m];
- };
- }()),
-
-
- getSuffix : function(date) {
- switch (date.getDate()) {
- case 1:
- case 21:
- case 31:
- return "st";
- case 2:
- case 22:
- return "nd";
- case 3:
- case 23:
- return "rd";
- default:
- return "th";
- }
- },
-
-
- clone : function(date) {
- return new Date(date.getTime());
- },
-
- isDST : function(date) {
-
-
- return new Date(date.getFullYear(), 0, 1).getTimezoneOffset() != date.getTimezoneOffset();
- },
-
- clearTime : function(date, clone) {
- if (clone) {
- return Ext.Date.clearTime(Ext.Date.clone(date));
- }
-
- var d = date.getDate(),
- hr,
- c;
-
- date.setHours(0);
- date.setMinutes(0);
- date.setSeconds(0);
- date.setMilliseconds(0);
- if (date.getDate() != d) {
-
-
-
- for (hr = 1, c = utilDate.add(date, Ext.Date.HOUR, hr); c.getDate() != d; hr++, c = utilDate.add(date, Ext.Date.HOUR, hr));
- date.setDate(d);
- date.setHours(c.getHours());
- }
- return date;
- },
-
- add : function(date, interval, value) {
- var d = Ext.Date.clone(date),
- Date = Ext.Date,
- day;
- if (!interval || value === 0) {
- return d;
- }
- switch(interval.toLowerCase()) {
- case Ext.Date.MILLI:
- d.setMilliseconds(d.getMilliseconds() + value);
- break;
- case Ext.Date.SECOND:
- d.setSeconds(d.getSeconds() + value);
- break;
- case Ext.Date.MINUTE:
- d.setMinutes(d.getMinutes() + value);
- break;
- case Ext.Date.HOUR:
- d.setHours(d.getHours() + value);
- break;
- case Ext.Date.DAY:
- d.setDate(d.getDate() + value);
- break;
- case Ext.Date.MONTH:
- day = date.getDate();
- if (day > 28) {
- day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.MONTH, value)).getDate());
- }
- d.setDate(day);
- d.setMonth(date.getMonth() + value);
- break;
- case Ext.Date.YEAR:
- day = date.getDate();
- if (day > 28) {
- day = Math.min(day, Ext.Date.getLastDateOfMonth(Ext.Date.add(Ext.Date.getFirstDateOfMonth(date), Ext.Date.YEAR, value)).getDate());
- }
- d.setDate(day);
- d.setFullYear(date.getFullYear() + value);
- break;
- }
- return d;
- },
-
- between : function(date, start, end) {
- var t = date.getTime();
- return start.getTime() <= t && t <= end.getTime();
- },
-
- compat: function() {
- var nativeDate = window.Date,
- p, u,
- 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'],
- proto = ['dateFormat', 'format', 'getTimezone', 'getGMTOffset', 'getDayOfYear', 'getWeekOfYear', 'isLeapYear', 'getFirstDayOfMonth', 'getLastDayOfMonth', 'getDaysInMonth', 'getSuffix', 'clone', 'isDST', 'clearTime', 'add', 'between'],
- sLen = statics.length,
- pLen = proto.length,
- stat, prot, s;
-
- for (s = 0; s < sLen; s++) {
- stat = statics[s];
- nativeDate[stat] = utilDate[stat];
- }
-
- for (p = 0; p < pLen; p++) {
- prot = proto[p];
- nativeDate.prototype[prot] = function() {
- var args = Array.prototype.slice.call(arguments);
- args.unshift(this);
- return utilDate[prot].apply(utilDate, args);
- };
- }
- }
- };
- var utilDate = Ext.Date;
- }());
- //@tag foundation,core
- //@require ../lang/Date.js
- (function(flexSetter) {
- var noArgs = [],
- Base = function(){};
-
- Ext.apply(Base, {
- $className: 'Ext.Base',
- $isClass: true,
-
- create: function() {
- return Ext.create.apply(Ext, [this].concat(Array.prototype.slice.call(arguments, 0)));
- },
-
- extend: function(parent) {
- var parentPrototype = parent.prototype,
- basePrototype, prototype, i, ln, name, statics;
- prototype = this.prototype = Ext.Object.chain(parentPrototype);
- prototype.self = this;
- this.superclass = prototype.superclass = parentPrototype;
- if (!parent.$isClass) {
- basePrototype = Ext.Base.prototype;
- for (i in basePrototype) {
- if (i in prototype) {
- prototype[i] = basePrototype[i];
- }
- }
- }
-
- statics = parentPrototype.$inheritableStatics;
- if (statics) {
- for (i = 0,ln = statics.length; i < ln; i++) {
- name = statics[i];
- if (!this.hasOwnProperty(name)) {
- this[name] = parent[name];
- }
- }
- }
- if (parent.$onExtended) {
- this.$onExtended = parent.$onExtended.slice();
- }
- prototype.config = new prototype.configClass();
- prototype.initConfigList = prototype.initConfigList.slice();
- prototype.initConfigMap = Ext.clone(prototype.initConfigMap);
- prototype.configMap = Ext.Object.chain(prototype.configMap);
- },
-
- $onExtended: [],
-
- triggerExtended: function() {
- var callbacks = this.$onExtended,
- ln = callbacks.length,
- i, callback;
- if (ln > 0) {
- for (i = 0; i < ln; i++) {
- callback = callbacks[i];
- callback.fn.apply(callback.scope || this, arguments);
- }
- }
- },
-
- onExtended: function(fn, scope) {
- this.$onExtended.push({
- fn: fn,
- scope: scope
- });
- return this;
- },
-
- addConfig: function(config, fullMerge) {
- var prototype = this.prototype,
- configNameCache = Ext.Class.configNameCache,
- hasConfig = prototype.configMap,
- initConfigList = prototype.initConfigList,
- initConfigMap = prototype.initConfigMap,
- defaultConfig = prototype.config,
- initializedName, name, value;
- for (name in config) {
- if (config.hasOwnProperty(name)) {
- if (!hasConfig[name]) {
- hasConfig[name] = true;
- }
- value = config[name];
- initializedName = configNameCache[name].initialized;
- if (!initConfigMap[name] && value !== null && !prototype[initializedName]) {
- initConfigMap[name] = true;
- initConfigList.push(name);
- }
- }
- }
- if (fullMerge) {
- Ext.merge(defaultConfig, config);
- }
- else {
- Ext.mergeIf(defaultConfig, config);
- }
- prototype.configClass = Ext.Object.classify(defaultConfig);
- },
-
- addStatics: function(members) {
- var member, name;
- for (name in members) {
- if (members.hasOwnProperty(name)) {
- member = members[name];
- if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn && member !== Ext.identityFn) {
- member.$owner = this;
- member.$name = name;
- }
- this[name] = member;
- }
- }
- return this;
- },
-
- addInheritableStatics: function(members) {
- var inheritableStatics,
- hasInheritableStatics,
- prototype = this.prototype,
- name, member;
- inheritableStatics = prototype.$inheritableStatics;
- hasInheritableStatics = prototype.$hasInheritableStatics;
- if (!inheritableStatics) {
- inheritableStatics = prototype.$inheritableStatics = [];
- hasInheritableStatics = prototype.$hasInheritableStatics = {};
- }
- for (name in members) {
- if (members.hasOwnProperty(name)) {
- member = members[name];
- this[name] = member;
- if (!hasInheritableStatics[name]) {
- hasInheritableStatics[name] = true;
- inheritableStatics.push(name);
- }
- }
- }
- return this;
- },
-
- addMembers: function(members) {
- var prototype = this.prototype,
- enumerables = Ext.enumerables,
- names = [],
- i, ln, name, member;
- for (name in members) {
- names.push(name);
- }
- if (enumerables) {
- names.push.apply(names, enumerables);
- }
- for (i = 0,ln = names.length; i < ln; i++) {
- name = names[i];
- if (members.hasOwnProperty(name)) {
- member = members[name];
- if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
- member.$owner = this;
- member.$name = name;
- }
- prototype[name] = member;
- }
- }
- return this;
- },
-
- addMember: function(name, member) {
- if (typeof member == 'function' && !member.$isClass && member !== Ext.emptyFn) {
- member.$owner = this;
- member.$name = name;
- }
- this.prototype[name] = member;
- return this;
- },
-
- implement: function() {
- this.addMembers.apply(this, arguments);
- },
-
- borrow: function(fromClass, members) {
- var prototype = this.prototype,
- fromPrototype = fromClass.prototype,
- i, ln, name, fn, toBorrow;
- members = Ext.Array.from(members);
- for (i = 0,ln = members.length; i < ln; i++) {
- name = members[i];
- toBorrow = fromPrototype[name];
- if (typeof toBorrow == 'function') {
- fn = Ext.Function.clone(toBorrow);
- fn.$owner = this;
- fn.$name = name;
- prototype[name] = fn;
- }
- else {
- prototype[name] = toBorrow;
- }
- }
- return this;
- },
-
- override: function(members) {
- var me = this,
- enumerables = Ext.enumerables,
- target = me.prototype,
- cloneFunction = Ext.Function.clone,
- name, index, member, statics, names, previous;
- if (arguments.length === 2) {
- name = members;
- members = {};
- members[name] = arguments[1];
- enumerables = null;
- }
- do {
- names = [];
- statics = null;
- for (name in members) {
- if (name == 'statics') {
- statics = members[name];
- } else if (name == 'config') {
- me.addConfig(members[name], true);
- } else {
- names.push(name);
- }
- }
- if (enumerables) {
- names.push.apply(names, enumerables);
- }
- for (index = names.length; index--; ) {
- name = names[index];
- if (members.hasOwnProperty(name)) {
- member = members[name];
- if (typeof member == 'function' && !member.$className && member !== Ext.emptyFn) {
- if (typeof member.$owner != 'undefined') {
- member = cloneFunction(member);
- }
- member.$owner = me;
- member.$name = name;
- previous = target[name];
- if (previous) {
- member.$previous = previous;
- }
- }
- target[name] = member;
- }
- }
- target = me;
- members = statics;
- } while (members);
- return this;
- },
-
- callParent: function(args) {
- var method;
-
- return (method = this.callParent.caller) && (method.$previous ||
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass.self[method.$name])).apply(this, args || noArgs);
- },
-
- callSuper: function(args) {
- var method;
-
- return (method = this.callSuper.caller) &&
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass.self[method.$name]).apply(this, args || noArgs);
- },
-
- mixin: function(name, mixinClass) {
- var mixin = mixinClass.prototype,
- prototype = this.prototype,
- key;
- if (typeof mixin.onClassMixedIn != 'undefined') {
- mixin.onClassMixedIn.call(mixinClass, this);
- }
- if (!prototype.hasOwnProperty('mixins')) {
- if ('mixins' in prototype) {
- prototype.mixins = Ext.Object.chain(prototype.mixins);
- }
- else {
- prototype.mixins = {};
- }
- }
- for (key in mixin) {
- if (key === 'mixins') {
- Ext.merge(prototype.mixins, mixin[key]);
- }
- else if (typeof prototype[key] == 'undefined' && key != 'mixinId' && key != 'config') {
- prototype[key] = mixin[key];
- }
- }
- if ('config' in mixin) {
- this.addConfig(mixin.config, false);
- }
- prototype.mixins[name] = mixin;
- },
-
- getName: function() {
- return Ext.getClassName(this);
- },
-
- createAlias: flexSetter(function(alias, origin) {
- this.override(alias, function() {
- return this[origin].apply(this, arguments);
- });
- }),
-
- addXtype: function(xtype) {
- var prototype = this.prototype,
- xtypesMap = prototype.xtypesMap,
- xtypes = prototype.xtypes,
- xtypesChain = prototype.xtypesChain;
- if (!prototype.hasOwnProperty('xtypesMap')) {
- xtypesMap = prototype.xtypesMap = Ext.merge({}, prototype.xtypesMap || {});
- xtypes = prototype.xtypes = prototype.xtypes ? [].concat(prototype.xtypes) : [];
- xtypesChain = prototype.xtypesChain = prototype.xtypesChain ? [].concat(prototype.xtypesChain) : [];
- prototype.xtype = xtype;
- }
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypes.push(xtype);
- xtypesChain.push(xtype);
- Ext.ClassManager.setAlias(this, 'widget.' + xtype);
- }
- return this;
- }
- });
- Base.implement({
-
- isInstance: true,
-
- $className: 'Ext.Base',
-
- configClass: Ext.emptyFn,
-
- initConfigList: [],
-
- configMap: {},
-
- initConfigMap: {},
-
- statics: function() {
- var method = this.statics.caller,
- self = this.self;
- if (!method) {
- return self;
- }
- return method.$owner;
- },
-
- callParent: function(args) {
-
-
-
-
- var method,
- superMethod = (method = this.callParent.caller) && (method.$previous ||
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass[method.$name]));
- return superMethod.apply(this, args || noArgs);
- },
-
- callSuper: function(args) {
-
-
-
-
- var method,
- superMethod = (method = this.callSuper.caller) &&
- ((method = method.$owner ? method : method.caller) &&
- method.$owner.superclass[method.$name]);
- return superMethod.apply(this, args || noArgs);
- },
-
- self: Base,
-
- constructor: function() {
- return this;
- },
-
- initConfig: function(config) {
- var instanceConfig = config,
- configNameCache = Ext.Class.configNameCache,
- defaultConfig = new this.configClass(),
- defaultConfigList = this.initConfigList,
- hasConfig = this.configMap,
- nameMap, i, ln, name, initializedName;
- this.initConfig = Ext.emptyFn;
- this.initialConfig = instanceConfig || {};
- this.config = config = (instanceConfig) ? Ext.merge(defaultConfig, config) : defaultConfig;
- if (instanceConfig) {
- defaultConfigList = defaultConfigList.slice();
- for (name in instanceConfig) {
- if (hasConfig[name]) {
- if (instanceConfig[name] !== null) {
- defaultConfigList.push(name);
- this[configNameCache[name].initialized] = false;
- }
- }
- }
- }
- for (i = 0,ln = defaultConfigList.length; i < ln; i++) {
- name = defaultConfigList[i];
- nameMap = configNameCache[name];
- initializedName = nameMap.initialized;
- if (!this[initializedName]) {
- this[initializedName] = true;
- this[nameMap.set].call(this, config[name]);
- }
- }
- return this;
- },
-
- hasConfig: function(name) {
- return Boolean(this.configMap[name]);
- },
-
- setConfig: function(config, applyIfNotSet) {
- if (!config) {
- return this;
- }
- var configNameCache = Ext.Class.configNameCache,
- currentConfig = this.config,
- hasConfig = this.configMap,
- initialConfig = this.initialConfig,
- name, value;
- applyIfNotSet = Boolean(applyIfNotSet);
- for (name in config) {
- if (applyIfNotSet && initialConfig.hasOwnProperty(name)) {
- continue;
- }
- value = config[name];
- currentConfig[name] = value;
- if (hasConfig[name]) {
- this[configNameCache[name].set](value);
- }
- }
- return this;
- },
-
- getConfig: function(name) {
- var configNameCache = Ext.Class.configNameCache;
- return this[configNameCache[name].get]();
- },
-
- getInitialConfig: function(name) {
- var config = this.config;
- if (!name) {
- return config;
- }
- else {
- return config[name];
- }
- },
-
- onConfigUpdate: function(names, callback, scope) {
- var self = this.self,
- i, ln, name,
- updaterName, updater, newUpdater;
- names = Ext.Array.from(names);
- scope = scope || this;
- for (i = 0,ln = names.length; i < ln; i++) {
- name = names[i];
- updaterName = 'update' + Ext.String.capitalize(name);
- updater = this[updaterName] || Ext.emptyFn;
- newUpdater = function() {
- updater.apply(this, arguments);
- scope[callback].apply(scope, arguments);
- };
- newUpdater.$name = updaterName;
- newUpdater.$owner = self;
- this[updaterName] = newUpdater;
- }
- },
-
- destroy: function() {
- this.destroy = Ext.emptyFn;
- }
- });
-
- Base.prototype.callOverridden = Base.prototype.callParent;
- Ext.Base = Base;
- }(Ext.Function.flexSetter));
- //@tag foundation,core
- //@require Base.js
- (function() {
- var ExtClass,
- Base = Ext.Base,
- baseStaticMembers = [],
- baseStaticMember, baseStaticMemberLength;
- for (baseStaticMember in Base) {
- if (Base.hasOwnProperty(baseStaticMember)) {
- baseStaticMembers.push(baseStaticMember);
- }
- }
- baseStaticMemberLength = baseStaticMembers.length;
-
- function makeCtor (className) {
- function constructor () {
-
-
- return this.constructor.apply(this, arguments) || null;
- }
- return constructor;
- }
-
- Ext.Class = ExtClass = function(Class, data, onCreated) {
- if (typeof Class != 'function') {
- onCreated = data;
- data = Class;
- Class = null;
- }
- if (!data) {
- data = {};
- }
- Class = ExtClass.create(Class, data);
- ExtClass.process(Class, data, onCreated);
- return Class;
- };
- Ext.apply(ExtClass, {
-
- onBeforeCreated: function(Class, data, hooks) {
- Class.addMembers(data);
- hooks.onCreated.call(Class, Class);
- },
-
- create: function(Class, data) {
- var name, i;
- if (!Class) {
- Class = makeCtor(
- );
- }
- for (i = 0; i < baseStaticMemberLength; i++) {
- name = baseStaticMembers[i];
- Class[name] = Base[name];
- }
- return Class;
- },
-
- process: function(Class, data, onCreated) {
- var preprocessorStack = data.preprocessors || ExtClass.defaultPreprocessors,
- registeredPreprocessors = this.preprocessors,
- hooks = {
- onBeforeCreated: this.onBeforeCreated
- },
- preprocessors = [],
- preprocessor, preprocessorsProperties,
- i, ln, j, subLn, preprocessorProperty, process;
- delete data.preprocessors;
- for (i = 0,ln = preprocessorStack.length; i < ln; i++) {
- preprocessor = preprocessorStack[i];
- if (typeof preprocessor == 'string') {
- preprocessor = registeredPreprocessors[preprocessor];
- preprocessorsProperties = preprocessor.properties;
- if (preprocessorsProperties === true) {
- preprocessors.push(preprocessor.fn);
- }
- else if (preprocessorsProperties) {
- for (j = 0,subLn = preprocessorsProperties.length; j < subLn; j++) {
- preprocessorProperty = preprocessorsProperties[j];
- if (data.hasOwnProperty(preprocessorProperty)) {
- preprocessors.push(preprocessor.fn);
- break;
- }
- }
- }
- }
- else {
- preprocessors.push(preprocessor);
- }
- }
- hooks.onCreated = onCreated ? onCreated : Ext.emptyFn;
- hooks.preprocessors = preprocessors;
- this.doProcess(Class, data, hooks);
- },
-
- doProcess: function(Class, data, hooks){
- var me = this,
- preprocessor = hooks.preprocessors.shift();
- if (!preprocessor) {
- hooks.onBeforeCreated.apply(me, arguments);
- return;
- }
- if (preprocessor.call(me, Class, data, hooks, me.doProcess) !== false) {
- me.doProcess(Class, data, hooks);
- }
- },
-
- preprocessors: {},
-
- registerPreprocessor: function(name, fn, properties, position, relativeTo) {
- if (!position) {
- position = 'last';
- }
- if (!properties) {
- properties = [name];
- }
- this.preprocessors[name] = {
- name: name,
- properties: properties || false,
- fn: fn
- };
- this.setDefaultPreprocessorPosition(name, position, relativeTo);
- return this;
- },
-
- getPreprocessor: function(name) {
- return this.preprocessors[name];
- },
-
- getPreprocessors: function() {
- return this.preprocessors;
- },
-
- defaultPreprocessors: [],
-
- getDefaultPreprocessors: function() {
- return this.defaultPreprocessors;
- },
-
- setDefaultPreprocessors: function(preprocessors) {
- this.defaultPreprocessors = Ext.Array.from(preprocessors);
- return this;
- },
-
- setDefaultPreprocessorPosition: function(name, offset, relativeName) {
- var defaultPreprocessors = this.defaultPreprocessors,
- index;
- if (typeof offset == 'string') {
- if (offset === 'first') {
- defaultPreprocessors.unshift(name);
- return this;
- }
- else if (offset === 'last') {
- defaultPreprocessors.push(name);
- return this;
- }
- offset = (offset === 'after') ? 1 : -1;
- }
- index = Ext.Array.indexOf(defaultPreprocessors, relativeName);
- if (index !== -1) {
- Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
- }
- return this;
- },
- configNameCache: {},
- getConfigNameMap: function(name) {
- var cache = this.configNameCache,
- map = cache[name],
- capitalizedName;
- if (!map) {
- capitalizedName = name.charAt(0).toUpperCase() + name.substr(1);
- map = cache[name] = {
- internal: name,
- initialized: '_is' + capitalizedName + 'Initialized',
- apply: 'apply' + capitalizedName,
- update: 'update' + capitalizedName,
- 'set': 'set' + capitalizedName,
- 'get': 'get' + capitalizedName,
- doSet : 'doSet' + capitalizedName,
- changeEvent: name.toLowerCase() + 'change'
- };
- }
- return map;
- }
- });
-
- ExtClass.registerPreprocessor('extend', function(Class, data) {
- var Base = Ext.Base,
- basePrototype = Base.prototype,
- extend = data.extend,
- Parent, parentPrototype, i;
- delete data.extend;
- if (extend && extend !== Object) {
- Parent = extend;
- }
- else {
- Parent = Base;
- }
- parentPrototype = Parent.prototype;
- if (!Parent.$isClass) {
- for (i in basePrototype) {
- if (!parentPrototype[i]) {
- parentPrototype[i] = basePrototype[i];
- }
- }
- }
- Class.extend(Parent);
- Class.triggerExtended.apply(Class, arguments);
- if (data.onClassExtended) {
- Class.onExtended(data.onClassExtended, Class);
- delete data.onClassExtended;
- }
- }, true);
-
- ExtClass.registerPreprocessor('statics', function(Class, data) {
- Class.addStatics(data.statics);
- delete data.statics;
- });
-
- ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
- Class.addInheritableStatics(data.inheritableStatics);
- delete data.inheritableStatics;
- });
-
- ExtClass.registerPreprocessor('config', function(Class, data) {
- var config = data.config,
- prototype = Class.prototype;
- delete data.config;
- Ext.Object.each(config, function(name, value) {
- var nameMap = ExtClass.getConfigNameMap(name),
- internalName = nameMap.internal,
- initializedName = nameMap.initialized,
- applyName = nameMap.apply,
- updateName = nameMap.update,
- setName = nameMap.set,
- getName = nameMap.get,
- hasOwnSetter = (setName in prototype) || data.hasOwnProperty(setName),
- hasOwnApplier = (applyName in prototype) || data.hasOwnProperty(applyName),
- hasOwnUpdater = (updateName in prototype) || data.hasOwnProperty(updateName),
- optimizedGetter, customGetter;
- if (value === null || (!hasOwnSetter && !hasOwnApplier && !hasOwnUpdater)) {
- prototype[internalName] = value;
- prototype[initializedName] = true;
- }
- else {
- prototype[initializedName] = false;
- }
- if (!hasOwnSetter) {
- data[setName] = function(value) {
- var oldValue = this[internalName],
- applier = this[applyName],
- updater = this[updateName];
- if (!this[initializedName]) {
- this[initializedName] = true;
- }
- if (applier) {
- value = applier.call(this, value, oldValue);
- }
- if (typeof value != 'undefined') {
- this[internalName] = value;
- if (updater && value !== oldValue) {
- updater.call(this, value, oldValue);
- }
- }
- return this;
- };
- }
- if (!(getName in prototype) || data.hasOwnProperty(getName)) {
- customGetter = data[getName] || false;
- if (customGetter) {
- optimizedGetter = function() {
- return customGetter.apply(this, arguments);
- };
- }
- else {
- optimizedGetter = function() {
- return this[internalName];
- };
- }
- data[getName] = function() {
- var currentGetter;
- if (!this[initializedName]) {
- this[initializedName] = true;
- this[setName](this.config[name]);
- }
- currentGetter = this[getName];
- if ('$previous' in currentGetter) {
- currentGetter.$previous = optimizedGetter;
- }
- else {
- this[getName] = optimizedGetter;
- }
- return optimizedGetter.apply(this, arguments);
- };
- }
- });
- Class.addConfig(config, true);
- });
-
- ExtClass.registerPreprocessor('mixins', function(Class, data, hooks) {
- var mixins = data.mixins,
- name, mixin, i, ln;
- delete data.mixins;
- Ext.Function.interceptBefore(hooks, 'onCreated', function() {
- if (mixins instanceof Array) {
- for (i = 0,ln = mixins.length; i < ln; i++) {
- mixin = mixins[i];
- name = mixin.prototype.mixinId || mixin.$className;
- Class.mixin(name, mixin);
- }
- }
- else {
- for (var mixinName in mixins) {
- if (mixins.hasOwnProperty(mixinName)) {
- Class.mixin(mixinName, mixins[mixinName]);
- }
- }
- }
- });
- });
-
- Ext.extend = function(Class, Parent, members) {
- if (arguments.length === 2 && Ext.isObject(Parent)) {
- members = Parent;
- Parent = Class;
- Class = null;
- }
- var cls;
- if (!Parent) {
- throw new Error("[Ext.extend] Attempting to extend from a class which has not been loaded on the page.");
- }
- members.extend = Parent;
- members.preprocessors = [
- 'extend'
- ,'statics'
- ,'inheritableStatics'
- ,'mixins'
- ,'config'
- ];
- if (Class) {
- cls = new ExtClass(Class, members);
-
- cls.prototype.constructor = Class;
- } else {
- cls = new ExtClass(members);
- }
- cls.prototype.override = function(o) {
- for (var m in o) {
- if (o.hasOwnProperty(m)) {
- this[m] = o[m];
- }
- }
- };
- return cls;
- };
- }());
- //@tag foundation,core
- //@require Class.js
- (function(Class, alias, arraySlice, arrayFrom, global) {
-
- function makeCtor () {
- function constructor () {
-
-
- return this.constructor.apply(this, arguments) || null;
- }
- return constructor;
- }
- var Manager = Ext.ClassManager = {
-
- classes: {},
-
- existCache: {},
-
- namespaceRewrites: [{
- from: 'Ext.',
- to: Ext
- }],
-
- maps: {
- alternateToName: {},
- aliasToName: {},
- nameToAliases: {},
- nameToAlternates: {}
- },
-
- enableNamespaceParseCache: true,
-
- namespaceParseCache: {},
-
- instantiators: [],
-
- isCreated: function(className) {
- var existCache = this.existCache,
- i, ln, part, root, parts;
- if (this.classes[className] || existCache[className]) {
- return true;
- }
- root = global;
- parts = this.parseNamespace(className);
- for (i = 0, ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root || !root[part]) {
- return false;
- }
- root = root[part];
- }
- }
- existCache[className] = true;
- this.triggerCreated(className);
- return true;
- },
-
- createdListeners: [],
-
- nameCreatedListeners: {},
-
- triggerCreated: function(className) {
- var listeners = this.createdListeners,
- nameListeners = this.nameCreatedListeners,
- alternateNames = this.maps.nameToAlternates[className],
- names = [className],
- i, ln, j, subLn, listener, name;
- for (i = 0,ln = listeners.length; i < ln; i++) {
- listener = listeners[i];
- listener.fn.call(listener.scope, className);
- }
- if (alternateNames) {
- names.push.apply(names, alternateNames);
- }
- for (i = 0,ln = names.length; i < ln; i++) {
- name = names[i];
- listeners = nameListeners[name];
- if (listeners) {
- for (j = 0,subLn = listeners.length; j < subLn; j++) {
- listener = listeners[j];
- listener.fn.call(listener.scope, name);
- }
- delete nameListeners[name];
- }
- }
- },
-
- onCreated: function(fn, scope, className) {
- var listeners = this.createdListeners,
- nameListeners = this.nameCreatedListeners,
- listener = {
- fn: fn,
- scope: scope
- };
- if (className) {
- if (this.isCreated(className)) {
- fn.call(scope, className);
- return;
- }
- if (!nameListeners[className]) {
- nameListeners[className] = [];
- }
- nameListeners[className].push(listener);
- }
- else {
- listeners.push(listener);
- }
- },
-
- parseNamespace: function(namespace) {
- var cache = this.namespaceParseCache,
- parts,
- rewrites,
- root,
- name,
- rewrite, from, to, i, ln;
- if (this.enableNamespaceParseCache) {
- if (cache.hasOwnProperty(namespace)) {
- return cache[namespace];
- }
- }
- parts = [];
- rewrites = this.namespaceRewrites;
- root = global;
- name = namespace;
- for (i = 0, ln = rewrites.length; i < ln; i++) {
- rewrite = rewrites[i];
- from = rewrite.from;
- to = rewrite.to;
- if (name === from || name.substring(0, from.length) === from) {
- name = name.substring(from.length);
- if (typeof to != 'string') {
- root = to;
- } else {
- parts = parts.concat(to.split('.'));
- }
- break;
- }
- }
- parts.push(root);
- parts = parts.concat(name.split('.'));
- if (this.enableNamespaceParseCache) {
- cache[namespace] = parts;
- }
- return parts;
- },
-
- setNamespace: function(name, value) {
- var root = global,
- parts = this.parseNamespace(name),
- ln = parts.length - 1,
- leaf = parts[ln],
- i, part;
- for (i = 0; i < ln; i++) {
- part = parts[i];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root[part]) {
- root[part] = {};
- }
- root = root[part];
- }
- }
- root[leaf] = value;
- return root[leaf];
- },
-
- createNamespaces: function() {
- var root = global,
- parts, part, i, j, ln, subLn;
- for (i = 0, ln = arguments.length; i < ln; i++) {
- parts = this.parseNamespace(arguments[i]);
- for (j = 0, subLn = parts.length; j < subLn; j++) {
- part = parts[j];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root[part]) {
- root[part] = {};
- }
- root = root[part];
- }
- }
- }
- return root;
- },
-
- set: function(name, value) {
- var me = this,
- maps = me.maps,
- nameToAlternates = maps.nameToAlternates,
- targetName = me.getName(value),
- alternates;
- me.classes[name] = me.setNamespace(name, value);
- if (targetName && targetName !== name) {
- maps.alternateToName[name] = targetName;
- alternates = nameToAlternates[targetName] || (nameToAlternates[targetName] = []);
- alternates.push(name);
- }
- return this;
- },
-
- get: function(name) {
- var classes = this.classes,
- root,
- parts,
- part, i, ln;
- if (classes[name]) {
- return classes[name];
- }
- root = global;
- parts = this.parseNamespace(name);
- for (i = 0, ln = parts.length; i < ln; i++) {
- part = parts[i];
- if (typeof part != 'string') {
- root = part;
- } else {
- if (!root || !root[part]) {
- return null;
- }
- root = root[part];
- }
- }
- return root;
- },
-
- setAlias: function(cls, alias) {
- var aliasToNameMap = this.maps.aliasToName,
- nameToAliasesMap = this.maps.nameToAliases,
- className;
- if (typeof cls == 'string') {
- className = cls;
- } else {
- className = this.getName(cls);
- }
- if (alias && aliasToNameMap[alias] !== className) {
- aliasToNameMap[alias] = className;
- }
- if (!nameToAliasesMap[className]) {
- nameToAliasesMap[className] = [];
- }
- if (alias) {
- Ext.Array.include(nameToAliasesMap[className], alias);
- }
- return this;
- },
-
- addNameAliasMappings: function(aliases){
- var aliasToNameMap = this.maps.aliasToName,
- nameToAliasesMap = this.maps.nameToAliases,
- className, aliasList, alias, i;
- for (className in aliases) {
- aliasList = nameToAliasesMap[className] ||
- (nameToAliasesMap[className] = []);
- for (i = 0; i < aliases[className].length; i++) {
- alias = aliases[className][i];
- if (!aliasToNameMap[alias]) {
- aliasToNameMap[alias] = className;
- aliasList.push(alias);
- }
- }
- }
- return this;
- },
-
- addNameAlternateMappings: function(alternates) {
- var alternateToName = this.maps.alternateToName,
- nameToAlternates = this.maps.nameToAlternates,
- className, aliasList, alternate, i;
- for (className in alternates) {
- aliasList = nameToAlternates[className] ||
- (nameToAlternates[className] = []);
- for (i = 0; i < alternates[className].length; i++) {
- alternate = alternates[className];
- if (!alternateToName[alternate]) {
- alternateToName[alternate] = className;
- aliasList.push(alternate);
- }
- }
- }
- return this;
- },
-
- getByAlias: function(alias) {
- return this.get(this.getNameByAlias(alias));
- },
-
- getNameByAlias: function(alias) {
- return this.maps.aliasToName[alias] || '';
- },
-
- getNameByAlternate: function(alternate) {
- return this.maps.alternateToName[alternate] || '';
- },
-
- getAliasesByName: function(name) {
- return this.maps.nameToAliases[name] || [];
- },
-
- getName: function(object) {
- return object && object.$className || '';
- },
-
- getClass: function(object) {
- return object && object.self || null;
- },
-
- create: function(className, data, createdFn) {
- var ctor = makeCtor();
- if (typeof data == 'function') {
- data = data(ctor);
- }
- data.$className = className;
- return new Class(ctor, data, function() {
- var postprocessorStack = data.postprocessors || Manager.defaultPostprocessors,
- registeredPostprocessors = Manager.postprocessors,
- postprocessors = [],
- postprocessor, i, ln, j, subLn, postprocessorProperties, postprocessorProperty;
- delete data.postprocessors;
- for (i = 0,ln = postprocessorStack.length; i < ln; i++) {
- postprocessor = postprocessorStack[i];
- if (typeof postprocessor == 'string') {
- postprocessor = registeredPostprocessors[postprocessor];
- postprocessorProperties = postprocessor.properties;
- if (postprocessorProperties === true) {
- postprocessors.push(postprocessor.fn);
- }
- else if (postprocessorProperties) {
- for (j = 0,subLn = postprocessorProperties.length; j < subLn; j++) {
- postprocessorProperty = postprocessorProperties[j];
- if (data.hasOwnProperty(postprocessorProperty)) {
- postprocessors.push(postprocessor.fn);
- break;
- }
- }
- }
- }
- else {
- postprocessors.push(postprocessor);
- }
- }
- data.postprocessors = postprocessors;
- data.createdFn = createdFn;
- Manager.processCreate(className, this, data);
- });
- },
-
- processCreate: function(className, cls, clsData){
- var me = this,
- postprocessor = clsData.postprocessors.shift(),
- createdFn = clsData.createdFn;
- if (!postprocessor) {
- if (className) {
- me.set(className, cls);
- }
- if (createdFn) {
- createdFn.call(cls, cls);
- }
- if (className) {
- me.triggerCreated(className);
- }
- return;
- }
- if (postprocessor.call(me, className, cls, clsData, me.processCreate) !== false) {
- me.processCreate(className, cls, clsData);
- }
- },
- createOverride: function (className, data, createdFn) {
- var me = this,
- overriddenClassName = data.override,
- requires = data.requires,
- uses = data.uses,
- classReady = function () {
- var cls, temp;
- if (requires) {
- temp = requires;
- requires = null;
-
-
-
- Ext.Loader.require(temp, classReady);
- } else {
-
-
- cls = me.get(overriddenClassName);
-
- delete data.override;
- delete data.requires;
- delete data.uses;
- Ext.override(cls, data);
-
-
-
- me.triggerCreated(className);
- if (uses) {
- Ext.Loader.addUsedClasses(uses);
- }
- if (createdFn) {
- createdFn.call(cls);
- }
- }
- };
- me.existCache[className] = true;
-
- me.onCreated(classReady, me, overriddenClassName);
-
- return me;
- },
-
- instantiateByAlias: function() {
- var alias = arguments[0],
- args = arraySlice.call(arguments),
- className = this.getNameByAlias(alias);
- if (!className) {
- className = this.maps.aliasToName[alias];
- Ext.syncRequire(className);
- }
- args[0] = className;
- return this.instantiate.apply(this, args);
- },
-
- instantiate: function() {
- var name = arguments[0],
- nameType = typeof name,
- args = arraySlice.call(arguments, 1),
- alias = name,
- possibleName, cls;
- if (nameType != 'function') {
- if (nameType != 'string' && args.length === 0) {
- args = [name];
- name = name.xclass;
- }
- cls = this.get(name);
- }
- else {
- cls = name;
- }
-
- if (!cls) {
- possibleName = this.getNameByAlias(name);
- if (possibleName) {
- name = possibleName;
- cls = this.get(name);
- }
- }
-
- if (!cls) {
- possibleName = this.getNameByAlternate(name);
- if (possibleName) {
- name = possibleName;
- cls = this.get(name);
- }
- }
-
- if (!cls) {
- Ext.syncRequire(name);
- cls = this.get(name);
- }
- return this.getInstantiator(args.length)(cls, args);
- },
-
- dynInstantiate: function(name, args) {
- args = arrayFrom(args, true);
- args.unshift(name);
- return this.instantiate.apply(this, args);
- },
-
- getInstantiator: function(length) {
- var instantiators = this.instantiators,
- instantiator,
- i,
- args;
- instantiator = instantiators[length];
- if (!instantiator) {
- i = length;
- args = [];
- for (i = 0; i < length; i++) {
- args.push('a[' + i + ']');
- }
- instantiator = instantiators[length] = new Function('c', 'a', 'return new c(' + args.join(',') + ')');
- }
- return instantiator;
- },
-
- postprocessors: {},
-
- defaultPostprocessors: [],
-
- registerPostprocessor: function(name, fn, properties, position, relativeTo) {
- if (!position) {
- position = 'last';
- }
- if (!properties) {
- properties = [name];
- }
- this.postprocessors[name] = {
- name: name,
- properties: properties || false,
- fn: fn
- };
- this.setDefaultPostprocessorPosition(name, position, relativeTo);
- return this;
- },
-
- setDefaultPostprocessors: function(postprocessors) {
- this.defaultPostprocessors = arrayFrom(postprocessors);
- return this;
- },
-
- setDefaultPostprocessorPosition: function(name, offset, relativeName) {
- var defaultPostprocessors = this.defaultPostprocessors,
- index;
- if (typeof offset == 'string') {
- if (offset === 'first') {
- defaultPostprocessors.unshift(name);
- return this;
- }
- else if (offset === 'last') {
- defaultPostprocessors.push(name);
- return this;
- }
- offset = (offset === 'after') ? 1 : -1;
- }
- index = Ext.Array.indexOf(defaultPostprocessors, relativeName);
- if (index !== -1) {
- Ext.Array.splice(defaultPostprocessors, Math.max(0, index + offset), 0, name);
- }
- return this;
- },
-
- getNamesByExpression: function(expression) {
- var nameToAliasesMap = this.maps.nameToAliases,
- names = [],
- name, alias, aliases, possibleName, regex, i, ln;
- if (expression.indexOf('*') !== -1) {
- expression = expression.replace(/\*/g, '(.*?)');
- regex = new RegExp('^' + expression + '$');
- for (name in nameToAliasesMap) {
- if (nameToAliasesMap.hasOwnProperty(name)) {
- aliases = nameToAliasesMap[name];
- if (name.search(regex) !== -1) {
- names.push(name);
- }
- else {
- for (i = 0, ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- if (alias.search(regex) !== -1) {
- names.push(name);
- break;
- }
- }
- }
- }
- }
- } else {
- possibleName = this.getNameByAlias(expression);
- if (possibleName) {
- names.push(possibleName);
- } else {
- possibleName = this.getNameByAlternate(expression);
- if (possibleName) {
- names.push(possibleName);
- } else {
- names.push(expression);
- }
- }
- }
- return names;
- }
- };
-
- Manager.registerPostprocessor('alias', function(name, cls, data) {
- var aliases = data.alias,
- i, ln;
- for (i = 0,ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- this.setAlias(cls, alias);
- }
- }, ['xtype', 'alias']);
-
- Manager.registerPostprocessor('singleton', function(name, cls, data, fn) {
- fn.call(this, name, new cls(), data);
- return false;
- });
-
- Manager.registerPostprocessor('alternateClassName', function(name, cls, data) {
- var alternates = data.alternateClassName,
- i, ln, alternate;
- if (!(alternates instanceof Array)) {
- alternates = [alternates];
- }
- for (i = 0, ln = alternates.length; i < ln; i++) {
- alternate = alternates[i];
- this.set(alternate, cls);
- }
- });
- Ext.apply(Ext, {
-
- create: alias(Manager, 'instantiate'),
-
- widget: function(name, config) {
-
-
-
-
-
-
-
- var xtype = name,
- alias, className, T, load;
- if (typeof xtype != 'string') {
-
- config = name;
- xtype = config.xtype;
- } else {
- config = config || {};
- }
-
- if (config.isComponent) {
- return config;
- }
- alias = 'widget.' + xtype;
- className = Manager.getNameByAlias(alias);
-
- if (!className) {
- load = true;
- }
-
- T = Manager.get(className);
- if (load || !T) {
- return Manager.instantiateByAlias(alias, config);
- }
- return new T(config);
- },
-
- createByAlias: alias(Manager, 'instantiateByAlias'),
-
- define: function (className, data, createdFn) {
- if (data.override) {
- return Manager.createOverride.apply(Manager, arguments);
- }
- return Manager.create.apply(Manager, arguments);
- },
-
- getClassName: alias(Manager, 'getName'),
-
- getDisplayName: function(object) {
- if (object) {
- if (object.displayName) {
- return object.displayName;
- }
- if (object.$name && object.$class) {
- return Ext.getClassName(object.$class) + '#' + object.$name;
- }
- if (object.$className) {
- return object.$className;
- }
- }
- return 'Anonymous';
- },
-
- getClass: alias(Manager, 'getClass'),
-
- namespace: alias(Manager, 'createNamespaces')
- });
-
- Ext.createWidget = Ext.widget;
-
- Ext.ns = Ext.namespace;
- Class.registerPreprocessor('className', function(cls, data) {
- if (data.$className) {
- cls.$className = data.$className;
- }
- }, true, 'first');
- Class.registerPreprocessor('alias', function(cls, data) {
- var prototype = cls.prototype,
- xtypes = arrayFrom(data.xtype),
- aliases = arrayFrom(data.alias),
- widgetPrefix = 'widget.',
- widgetPrefixLength = widgetPrefix.length,
- xtypesChain = Array.prototype.slice.call(prototype.xtypesChain || []),
- xtypesMap = Ext.merge({}, prototype.xtypesMap || {}),
- i, ln, alias, xtype;
- for (i = 0,ln = aliases.length; i < ln; i++) {
- alias = aliases[i];
- if (alias.substring(0, widgetPrefixLength) === widgetPrefix) {
- xtype = alias.substring(widgetPrefixLength);
- Ext.Array.include(xtypes, xtype);
- }
- }
- cls.xtype = data.xtype = xtypes[0];
- data.xtypes = xtypes;
- for (i = 0,ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypesChain.push(xtype);
- }
- }
- data.xtypesChain = xtypesChain;
- data.xtypesMap = xtypesMap;
- Ext.Function.interceptAfter(data, 'onClassCreated', function() {
- var mixins = prototype.mixins,
- key, mixin;
- for (key in mixins) {
- if (mixins.hasOwnProperty(key)) {
- mixin = mixins[key];
- xtypes = mixin.xtypes;
- if (xtypes) {
- for (i = 0,ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- if (!xtypesMap[xtype]) {
- xtypesMap[xtype] = true;
- xtypesChain.push(xtype);
- }
- }
- }
- }
- }
- });
- for (i = 0,ln = xtypes.length; i < ln; i++) {
- xtype = xtypes[i];
- Ext.Array.include(aliases, widgetPrefix + xtype);
- }
- data.alias = aliases;
- }, ['xtype', 'alias']);
- }(Ext.Class, Ext.Function.alias, Array.prototype.slice, Ext.Array.from, Ext.global));
- //@tag foundation,core
- //@require ClassManager.js
- //@define Ext.Loader
- Ext.Loader = new function() {
- var Loader = this,
- Manager = Ext.ClassManager,
- Class = Ext.Class,
- flexSetter = Ext.Function.flexSetter,
- alias = Ext.Function.alias,
- pass = Ext.Function.pass,
- defer = Ext.Function.defer,
- arrayErase = Ext.Array.erase,
- dependencyProperties = ['extend', 'mixins', 'requires'],
- isInHistory = {},
- history = [],
- slashDotSlashRe = /\/\.\//g,
- dotRe = /\./g;
- Ext.apply(Loader, {
-
- isInHistory: isInHistory,
-
- history: history,
-
- config: {
-
- enabled: false,
-
- scriptChainDelay : false,
-
- disableCaching: true,
-
- disableCachingParam: '_dc',
-
- garbageCollect : false,
-
- paths: {
- 'Ext': '.'
- },
-
- preserveScripts : true,
-
- scriptCharset : undefined
- },
-
- setConfig: function(name, value) {
- if (Ext.isObject(name) && arguments.length === 1) {
- Ext.merge(Loader.config, name);
- }
- else {
- Loader.config[name] = (Ext.isObject(value)) ? Ext.merge(Loader.config[name], value) : value;
- }
- return Loader;
- },
-
- getConfig: function(name) {
- if (name) {
- return Loader.config[name];
- }
- return Loader.config;
- },
-
- setPath: flexSetter(function(name, path) {
- Loader.config.paths[name] = path;
- return Loader;
- }),
-
- addClassPathMappings: function(paths) {
- var name;
- for(name in paths){
- Loader.config.paths[name] = paths[name];
- }
- return Loader;
- },
-
- getPath: function(className) {
- var path = '',
- paths = Loader.config.paths,
- prefix = Loader.getPrefix(className);
- if (prefix.length > 0) {
- if (prefix === className) {
- return paths[prefix];
- }
- path = paths[prefix];
- className = className.substring(prefix.length + 1);
- }
- if (path.length > 0) {
- path += '/';
- }
- return path.replace(slashDotSlashRe, '/') + className.replace(dotRe, "/") + '.js';
- },
-
- getPrefix: function(className) {
- var paths = Loader.config.paths,
- prefix, deepestPrefix = '';
- if (paths.hasOwnProperty(className)) {
- return className;
- }
- for (prefix in paths) {
- if (paths.hasOwnProperty(prefix) && prefix + '.' === className.substring(0, prefix.length + 1)) {
- if (prefix.length > deepestPrefix.length) {
- deepestPrefix = prefix;
- }
- }
- }
- return deepestPrefix;
- },
-
- isAClassNameWithAKnownPrefix: function(className) {
- var prefix = Loader.getPrefix(className);
-
- return prefix !== '' && prefix !== className;
- },
-
- require: function(expressions, fn, scope, excludes) {
- if (fn) {
- fn.call(scope);
- }
- },
-
- syncRequire: function() {},
-
- exclude: function(excludes) {
- return {
- require: function(expressions, fn, scope) {
- return Loader.require(expressions, fn, scope, excludes);
- },
- syncRequire: function(expressions, fn, scope) {
- return Loader.syncRequire(expressions, fn, scope, excludes);
- }
- };
- },
-
- onReady: function(fn, scope, withDomReady, options) {
- var oldFn;
- if (withDomReady !== false && Ext.onDocumentReady) {
- oldFn = fn;
- fn = function() {
- Ext.onDocumentReady(oldFn, scope, options);
- };
- }
- fn.call(scope);
- }
- });
- var queue = [],
- isClassFileLoaded = {},
- isFileLoaded = {},
- classNameToFilePathMap = {},
- scriptElements = {},
- readyListeners = [],
- usedClasses = [],
- requiresMap = {};
- Ext.apply(Loader, {
-
- documentHead: typeof document != 'undefined' && (document.head || document.getElementsByTagName('head')[0]),
-
- isLoading: false,
-
- queue: queue,
-
- isClassFileLoaded: isClassFileLoaded,
-
- isFileLoaded: isFileLoaded,
-
- readyListeners: readyListeners,
-
- optionalRequires: usedClasses,
-
- requiresMap: requiresMap,
-
- numPendingFiles: 0,
-
- numLoadedFiles: 0,
-
- hasFileLoadError: false,
-
- classNameToFilePathMap: classNameToFilePathMap,
-
- scriptsLoading: 0,
-
- syncModeEnabled: false,
- scriptElements: scriptElements,
-
- refreshQueue: function() {
- var ln = queue.length,
- i, item, j, requires;
-
- if (!ln && !Loader.scriptsLoading) {
- return Loader.triggerReady();
- }
- for (i = 0; i < ln; i++) {
- item = queue[i];
- if (item) {
- requires = item.requires;
-
-
- if (requires.length > Loader.numLoadedFiles) {
- continue;
- }
-
- for (j = 0; j < requires.length; ) {
- if (Manager.isCreated(requires[j])) {
-
- arrayErase(requires, j, 1);
- }
- else {
- j++;
- }
- }
-
- if (item.requires.length === 0) {
- arrayErase(queue, i, 1);
- item.callback.call(item.scope);
- Loader.refreshQueue();
- break;
- }
- }
- }
- return Loader;
- },
-
- injectScriptElement: function(url, onLoad, onError, scope, charset) {
- var script = document.createElement('script'),
- dispatched = false,
- config = Loader.config,
- onLoadFn = function() {
- if(!dispatched) {
- dispatched = true;
- script.onload = script.onreadystatechange = script.onerror = null;
- if (typeof config.scriptChainDelay == 'number') {
-
- defer(onLoad, config.scriptChainDelay, scope);
- } else {
- onLoad.call(scope);
- }
- Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
- }
- },
- onErrorFn = function(arg) {
- defer(onError, 1, scope);
- Loader.cleanupScriptElement(script, config.preserveScripts === false, config.garbageCollect);
- };
- script.type = 'text/javascript';
- script.onerror = onErrorFn;
- charset = charset || config.scriptCharset;
- if (charset) {
- script.charset = charset;
- }
-
- if ('addEventListener' in script ) {
- script.onload = onLoadFn;
- } else if ('readyState' in script) {
- script.onreadystatechange = function() {
- if ( this.readyState == 'loaded' || this.readyState == 'complete' ) {
- onLoadFn();
- }
- };
- } else {
- script.onload = onLoadFn;
- }
- script.src = url;
- (Loader.documentHead || document.getElementsByTagName('head')[0]).appendChild(script);
- return script;
- },
-
- removeScriptElement: function(url) {
- if (scriptElements[url]) {
- Loader.cleanupScriptElement(scriptElements[url], true, !!Loader.getConfig('garbageCollect'));
- delete scriptElements[url];
- }
- return Loader;
- },
-
- cleanupScriptElement: function(script, remove, collect) {
- var prop;
- script.onload = script.onreadystatechange = script.onerror = null;
- if (remove) {
- Ext.removeNode(script);
- if (collect) {
- for (prop in script) {
- try {
- script[prop] = null;
- delete script[prop];
- } catch (cleanEx) {
-
- }
- }
- }
- }
- return Loader;
- },
-
- loadScript: function (options) {
- var config = Loader.getConfig(),
- isString = typeof options == 'string',
- url = isString ? options : options.url,
- onError = !isString && options.onError,
- onLoad = !isString && options.onLoad,
- scope = !isString && options.scope,
- onScriptError = function() {
- Loader.numPendingFiles--;
- Loader.scriptsLoading--;
- if (onError) {
- onError.call(scope, "Failed loading '" + url + "', please verify that the file exists");
- }
- if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
- Loader.refreshQueue();
- }
- },
- onScriptLoad = function () {
- Loader.numPendingFiles--;
- Loader.scriptsLoading--;
- if (onLoad) {
- onLoad.call(scope);
- }
- if (Loader.numPendingFiles + Loader.scriptsLoading === 0) {
- Loader.refreshQueue();
- }
- },
- src;
- Loader.isLoading = true;
- Loader.numPendingFiles++;
- Loader.scriptsLoading++;
- src = config.disableCaching ?
- (url + '?' + config.disableCachingParam + '=' + Ext.Date.now()) : url;
- scriptElements[url] = Loader.injectScriptElement(src, onScriptLoad, onScriptError);
- },
-
- loadScriptFile: function(url, onLoad, onError, scope, synchronous) {
- if (isFileLoaded[url]) {
- return Loader;
- }
- var config = Loader.getConfig(),
- noCacheUrl = url + (config.disableCaching ? ('?' + config.disableCachingParam + '=' + Ext.Date.now()) : ''),
- isCrossOriginRestricted = false,
- xhr, status, onScriptError,
- debugSourceURL = "";
- scope = scope || Loader;
- Loader.isLoading = true;
- if (!synchronous) {
- onScriptError = function() {
- };
- scriptElements[url] = Loader.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
- } else {
- if (typeof XMLHttpRequest != 'undefined') {
- xhr = new XMLHttpRequest();
- } else {
- xhr = new ActiveXObject('Microsoft.XMLHTTP');
- }
- try {
- xhr.open('GET', noCacheUrl, false);
- xhr.send(null);
- } catch (e) {
- isCrossOriginRestricted = true;
- }
- status = (xhr.status === 1223) ? 204 :
- (xhr.status === 0 && (self.location || {}).protocol == 'file:') ? 200 : xhr.status;
- isCrossOriginRestricted = isCrossOriginRestricted || (status === 0);
- if (isCrossOriginRestricted
- ) {
- }
- else if ((status >= 200 && status < 300) || (status === 304)
- ) {
-
-
- if (!Ext.isIE) {
- debugSourceURL = "\n//@ sourceURL=" + url;
- }
- Ext.globalEval(xhr.responseText + debugSourceURL);
- onLoad.call(scope);
- }
- else {
- }
-
- xhr = null;
- }
- },
-
- syncRequire: function() {
- var syncModeEnabled = Loader.syncModeEnabled;
- if (!syncModeEnabled) {
- Loader.syncModeEnabled = true;
- }
- Loader.require.apply(Loader, arguments);
- if (!syncModeEnabled) {
- Loader.syncModeEnabled = false;
- }
- Loader.refreshQueue();
- },
-
- require: function(expressions, fn, scope, excludes) {
- var excluded = {},
- included = {},
- excludedClassNames = [],
- possibleClassNames = [],
- classNames = [],
- references = [],
- callback,
- syncModeEnabled,
- filePath, expression, exclude, className,
- possibleClassName, i, j, ln, subLn;
- if (excludes) {
-
- excludes = (typeof excludes === 'string') ? [ excludes ] : excludes;
- for (i = 0,ln = excludes.length; i < ln; i++) {
- exclude = excludes[i];
- if (typeof exclude == 'string' && exclude.length > 0) {
- excludedClassNames = Manager.getNamesByExpression(exclude);
- for (j = 0,subLn = excludedClassNames.length; j < subLn; j++) {
- excluded[excludedClassNames[j]] = true;
- }
- }
- }
- }
-
- expressions = (typeof expressions === 'string') ? [ expressions ] : (expressions ? expressions : []);
- if (fn) {
- if (fn.length > 0) {
- callback = function() {
- var classes = [],
- i, ln;
- for (i = 0,ln = references.length; i < ln; i++) {
- classes.push(Manager.get(references[i]));
- }
- return fn.apply(this, classes);
- };
- }
- else {
- callback = fn;
- }
- }
- else {
- callback = Ext.emptyFn;
- }
- scope = scope || Ext.global;
- for (i = 0,ln = expressions.length; i < ln; i++) {
- expression = expressions[i];
- if (typeof expression == 'string' && expression.length > 0) {
- possibleClassNames = Manager.getNamesByExpression(expression);
- subLn = possibleClassNames.length;
- for (j = 0; j < subLn; j++) {
- possibleClassName = possibleClassNames[j];
- if (excluded[possibleClassName] !== true) {
- references.push(possibleClassName);
- if (!Manager.isCreated(possibleClassName) && !included[possibleClassName]) {
- included[possibleClassName] = true;
- classNames.push(possibleClassName);
- }
- }
- }
- }
- }
-
-
- if (classNames.length > 0) {
- if (!Loader.config.enabled) {
- throw new Error("Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. " +
- "Missing required class" + ((classNames.length > 1) ? "es" : "") + ": " + classNames.join(', '));
- }
- }
- else {
- callback.call(scope);
- return Loader;
- }
- syncModeEnabled = Loader.syncModeEnabled;
- if (!syncModeEnabled) {
- queue.push({
- requires: classNames.slice(),
-
- callback: callback,
- scope: scope
- });
- }
- ln = classNames.length;
- for (i = 0; i < ln; i++) {
- className = classNames[i];
- filePath = Loader.getPath(className);
-
-
-
- if (syncModeEnabled && isClassFileLoaded.hasOwnProperty(className)) {
- Loader.numPendingFiles--;
- Loader.removeScriptElement(filePath);
- delete isClassFileLoaded[className];
- }
- if (!isClassFileLoaded.hasOwnProperty(className)) {
- isClassFileLoaded[className] = false;
- classNameToFilePathMap[className] = filePath;
- Loader.numPendingFiles++;
- Loader.loadScriptFile(
- filePath,
- pass(Loader.onFileLoaded, [className, filePath], Loader),
- pass(Loader.onFileLoadError, [className, filePath], Loader),
- Loader,
- syncModeEnabled
- );
- }
- }
- if (syncModeEnabled) {
- callback.call(scope);
- if (ln === 1) {
- return Manager.get(className);
- }
- }
- return Loader;
- },
-
- onFileLoaded: function(className, filePath) {
- Loader.numLoadedFiles++;
- isClassFileLoaded[className] = true;
- isFileLoaded[filePath] = true;
- Loader.numPendingFiles--;
- if (Loader.numPendingFiles === 0) {
- Loader.refreshQueue();
- }
- },
-
- onFileLoadError: function(className, filePath, errorMessage, isSynchronous) {
- Loader.numPendingFiles--;
- Loader.hasFileLoadError = true;
- },
-
- addUsedClasses: function (classes) {
- var cls, i, ln;
- if (classes) {
- classes = (typeof classes == 'string') ? [classes] : classes;
- for (i = 0, ln = classes.length; i < ln; i++) {
- cls = classes[i];
- if (typeof cls == 'string' && !Ext.Array.contains(usedClasses, cls)) {
- usedClasses.push(cls);
- }
- }
- }
- return Loader;
- },
-
- triggerReady: function() {
- var listener,
- i, refClasses = usedClasses;
- if (Loader.isLoading) {
- Loader.isLoading = false;
- if (refClasses.length !== 0) {
-
- refClasses = refClasses.slice();
- usedClasses.length = 0;
-
-
- Loader.require(refClasses, Loader.triggerReady, Loader);
- return Loader;
- }
- }
-
-
-
- while (readyListeners.length && !Loader.isLoading) {
-
-
- listener = readyListeners.shift();
- listener.fn.call(listener.scope);
- }
- return Loader;
- },
-
- onReady: function(fn, scope, withDomReady, options) {
- var oldFn;
- if (withDomReady !== false && Ext.onDocumentReady) {
- oldFn = fn;
- fn = function() {
- Ext.onDocumentReady(oldFn, scope, options);
- };
- }
- if (!Loader.isLoading) {
- fn.call(scope);
- }
- else {
- readyListeners.push({
- fn: fn,
- scope: scope
- });
- }
- },
-
- historyPush: function(className) {
- if (className && isClassFileLoaded.hasOwnProperty(className) && !isInHistory[className]) {
- isInHistory[className] = true;
- history.push(className);
- }
- return Loader;
- }
- });
-
- Ext.disableCacheBuster = function (disable, path) {
- var date = new Date();
- date.setTime(date.getTime() + (disable ? 10*365 : -1) * 24*60*60*1000);
- date = date.toGMTString();
- document.cookie = 'ext-cache=1; expires=' + date + '; path='+(path || '/');
- };
-
- Ext.require = alias(Loader, 'require');
-
- Ext.syncRequire = alias(Loader, 'syncRequire');
-
- Ext.exclude = alias(Loader, 'exclude');
-
- Ext.onReady = function(fn, scope, options) {
- Loader.onReady(fn, scope, true, options);
- };
-
- Class.registerPreprocessor('loader', function(cls, data, hooks, continueFn) {
- var me = this,
- dependencies = [],
- dependency,
- className = Manager.getName(cls),
- i, j, ln, subLn, value, propertyName, propertyValue,
- requiredMap, requiredDep;
-
- for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
- propertyName = dependencyProperties[i];
- if (data.hasOwnProperty(propertyName)) {
- propertyValue = data[propertyName];
- if (typeof propertyValue == 'string') {
- dependencies.push(propertyValue);
- }
- else if (propertyValue instanceof Array) {
- for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
- value = propertyValue[j];
- if (typeof value == 'string') {
- dependencies.push(value);
- }
- }
- }
- else if (typeof propertyValue != 'function') {
- for (j in propertyValue) {
- if (propertyValue.hasOwnProperty(j)) {
- value = propertyValue[j];
- if (typeof value == 'string') {
- dependencies.push(value);
- }
- }
- }
- }
- }
- }
- if (dependencies.length === 0) {
- return;
- }
- Loader.require(dependencies, function() {
- for (i = 0,ln = dependencyProperties.length; i < ln; i++) {
- propertyName = dependencyProperties[i];
- if (data.hasOwnProperty(propertyName)) {
- propertyValue = data[propertyName];
- if (typeof propertyValue == 'string') {
- data[propertyName] = Manager.get(propertyValue);
- }
- else if (propertyValue instanceof Array) {
- for (j = 0, subLn = propertyValue.length; j < subLn; j++) {
- value = propertyValue[j];
- if (typeof value == 'string') {
- data[propertyName][j] = Manager.get(value);
- }
- }
- }
- else if (typeof propertyValue != 'function') {
- for (var k in propertyValue) {
- if (propertyValue.hasOwnProperty(k)) {
- value = propertyValue[k];
- if (typeof value == 'string') {
- data[propertyName][k] = Manager.get(value);
- }
- }
- }
- }
- }
- }
- continueFn.call(me, cls, data, hooks);
- });
- return false;
- }, true, 'after', 'className');
-
- Manager.registerPostprocessor('uses', function(name, cls, data) {
- var uses = data.uses;
- if (uses) {
- Loader.addUsedClasses(uses);
- }
- });
- Manager.onCreated(Loader.historyPush);
- };
- if (Ext._classPathMetadata) {
- Ext.Loader.addClassPathMappings(Ext._classPathMetadata);
- Ext._classPathMetadata = null;
- }
- (function() {
- var scripts = document.getElementsByTagName('script'),
- currentScript = scripts[scripts.length - 1],
- src = currentScript.src,
- path = src.substring(0, src.lastIndexOf('/') + 1),
- Loader = Ext.Loader;
- Loader.setConfig({
- enabled: true,
- disableCaching: true,
- paths: {
- 'Ext': path + 'src'
- }
- });
- })();
- Ext._endTime = new Date().getTime();
- if (Ext._beforereadyhandler){
- Ext._beforereadyhandler();
- }
- //@tag foundation,core
- //@require ../class/Loader.js
- Ext.Error = Ext.extend(Error, {
- statics: {
-
- ignore: false,
-
-
-
- raise: function(err){
- err = err || {};
- if (Ext.isString(err)) {
- err = { msg: err };
- }
- var method = this.raise.caller,
- msg;
- if (method) {
- if (method.$name) {
- err.sourceMethod = method.$name;
- }
- if (method.$owner) {
- err.sourceClass = method.$owner.$className;
- }
- }
- if (Ext.Error.handle(err) !== true) {
- msg = Ext.Error.prototype.toString.call(err);
- Ext.log({
- msg: msg,
- level: 'error',
- dump: err,
- stack: true
- });
- throw new Ext.Error(err);
- }
- },
-
- handle: function(){
- return Ext.Error.ignore;
- }
- },
-
- name: 'Ext.Error',
-
- constructor: function(config){
- if (Ext.isString(config)) {
- config = { msg: config };
- }
- var me = this;
- Ext.apply(me, config);
- me.message = me.message || me.msg;
-
- },
-
- toString: function(){
- var me = this,
- className = me.sourceClass ? me.sourceClass : '',
- methodName = me.sourceMethod ? '.' + me.sourceMethod + '(): ' : '',
- msg = me.msg || '(No description provided)';
- return className + methodName + msg;
- }
- });
- Ext.deprecated = function (suggestion) {
- return Ext.emptyFn;
- };
|