buxDialogs.js.uncompressed.js 258 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613
  1. require({cache:{
  2. 'dijit/form/TextBox':function(){
  3. require({cache:{
  4. 'url:dijit/form/templates/TextBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\" id=\"widget_${id}\" role=\"presentation\"\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class=\"dijitReset dijitInputInner\" data-dojo-attach-point='textbox,focusNode' autocomplete=\"off\"\n\t\t\t${!nameAttrSetting} type='${type}'\n\t/></div\n></div>\n"}});
  5. define("dijit/form/TextBox", [
  6. "dojo/_base/declare", // declare
  7. "dojo/dom-construct", // domConstruct.create
  8. "dojo/dom-style", // domStyle.getComputedStyle
  9. "dojo/_base/kernel", // kernel.deprecated
  10. "dojo/_base/lang", // lang.hitch
  11. "dojo/_base/sniff", // has("ie") has("mozilla")
  12. "dojo/_base/window", // win.doc.selection.createRange
  13. "./_FormValueWidget",
  14. "./_TextBoxMixin",
  15. "dojo/text!./templates/TextBox.html",
  16. ".." // to export dijit._setSelectionRange, remove in 2.0
  17. ], function(declare, domConstruct, domStyle, kernel, lang, has, win,
  18. _FormValueWidget, _TextBoxMixin, template, dijit){
  19. /*=====
  20. var _FormValueWidget = dijit.form._FormValueWidget;
  21. var _TextBoxMixin = dijit.form._TextBoxMixin;
  22. =====*/
  23. // module:
  24. // dijit/form/TextBox
  25. // summary:
  26. // A base class for textbox form inputs
  27. var TextBox = declare(/*====="dijit.form.TextBox", =====*/ [_FormValueWidget, _TextBoxMixin], {
  28. // summary:
  29. // A base class for textbox form inputs
  30. templateString: template,
  31. _singleNodeTemplate: '<input class="dijit dijitReset dijitLeft dijitInputField" data-dojo-attach-point="textbox,focusNode" autocomplete="off" type="${type}" ${!nameAttrSetting} />',
  32. _buttonInputDisabled: has("ie") ? "disabled" : "", // allows IE to disallow focus, but Firefox cannot be disabled for mousedown events
  33. baseClass: "dijitTextBox",
  34. postMixInProperties: function(){
  35. var type = this.type.toLowerCase();
  36. if(this.templateString && this.templateString.toLowerCase() == "input" || ((type == "hidden" || type == "file") && this.templateString == this.constructor.prototype.templateString)){
  37. this.templateString = this._singleNodeTemplate;
  38. }
  39. this.inherited(arguments);
  40. },
  41. _onInput: function(e){
  42. this.inherited(arguments);
  43. if(this.intermediateChanges){ // _TextBoxMixin uses onInput
  44. var _this = this;
  45. // the setTimeout allows the key to post to the widget input box
  46. setTimeout(function(){ _this._handleOnChange(_this.get('value'), false); }, 0);
  47. }
  48. },
  49. _setPlaceHolderAttr: function(v){
  50. this._set("placeHolder", v);
  51. if(!this._phspan){
  52. this._attachPoints.push('_phspan');
  53. // dijitInputField class gives placeHolder same padding as the input field
  54. // parent node already has dijitInputField class but it doesn't affect this <span>
  55. // since it's position: absolute.
  56. this._phspan = domConstruct.create('span',{ onmousedown:function(e){ e.preventDefault(); }, className:'dijitPlaceHolder dijitInputField'},this.textbox,'after');
  57. }
  58. this._phspan.innerHTML="";
  59. this._phspan.appendChild(document.createTextNode(v));
  60. this._updatePlaceHolder();
  61. },
  62. _updatePlaceHolder: function(){
  63. if(this._phspan){
  64. this._phspan.style.display=(this.placeHolder&&!this.focused&&!this.textbox.value)?"":"none";
  65. }
  66. },
  67. _setValueAttr: function(value, /*Boolean?*/ priorityChange, /*String?*/ formattedValue){
  68. this.inherited(arguments);
  69. this._updatePlaceHolder();
  70. },
  71. getDisplayedValue: function(){
  72. // summary:
  73. // Deprecated. Use get('displayedValue') instead.
  74. // tags:
  75. // deprecated
  76. kernel.deprecated(this.declaredClass+"::getDisplayedValue() is deprecated. Use set('displayedValue') instead.", "", "2.0");
  77. return this.get('displayedValue');
  78. },
  79. setDisplayedValue: function(/*String*/ value){
  80. // summary:
  81. // Deprecated. Use set('displayedValue', ...) instead.
  82. // tags:
  83. // deprecated
  84. kernel.deprecated(this.declaredClass+"::setDisplayedValue() is deprecated. Use set('displayedValue', ...) instead.", "", "2.0");
  85. this.set('displayedValue', value);
  86. },
  87. _onBlur: function(e){
  88. if(this.disabled){ return; }
  89. this.inherited(arguments);
  90. this._updatePlaceHolder();
  91. },
  92. _onFocus: function(/*String*/ by){
  93. if(this.disabled || this.readOnly){ return; }
  94. this.inherited(arguments);
  95. this._updatePlaceHolder();
  96. }
  97. });
  98. if(has("ie") < 9){
  99. TextBox = declare(/*===== "dijit.form.TextBox.IEMixin", =====*/ TextBox, {
  100. declaredClass: "dijit.form.TextBox", // for user code referencing declaredClass
  101. _isTextSelected: function(){
  102. var range = win.doc.selection.createRange();
  103. var parent = range.parentElement();
  104. return parent == this.textbox && range.text.length == 0;
  105. },
  106. postCreate: function(){
  107. this.inherited(arguments);
  108. // IE INPUT tag fontFamily has to be set directly using STYLE
  109. // the setTimeout gives IE a chance to render the TextBox and to deal with font inheritance
  110. setTimeout(lang.hitch(this, function(){
  111. try{
  112. var s = domStyle.getComputedStyle(this.domNode); // can throw an exception if widget is immediately destroyed
  113. if(s){
  114. var ff = s.fontFamily;
  115. if(ff){
  116. var inputs = this.domNode.getElementsByTagName("INPUT");
  117. if(inputs){
  118. for(var i=0; i < inputs.length; i++){
  119. inputs[i].style.fontFamily = ff;
  120. }
  121. }
  122. }
  123. }
  124. }catch(e){/*when used in a Dialog, and this is called before the dialog is
  125. shown, s.fontFamily would trigger "Invalid Argument" error.*/}
  126. }), 0);
  127. }
  128. });
  129. // Overrides definition of _setSelectionRange from _TextBoxMixin (TODO: move to _TextBoxMixin.js?)
  130. dijit._setSelectionRange = _TextBoxMixin._setSelectionRange = function(/*DomNode*/ element, /*Number?*/ start, /*Number?*/ stop){
  131. if(element.createTextRange){
  132. var r = element.createTextRange();
  133. r.collapse(true);
  134. r.moveStart("character", -99999); // move to 0
  135. r.moveStart("character", start); // delta from 0 is the correct position
  136. r.moveEnd("character", stop-start);
  137. r.select();
  138. }
  139. }
  140. }else if(has("mozilla")){
  141. TextBox = declare(/*===== "dijit.form.TextBox.MozMixin", =====*/TextBox, {
  142. declaredClass: "dijit.form.TextBox", // for user code referencing declaredClass
  143. _onBlur: function(e){
  144. this.inherited(arguments);
  145. if(this.selectOnClick){
  146. // clear selection so that the next mouse click doesn't reselect
  147. this.textbox.selectionStart = this.textbox.selectionEnd = undefined;
  148. }
  149. }
  150. });
  151. }else{
  152. TextBox.prototype.declaredClass = "dijit.form.TextBox";
  153. }
  154. lang.setObject("dijit.form.TextBox", TextBox); // don't do direct assignment, it confuses API doc parser
  155. return TextBox;
  156. });
  157. },
  158. 'dojox/color':function(){
  159. define("dojox/color", ["./color/_base"], function(dxcolor){
  160. return dxcolor;
  161. });
  162. },
  163. 'dijit/DialogUnderlay':function(){
  164. define("dijit/DialogUnderlay", [
  165. "dojo/_base/declare", // declare
  166. "dojo/dom-attr", // domAttr.set
  167. "dojo/_base/window", // win.body
  168. "dojo/window", // winUtils.getBox
  169. "./_Widget",
  170. "./_TemplatedMixin",
  171. "./BackgroundIframe"
  172. ], function(declare, domAttr, win, winUtils, _Widget, _TemplatedMixin, BackgroundIframe){
  173. /*=====
  174. var _Widget = dijit._Widget;
  175. var _TemplatedMixin = dijit._TemplatedMixin;
  176. =====*/
  177. // module:
  178. // dijit/DialogUnderlay
  179. // summary:
  180. // The component that blocks the screen behind a `dijit.Dialog`
  181. return declare("dijit.DialogUnderlay", [_Widget, _TemplatedMixin], {
  182. // summary:
  183. // The component that blocks the screen behind a `dijit.Dialog`
  184. //
  185. // description:
  186. // A component used to block input behind a `dijit.Dialog`. Only a single
  187. // instance of this widget is created by `dijit.Dialog`, and saved as
  188. // a reference to be shared between all Dialogs as `dijit._underlay`
  189. //
  190. // The underlay itself can be styled based on and id:
  191. // | #myDialog_underlay { background-color:red; }
  192. //
  193. // In the case of `dijit.Dialog`, this id is based on the id of the Dialog,
  194. // suffixed with _underlay.
  195. // Template has two divs; outer div is used for fade-in/fade-out, and also to hold background iframe.
  196. // Inner div has opacity specified in CSS file.
  197. templateString: "<div class='dijitDialogUnderlayWrapper'><div class='dijitDialogUnderlay' data-dojo-attach-point='node'></div></div>",
  198. // Parameters on creation or updatable later
  199. // dialogId: String
  200. // Id of the dialog.... DialogUnderlay's id is based on this id
  201. dialogId: "",
  202. // class: String
  203. // This class name is used on the DialogUnderlay node, in addition to dijitDialogUnderlay
  204. "class": "",
  205. _setDialogIdAttr: function(id){
  206. domAttr.set(this.node, "id", id + "_underlay");
  207. this._set("dialogId", id);
  208. },
  209. _setClassAttr: function(clazz){
  210. this.node.className = "dijitDialogUnderlay " + clazz;
  211. this._set("class", clazz);
  212. },
  213. postCreate: function(){
  214. // summary:
  215. // Append the underlay to the body
  216. win.body().appendChild(this.domNode);
  217. },
  218. layout: function(){
  219. // summary:
  220. // Sets the background to the size of the viewport
  221. //
  222. // description:
  223. // Sets the background to the size of the viewport (rather than the size
  224. // of the document) since we need to cover the whole browser window, even
  225. // if the document is only a few lines long.
  226. // tags:
  227. // private
  228. var is = this.node.style,
  229. os = this.domNode.style;
  230. // hide the background temporarily, so that the background itself isn't
  231. // causing scrollbars to appear (might happen when user shrinks browser
  232. // window and then we are called to resize)
  233. os.display = "none";
  234. // then resize and show
  235. var viewport = winUtils.getBox();
  236. os.top = viewport.t + "px";
  237. os.left = viewport.l + "px";
  238. is.width = viewport.w + "px";
  239. is.height = viewport.h + "px";
  240. os.display = "block";
  241. },
  242. show: function(){
  243. // summary:
  244. // Show the dialog underlay
  245. this.domNode.style.display = "block";
  246. this.layout();
  247. this.bgIframe = new BackgroundIframe(this.domNode);
  248. },
  249. hide: function(){
  250. // summary:
  251. // Hides the dialog underlay
  252. this.bgIframe.destroy();
  253. delete this.bgIframe;
  254. this.domNode.style.display = "none";
  255. }
  256. });
  257. });
  258. },
  259. 'dojox/widget/ColorPicker':function(){
  260. require({cache:{
  261. 'url:dojox/widget/ColorPicker/ColorPicker.html':"<table class=\"dojoxColorPicker\" dojoAttachEvent=\"onkeypress: _handleKey\" cellpadding=\"0\" cellspacing=\"0\">\n\t<tr>\n\t\t<td valign=\"top\" class=\"dojoxColorPickerRightPad\">\n\t\t\t<div class=\"dojoxColorPickerBox\">\n\t\t\t\t<!-- Forcing ABS in style attr due to dojo DND issue with not picking it up form the class. -->\n\t\t\t\t<img role=\"status\" title=\"${saturationPickerTitle}\" alt=\"${saturationPickerTitle}\" class=\"dojoxColorPickerPoint\" src=\"${_pickerPointer}\" tabIndex=\"0\" dojoAttachPoint=\"cursorNode\" style=\"position: absolute; top: 0px; left: 0px;\">\n\t\t\t\t<img role=\"presentation\" alt=\"\" dojoAttachPoint=\"colorUnderlay\" dojoAttachEvent=\"onclick: _setPoint, onmousedown: _stopDrag\" class=\"dojoxColorPickerUnderlay\" src=\"${_underlay}\" ondragstart=\"return false\">\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign=\"top\" class=\"dojoxColorPickerRightPad\">\n\t\t\t<div class=\"dojoxHuePicker\">\n\t\t\t\t<!-- Forcing ABS in style attr due to dojo DND issue with not picking it up form the class. -->\n\t\t\t\t<img role=\"status\" dojoAttachPoint=\"hueCursorNode\" tabIndex=\"0\" class=\"dojoxHuePickerPoint\" title=\"${huePickerTitle}\" alt=\"${huePickerTitle}\" src=\"${_huePickerPointer}\" style=\"position: absolute; top: 0px; left: 0px;\">\n\t\t\t\t<div class=\"dojoxHuePickerUnderlay\" dojoAttachPoint=\"hueNode\">\n\t\t\t\t <img role=\"presentation\" alt=\"\" dojoAttachEvent=\"onclick: _setHuePoint, onmousedown: _stopDrag\" src=\"${_hueUnderlay}\">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign=\"top\">\n\t\t\t<table cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign=\"top\" class=\"dojoxColorPickerPreviewContainer\">\n\t\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td valign=\"top\" class=\"dojoxColorPickerRightPad\">\n\t\t\t\t\t\t\t\t\t<div dojoAttachPoint=\"previewNode\" class=\"dojoxColorPickerPreview\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\t\t<div dojoAttachPoint=\"safePreviewNode\" class=\"dojoxColorPickerWebSafePreview\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign=\"bottom\">\n\t\t\t\t\t\t<table class=\"dojoxColorPickerOptional\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<div class=\"dijitInline dojoxColorPickerRgb\" dojoAttachPoint=\"rgbNode\">\n\t\t\t\t\t\t\t\t\t\t<table cellpadding=\"1\" cellspacing=\"1\">\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_r\">${redLabel}</label></td><td><input id=\"${_uId}_r\" dojoAttachPoint=\"Rval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"></td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_g\">${greenLabel}</label></td><td><input id=\"${_uId}_g\" dojoAttachPoint=\"Gval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"></td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_b\">${blueLabel}</label></td><td><input id=\"${_uId}_b\" dojoAttachPoint=\"Bval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"></td></tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<div class=\"dijitInline dojoxColorPickerHsv\" dojoAttachPoint=\"hsvNode\">\n\t\t\t\t\t\t\t\t\t\t<table cellpadding=\"1\" cellspacing=\"1\">\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_h\">${hueLabel}</label></td><td><input id=\"${_uId}_h\" dojoAttachPoint=\"Hval\"size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"> ${degLabel}</td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_s\">${saturationLabel}</label></td><td><input id=\"${_uId}_s\" dojoAttachPoint=\"Sval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"> ${percentSign}</td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_v\">${valueLabel}</label></td><td><input id=\"${_uId}_v\" dojoAttachPoint=\"Vval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"> ${percentSign}</td></tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t\t\t<div class=\"dojoxColorPickerHex\" dojoAttachPoint=\"hexNode\" aria-live=\"polite\">\t\n\t\t\t\t\t\t\t\t\t\t<label for=\"${_uId}_hex\">&nbsp;${hexLabel}&nbsp;</label><input id=\"${_uId}_hex\" dojoAttachPoint=\"hexCode, focusNode, valueNode\" size=\"6\" class=\"dojoxColorPickerHexCode\" dojoAttachEvent=\"onchange: _colorInputChange\">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n</table>\n\n"}});
  262. define("dojox/widget/ColorPicker", [
  263. "dojo/_base/kernel","dojo/_base/declare","dojo/_base/lang","dojo/_base/array",
  264. "dojo/_base/html","dojo/_base/connect","dojo/_base/sniff","dojo/_base/window",
  265. "dojo/_base/event","dojo/dom","dojo/dom-class","dojo/keys","dojo/fx","dojo/dnd/move",
  266. "dijit/registry","dijit/_base/focus","dijit/form/_FormWidget","dijit/typematic",
  267. "dojox/color","dojo/i18n","dojo/i18n!./nls/ColorPicker","dojo/i18n!dojo/cldr/nls/number",
  268. "dojo/text!./ColorPicker/ColorPicker.html"
  269. ], function(kernel,declare,lang,ArrayUtil,html,Hub,has,win,Event,DOM,DOMClass,Keys,fx,move,
  270. registry,FocusManager,FormWidget,Typematic,color,i18n,bundle1,bundle2,template){
  271. kernel.experimental("dojox.widget.ColorPicker");
  272. var webSafeFromHex = function(hex){
  273. // stub, this is planned later:
  274. return hex;
  275. };
  276. /*=====
  277. var FormWidget = dijit.form._FormWidget;
  278. =====*/
  279. // TODO: shouldn't this extend _FormValueWidget?
  280. return declare("dojox.widget.ColorPicker", FormWidget, {
  281. // summary:
  282. // a HSV color picker - similar to Photoshop picker
  283. //
  284. // description:
  285. // Provides an interactive HSV ColorPicker similar to
  286. // PhotoShop's color selction tool. This is an enhanced
  287. // version of the default dijit.ColorPalette, though provides
  288. // no accessibility.
  289. //
  290. // example:
  291. // | var picker = new dojox.widget.ColorPicker({
  292. // | // a couple of example toggles:
  293. // | animatePoint:false,
  294. // | showHsv: false,
  295. // | webSafe: false,
  296. // | showRgb: false
  297. // | });
  298. //
  299. // example:
  300. // | <!-- markup: -->
  301. // | <div dojoType="dojox.widget.ColorPicker"></div>
  302. //
  303. // showRgb: Boolean
  304. // show/update RGB input nodes
  305. showRgb: true,
  306. // showHsv: Boolean
  307. // show/update HSV input nodes
  308. showHsv: true,
  309. // showHex: Boolean
  310. // show/update Hex value field
  311. showHex: true,
  312. // webSafe: Boolean
  313. // deprecated? or just use a toggle to show/hide that node, too?
  314. webSafe: true,
  315. // animatePoint: Boolean
  316. // toggle to use slideTo (true) or just place the cursor (false) on click
  317. animatePoint: true,
  318. // slideDuration: Integer
  319. // time in ms picker node will slide to next location (non-dragging) when animatePoint=true
  320. slideDuration: 250,
  321. // liveUpdate: Boolean
  322. // Set to true to fire onChange in an indeterminate way
  323. liveUpdate: false,
  324. // PICKER_HUE_H: int
  325. // Height of the hue picker, used to calculate positions
  326. PICKER_HUE_H: 150,
  327. // PICKER_SAT_VAL_H: int
  328. // Height of the 2d picker, used to calculate positions
  329. PICKER_SAT_VAL_H: 150,
  330. // PICKER_SAT_VAL_W: int
  331. // Width of the 2d picker, used to calculate positions
  332. PICKER_SAT_VAL_W: 150,
  333. // PICKER_HUE_SELECTOR_H: int
  334. // Height of the hue selector DOM node, used to calc offsets so that selection
  335. // is center of the image node.
  336. PICKER_HUE_SELECTOR_H: 8,
  337. // PICKER_SAT_SELECTOR_H: int
  338. // Height of the saturation selector DOM node, used to calc offsets so that selection
  339. // is center of the image node.
  340. PICKER_SAT_SELECTOR_H: 10,
  341. // PICKER_SAT_SELECTOR_W: int
  342. // Width of the saturation selector DOM node, used to calc offsets so that selection
  343. // is center of the image node.
  344. PICKER_SAT_SELECTOR_W: 10,
  345. // value: String
  346. // Default color for this component. Only hex values are accepted as incoming/returned
  347. // values. Adjust this value with `.attr`, eg: dijit.byId("myPicker").attr("value", "#ededed");
  348. // to cause the points to adjust and the values to reflect the current color.
  349. value: "#ffffff",
  350. _underlay: kernel.moduleUrl("dojox.widget","ColorPicker/images/underlay.png"),
  351. _hueUnderlay: kernel.moduleUrl("dojox.widget","ColorPicker/images/hue.png"),
  352. _pickerPointer: kernel.moduleUrl("dojox.widget","ColorPicker/images/pickerPointer.png"),
  353. _huePickerPointer: kernel.moduleUrl("dojox.widget","ColorPicker/images/hueHandle.png"),
  354. _huePickerPointerAlly: kernel.moduleUrl("dojox.widget","ColorPicker/images/hueHandleA11y.png"),
  355. templateString: template,
  356. postMixInProperties: function(){
  357. if(DOMClass.contains(win.body(), "dijit_a11y")){
  358. // Use the pointer that will show up in high contrast.
  359. this._huePickerPointer = this._huePickerPointerAlly;
  360. }
  361. this._uId = registry.getUniqueId(this.id);
  362. lang.mixin(this, i18n.getLocalization("dojox.widget", "ColorPicker"));
  363. lang.mixin(this, i18n.getLocalization("dojo.cldr", "number"));
  364. this.inherited(arguments);
  365. },
  366. postCreate: function(){
  367. // summary:
  368. // As quickly as we can, set up ie6 alpha-filter support for our
  369. // underlay. we don't do image handles (done in css), just the 'core'
  370. // of this widget: the underlay.
  371. this.inherited(arguments);
  372. if(has("ie") < 7){
  373. this.colorUnderlay.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._underlay+"', sizingMethod='scale')";
  374. this.colorUnderlay.src = this._blankGif.toString();
  375. }
  376. // hide toggle-able nodes:
  377. if(!this.showRgb){ this.rgbNode.style.visibility = "hidden"; }
  378. if(!this.showHsv){ this.hsvNode.style.visibility = "hidden"; }
  379. if(!this.showHex){ this.hexNode.style.visibility = "hidden"; }
  380. if(!this.webSafe){ this.safePreviewNode.style.visibility = "hidden"; }
  381. },
  382. startup: function(){
  383. if(this._started){
  384. return;
  385. }
  386. this._started = true;
  387. this.set("value", this.value);
  388. this._mover = new move.boxConstrainedMoveable(this.cursorNode, {
  389. box: {
  390. t: -(this.PICKER_SAT_SELECTOR_H/2),
  391. l: -(this.PICKER_SAT_SELECTOR_W/2),
  392. w:this.PICKER_SAT_VAL_W,
  393. h:this.PICKER_SAT_VAL_H
  394. }
  395. });
  396. this._hueMover = new move.boxConstrainedMoveable(this.hueCursorNode, {
  397. box: {
  398. t: -(this.PICKER_HUE_SELECTOR_H/2),
  399. l:0,
  400. w:0,
  401. h:this.PICKER_HUE_H
  402. }
  403. });
  404. this._subs = [];
  405. // no dnd/move/move published ... use a timer:
  406. this._subs.push(Hub.subscribe("/dnd/move/stop", lang.hitch(this, "_clearTimer")));
  407. this._subs.push(Hub.subscribe("/dnd/move/start", lang.hitch(this, "_setTimer")));
  408. // Bind to up, down, left and right arrows on the hue and saturation nodes.
  409. this._keyListeners = [];
  410. this._connects.push(Typematic.addKeyListener(this.hueCursorNode,{
  411. charOrCode: Keys.UP_ARROW,
  412. shiftKey: false,
  413. metaKey: false,
  414. ctrlKey: false,
  415. altKey: false
  416. }, this, lang.hitch(this, this._updateHueCursorNode), 25, 25));
  417. this._connects.push(Typematic.addKeyListener(this.hueCursorNode,{
  418. charOrCode: Keys.DOWN_ARROW,
  419. shiftKey: false,
  420. metaKey: false,
  421. ctrlKey: false,
  422. altKey: false
  423. }, this, lang.hitch(this, this._updateHueCursorNode), 25, 25));
  424. this._connects.push(Typematic.addKeyListener(this.cursorNode,{
  425. charOrCode: Keys.UP_ARROW,
  426. shiftKey: false,
  427. metaKey: false,
  428. ctrlKey: false,
  429. altKey: false
  430. }, this, lang.hitch(this, this._updateCursorNode), 25, 25));
  431. this._connects.push(Typematic.addKeyListener(this.cursorNode,{
  432. charOrCode: Keys.DOWN_ARROW,
  433. shiftKey: false,
  434. metaKey: false,
  435. ctrlKey: false,
  436. altKey: false
  437. }, this, lang.hitch(this, this._updateCursorNode), 25, 25));
  438. this._connects.push(Typematic.addKeyListener(this.cursorNode,{
  439. charOrCode: Keys.LEFT_ARROW,
  440. shiftKey: false,
  441. metaKey: false,
  442. ctrlKey: false,
  443. altKey: false
  444. }, this, lang.hitch(this, this._updateCursorNode), 25, 25));
  445. this._connects.push(Typematic.addKeyListener(this.cursorNode,{
  446. charOrCode: Keys.RIGHT_ARROW,
  447. shiftKey: false,
  448. metaKey: false,
  449. ctrlKey: false,
  450. altKey: false
  451. }, this, lang.hitch(this, this._updateCursorNode), 25, 25));
  452. },
  453. _setValueAttr: function(value){
  454. if(!this._started){ return; }
  455. this.setColor(value, true);
  456. },
  457. setColor: function(/* String */col, force){
  458. // summary: Set a color on a picker. Usually used to set
  459. // initial color as an alternative to passing defaultColor option
  460. // to the constructor.
  461. col = color.fromString(col);
  462. this._updatePickerLocations(col);
  463. this._updateColorInputs(col);
  464. this._updateValue(col, force);
  465. },
  466. _setTimer: function(/* d.dnd.Mover */mover){
  467. if(mover.node != this.cursorNode && mover.node != this.hueCursorNode){ return; }
  468. // FIXME: should I assume this? focus on mouse down so on mouse up
  469. FocusManager.focus(mover.node);
  470. DOM.setSelectable(this.domNode,false);
  471. this._timer = setInterval(lang.hitch(this, "_updateColor"), 45);
  472. },
  473. _clearTimer: function(/* d.dnd.Mover */mover){
  474. if(!this._timer){ return; }
  475. clearInterval(this._timer);
  476. this._timer = null;
  477. this.onChange(this.value);
  478. DOM.setSelectable(this.domNode,true);
  479. },
  480. _setHue: function(/* Decimal */h){
  481. // summary:
  482. // Sets a natural color background for the
  483. // underlay image against closest hue value (full saturation)
  484. // h: 0..360
  485. html.style(this.colorUnderlay, "backgroundColor", color.fromHsv(h,100,100).toHex());
  486. },
  487. _updateHueCursorNode: function(count, node, e){
  488. // summary:
  489. // Function used by the typematic code to handle cursor position and update
  490. // via keyboard.
  491. // count:
  492. // -1 means stop, anything else is just how many times it was called.
  493. // node:
  494. // The node generating the event.
  495. // e:
  496. // The event.
  497. if(count !== -1){
  498. var y = html.style(this.hueCursorNode, "top");
  499. var selCenter = this.PICKER_HUE_SELECTOR_H/2;
  500. // Account for our offset
  501. y += selCenter;
  502. var update = false;
  503. if(e.charOrCode == Keys.UP_ARROW){
  504. if(y > 0){
  505. y -= 1;
  506. update = true;
  507. }
  508. }else if(e.charOrCode == Keys.DOWN_ARROW){
  509. if(y < this.PICKER_HUE_H){
  510. y += 1;
  511. update = true;
  512. }
  513. }
  514. y -= selCenter;
  515. if(update){
  516. html.style(this.hueCursorNode, "top", y + "px");
  517. }
  518. }else{
  519. this._updateColor(true);
  520. }
  521. },
  522. _updateCursorNode: function(count, node, e){
  523. // summary:
  524. // Function used by the typematic code to handle cursor position and update
  525. // via keyboard.
  526. // count:
  527. // -1 means stop, anything else is just how many times it was called.
  528. // node:
  529. // The node generating the event.
  530. // e:
  531. // The event.
  532. var selCenterH = this.PICKER_SAT_SELECTOR_H/2;
  533. var selCenterW = this.PICKER_SAT_SELECTOR_W/2;
  534. if(count !== -1){
  535. var y = html.style(this.cursorNode, "top");
  536. var x = html.style(this.cursorNode, "left");
  537. // Account for our offsets to center
  538. y += selCenterH;
  539. x += selCenterW;
  540. var update = false;
  541. if(e.charOrCode == Keys.UP_ARROW){
  542. if(y > 0){
  543. y -= 1;
  544. update = true;
  545. }
  546. }else if(e.charOrCode == Keys.DOWN_ARROW){
  547. if(y < this.PICKER_SAT_VAL_H){
  548. y += 1;
  549. update = true;
  550. }
  551. }else if(e.charOrCode == Keys.LEFT_ARROW){
  552. if(x > 0){
  553. x -= 1;
  554. update = true;
  555. }
  556. }else if(e.charOrCode == Keys.RIGHT_ARROW){
  557. if(x < this.PICKER_SAT_VAL_W){
  558. x += 1;
  559. update = true;
  560. }
  561. }
  562. if(update){
  563. // Account for our offsets to center
  564. y -= selCenterH;
  565. x -= selCenterW;
  566. html.style(this.cursorNode, "top", y + "px");
  567. html.style(this.cursorNode, "left", x + "px");
  568. }
  569. }else{
  570. this._updateColor(true);
  571. }
  572. },
  573. _updateColor: function(){
  574. // summary: update the previewNode color, and input values [optional]
  575. var hueSelCenter = this.PICKER_HUE_SELECTOR_H/2,
  576. satSelCenterH = this.PICKER_SAT_SELECTOR_H/2,
  577. satSelCenterW = this.PICKER_SAT_SELECTOR_W/2;
  578. var _huetop = html.style(this.hueCursorNode,"top") + hueSelCenter,
  579. _pickertop = html.style(this.cursorNode,"top") + satSelCenterH,
  580. _pickerleft = html.style(this.cursorNode,"left") + satSelCenterW,
  581. h = Math.round(360 - (_huetop / this.PICKER_HUE_H * 360)),
  582. col = color.fromHsv(h, _pickerleft / this.PICKER_SAT_VAL_W * 100, 100 - (_pickertop / this.PICKER_SAT_VAL_H * 100))
  583. ;
  584. this._updateColorInputs(col);
  585. this._updateValue(col, true);
  586. // update hue, not all the pickers
  587. if(h!=this._hue){
  588. this._setHue(h);
  589. }
  590. },
  591. _colorInputChange: function(e){
  592. //summary: updates picker position and inputs
  593. // according to rgb, hex or hsv input changes
  594. var col, hasit = false;
  595. switch(e.target){
  596. //transform to hsv to pixels
  597. case this.hexCode:
  598. col = color.fromString(e.target.value);
  599. hasit = true;
  600. break;
  601. case this.Rval:
  602. case this.Gval:
  603. case this.Bval:
  604. col = color.fromArray([this.Rval.value, this.Gval.value, this.Bval.value]);
  605. hasit = true;
  606. break;
  607. case this.Hval:
  608. case this.Sval:
  609. case this.Vval:
  610. col = color.fromHsv(this.Hval.value, this.Sval.value, this.Vval.value);
  611. hasit = true;
  612. break;
  613. }
  614. if(hasit){
  615. this._updatePickerLocations(col);
  616. this._updateColorInputs(col);
  617. this._updateValue(col, true);
  618. }
  619. },
  620. _updateValue: function(/* dojox.color.Color */col, /* Boolean */fireChange){
  621. // summary: updates the value of the widget
  622. // can cancel reverse onChange by specifying second param
  623. var hex = col.toHex();
  624. this.value = this.valueNode.value = hex;
  625. // anytime we muck with the color, fire onChange?
  626. if(fireChange && (!this._timer || this.liveUpdate)){
  627. this.onChange(hex);
  628. }
  629. },
  630. _updatePickerLocations: function(/* dojox.color.Color */col){
  631. //summary: update handles on the pickers acording to color values
  632. //
  633. var hueSelCenter = this.PICKER_HUE_SELECTOR_H/2,
  634. satSelCenterH = this.PICKER_SAT_SELECTOR_H/2,
  635. satSelCenterW = this.PICKER_SAT_SELECTOR_W/2;
  636. var hsv = col.toHsv(),
  637. ypos = Math.round(this.PICKER_HUE_H - hsv.h / 360 * this.PICKER_HUE_H) - hueSelCenter,
  638. newLeft = Math.round(hsv.s / 100 * this.PICKER_SAT_VAL_W) - satSelCenterW,
  639. newTop = Math.round(this.PICKER_SAT_VAL_H - hsv.v / 100 * this.PICKER_SAT_VAL_H) - satSelCenterH
  640. ;
  641. if(this.animatePoint){
  642. fx.slideTo({
  643. node: this.hueCursorNode,
  644. duration: this.slideDuration,
  645. top: ypos,
  646. left: 0
  647. }).play();
  648. fx.slideTo({
  649. node: this.cursorNode,
  650. duration: this.slideDuration,
  651. top: newTop,
  652. left: newLeft
  653. }).play();
  654. }
  655. else {
  656. html.style(this.hueCursorNode, "top", ypos + "px");
  657. html.style(this.cursorNode, {
  658. left: newLeft + "px",
  659. top: newTop + "px"
  660. });
  661. }
  662. // limit hue calculations to only when it changes
  663. if(hsv.h != this._hue){
  664. this._setHue(hsv.h);
  665. }
  666. },
  667. _updateColorInputs: function(/* dojox.color.Color */col){
  668. //summary: updates color inputs that were changed through other inputs
  669. //or by clicking on the picker
  670. var hex = col.toHex();
  671. if(this.showRgb){
  672. this.Rval.value = col.r;
  673. this.Gval.value = col.g;
  674. this.Bval.value = col.b;
  675. }
  676. if(this.showHsv){
  677. var hsv = col.toHsv();
  678. this.Hval.value = Math.round((hsv.h)); // convert to 0..360
  679. this.Sval.value = Math.round(hsv.s);
  680. this.Vval.value = Math.round(hsv.v);
  681. }
  682. if(this.showHex){
  683. this.hexCode.value = hex;
  684. }
  685. this.previewNode.style.backgroundColor = hex;
  686. if(this.webSafe){
  687. this.safePreviewNode.style.backgroundColor = webSafeFromHex(hex);
  688. }
  689. },
  690. _setHuePoint: function(/* Event */evt){
  691. // summary: set the hue picker handle on relative y coordinates
  692. var selCenter = this.PICKER_HUE_SELECTOR_H/2;
  693. var ypos = evt.layerY - selCenter;
  694. if(this.animatePoint){
  695. fx.slideTo({
  696. node: this.hueCursorNode,
  697. duration:this.slideDuration,
  698. top: ypos,
  699. left: 0,
  700. onEnd: lang.hitch(this, function(){ this._updateColor(true); FocusManager.focus(this.hueCursorNode); })
  701. }).play();
  702. }else{
  703. html.style(this.hueCursorNode, "top", ypos + "px");
  704. this._updateColor(false);
  705. }
  706. },
  707. _setPoint: function(/* Event */evt){
  708. // summary: set our picker point based on relative x/y coordinates
  709. // evt.preventDefault();
  710. var satSelCenterH = this.PICKER_SAT_SELECTOR_H/2;
  711. var satSelCenterW = this.PICKER_SAT_SELECTOR_W/2;
  712. var newTop = evt.layerY - satSelCenterH;
  713. var newLeft = evt.layerX - satSelCenterW;
  714. if(evt){ FocusManager.focus(evt.target); }
  715. if(this.animatePoint){
  716. fx.slideTo({
  717. node: this.cursorNode,
  718. duration: this.slideDuration,
  719. top: newTop,
  720. left: newLeft,
  721. onEnd: lang.hitch(this, function(){ this._updateColor(true); FocusManager.focus(this.cursorNode); })
  722. }).play();
  723. }else{
  724. html.style(this.cursorNode, {
  725. left: newLeft + "px",
  726. top: newTop + "px"
  727. });
  728. this._updateColor(false);
  729. }
  730. },
  731. _handleKey: function(/* Event */e){
  732. // FIXME: not implemented YET
  733. // var keys = d.keys;
  734. },
  735. focus: function(){
  736. // summary:
  737. // Put focus on this widget, only if focus isn't set on it already.
  738. if(!this.focused){
  739. FocusManager.focus(this.focusNode);
  740. }
  741. },
  742. _stopDrag: function(e){
  743. // summary:
  744. // Function to hald the mouse down default
  745. // to disable draggong of images out of the color
  746. // picker.
  747. Event.stop(e);
  748. },
  749. destroy: function(){
  750. // summary:
  751. // Over-ride to clean up subscriptions, etc.
  752. this.inherited(arguments);
  753. ArrayUtil.forEach(this._subs, function(sub){
  754. Hub.unsubscribe(sub);
  755. });
  756. delete this._subs;
  757. }
  758. });
  759. });
  760. },
  761. 'dijit/TitlePane':function(){
  762. require({cache:{
  763. 'url:dijit/templates/TitlePane.html':"<div>\n\t<div data-dojo-attach-event=\"onclick:_onTitleClick, onkeydown:_onTitleKey\"\n\t\t\tclass=\"dijitTitlePaneTitle\" data-dojo-attach-point=\"titleBarNode\">\n\t\t<div class=\"dijitTitlePaneTitleFocus\" data-dojo-attach-point=\"focusNode\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" data-dojo-attach-point=\"arrowNode\" class=\"dijitArrowNode\" role=\"presentation\"\n\t\t\t/><span data-dojo-attach-point=\"arrowNodeInner\" class=\"dijitArrowNodeInner\"></span\n\t\t\t><span data-dojo-attach-point=\"titleNode\" class=\"dijitTitlePaneTextNode\"></span>\n\t\t</div>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\" data-dojo-attach-point=\"hideNode\" role=\"presentation\">\n\t\t<div class=\"dijitReset\" data-dojo-attach-point=\"wipeNode\" role=\"presentation\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" data-dojo-attach-point=\"containerNode\" role=\"region\" id=\"${id}_pane\">\n\t\t\t\t<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n"}});
  764. define("dijit/TitlePane", [
  765. "dojo/_base/array", // array.forEach
  766. "dojo/_base/declare", // declare
  767. "dojo/dom", // dom.setSelectable
  768. "dojo/dom-attr", // domAttr.set or get domAttr.remove
  769. "dojo/dom-class", // domClass.replace
  770. "dojo/dom-geometry", // domGeometry.setMarginBox domGeometry.getMarginBox
  771. "dojo/_base/event", // event.stop
  772. "dojo/fx", // fxUtils.wipeIn fxUtils.wipeOut
  773. "dojo/_base/kernel", // kernel.deprecated
  774. "dojo/keys", // keys.DOWN_ARROW keys.ENTER
  775. "./_CssStateMixin",
  776. "./_TemplatedMixin",
  777. "./layout/ContentPane",
  778. "dojo/text!./templates/TitlePane.html",
  779. "./_base/manager" // defaultDuration
  780. ], function(array, declare, dom, domAttr, domClass, domGeometry, event, fxUtils, kernel, keys,
  781. _CssStateMixin, _TemplatedMixin, ContentPane, template, manager){
  782. /*=====
  783. var _Widget = dijit._Widget;
  784. var _TemplatedMixin = dijit._TemplatedMixin;
  785. var _CssStateMixin = dijit._CssStateMixin;
  786. var ContentPane = dijit.layout.ContentPane;
  787. =====*/
  788. // module:
  789. // dijit/TitlePane
  790. // summary:
  791. // A pane with a title on top, that can be expanded or collapsed.
  792. return declare("dijit.TitlePane", [ContentPane, _TemplatedMixin, _CssStateMixin], {
  793. // summary:
  794. // A pane with a title on top, that can be expanded or collapsed.
  795. //
  796. // description:
  797. // An accessible container with a title Heading, and a content
  798. // section that slides open and closed. TitlePane is an extension to
  799. // `dijit.layout.ContentPane`, providing all the useful content-control aspects from it.
  800. //
  801. // example:
  802. // | // load a TitlePane from remote file:
  803. // | var foo = new dijit.TitlePane({ href: "foobar.html", title:"Title" });
  804. // | foo.startup();
  805. //
  806. // example:
  807. // | <!-- markup href example: -->
  808. // | <div data-dojo-type="dijit.TitlePane" data-dojo-props="href: 'foobar.html', title: 'Title'"></div>
  809. //
  810. // example:
  811. // | <!-- markup with inline data -->
  812. // | <div data-dojo-type="dijit.TitlePane" title="Title">
  813. // | <p>I am content</p>
  814. // | </div>
  815. // title: String
  816. // Title of the pane
  817. title: "",
  818. _setTitleAttr: { node: "titleNode", type: "innerHTML" }, // override default where title becomes a hover tooltip
  819. // open: Boolean
  820. // Whether pane is opened or closed.
  821. open: true,
  822. // toggleable: Boolean
  823. // Whether pane can be opened or closed by clicking the title bar.
  824. toggleable: true,
  825. // tabIndex: String
  826. // Tabindex setting for the title (so users can tab to the title then
  827. // use space/enter to open/close the title pane)
  828. tabIndex: "0",
  829. // duration: Integer
  830. // Time in milliseconds to fade in/fade out
  831. duration: manager.defaultDuration,
  832. // baseClass: [protected] String
  833. // The root className to be placed on this widget's domNode.
  834. baseClass: "dijitTitlePane",
  835. templateString: template,
  836. // doLayout: [protected] Boolean
  837. // Don't change this parameter from the default value.
  838. // This ContentPane parameter doesn't make sense for TitlePane, since TitlePane
  839. // is never a child of a layout container, nor should TitlePane try to control
  840. // the size of an inner widget.
  841. doLayout: false,
  842. // Tooltip is defined in _WidgetBase but we need to handle the mapping to DOM here
  843. _setTooltipAttr: {node: "focusNode", type: "attribute", attribute: "title"}, // focusNode spans the entire width, titleNode doesn't
  844. buildRendering: function(){
  845. this.inherited(arguments);
  846. dom.setSelectable(this.titleNode, false);
  847. },
  848. postCreate: function(){
  849. this.inherited(arguments);
  850. // Hover and focus effect on title bar, except for non-toggleable TitlePanes
  851. // This should really be controlled from _setToggleableAttr() but _CssStateMixin
  852. // doesn't provide a way to disconnect a previous _trackMouseState() call
  853. if(this.toggleable){
  854. this._trackMouseState(this.titleBarNode, "dijitTitlePaneTitle");
  855. }
  856. // setup open/close animations
  857. var hideNode = this.hideNode, wipeNode = this.wipeNode;
  858. this._wipeIn = fxUtils.wipeIn({
  859. node: wipeNode,
  860. duration: this.duration,
  861. beforeBegin: function(){
  862. hideNode.style.display="";
  863. }
  864. });
  865. this._wipeOut = fxUtils.wipeOut({
  866. node: wipeNode,
  867. duration: this.duration,
  868. onEnd: function(){
  869. hideNode.style.display="none";
  870. }
  871. });
  872. },
  873. _setOpenAttr: function(/*Boolean*/ open, /*Boolean*/ animate){
  874. // summary:
  875. // Hook to make set("open", boolean) control the open/closed state of the pane.
  876. // open: Boolean
  877. // True if you want to open the pane, false if you want to close it.
  878. array.forEach([this._wipeIn, this._wipeOut], function(animation){
  879. if(animation && animation.status() == "playing"){
  880. animation.stop();
  881. }
  882. });
  883. if(animate){
  884. var anim = this[open ? "_wipeIn" : "_wipeOut"];
  885. anim.play();
  886. }else{
  887. this.hideNode.style.display = this.wipeNode.style.display = open ? "" : "none";
  888. }
  889. // load content (if this is the first time we are opening the TitlePane
  890. // and content is specified as an href, or href was set when hidden)
  891. if(this._started){
  892. if(open){
  893. this._onShow();
  894. }else{
  895. this.onHide();
  896. }
  897. }
  898. this.arrowNodeInner.innerHTML = open ? "-" : "+";
  899. this.containerNode.setAttribute("aria-hidden", open ? "false" : "true");
  900. this.focusNode.setAttribute("aria-pressed", open ? "true" : "false");
  901. this._set("open", open);
  902. this._setCss();
  903. },
  904. _setToggleableAttr: function(/*Boolean*/ canToggle){
  905. // summary:
  906. // Hook to make set("toggleable", boolean) work.
  907. // canToggle: Boolean
  908. // True to allow user to open/close pane by clicking title bar.
  909. this.focusNode.setAttribute("role", canToggle ? "button" : "heading");
  910. if(canToggle){
  911. // TODO: if canToggle is switched from true to false shouldn't we remove this setting?
  912. this.focusNode.setAttribute("aria-controls", this.id+"_pane");
  913. domAttr.set(this.focusNode, "tabIndex", this.tabIndex);
  914. }else{
  915. domAttr.remove(this.focusNode, "tabIndex");
  916. }
  917. this._set("toggleable", canToggle);
  918. this._setCss();
  919. },
  920. _setContentAttr: function(/*String|DomNode|Nodelist*/ content){
  921. // summary:
  922. // Hook to make set("content", ...) work.
  923. // Typically called when an href is loaded. Our job is to make the animation smooth.
  924. if(!this.open || !this._wipeOut || this._wipeOut.status() == "playing"){
  925. // we are currently *closing* the pane (or the pane is closed), so just let that continue
  926. this.inherited(arguments);
  927. }else{
  928. if(this._wipeIn && this._wipeIn.status() == "playing"){
  929. this._wipeIn.stop();
  930. }
  931. // freeze container at current height so that adding new content doesn't make it jump
  932. domGeometry.setMarginBox(this.wipeNode, { h: domGeometry.getMarginBox(this.wipeNode).h });
  933. // add the new content (erasing the old content, if any)
  934. this.inherited(arguments);
  935. // call _wipeIn.play() to animate from current height to new height
  936. if(this._wipeIn){
  937. this._wipeIn.play();
  938. }else{
  939. this.hideNode.style.display = "";
  940. }
  941. }
  942. },
  943. toggle: function(){
  944. // summary:
  945. // Switches between opened and closed state
  946. // tags:
  947. // private
  948. this._setOpenAttr(!this.open, true);
  949. },
  950. _setCss: function(){
  951. // summary:
  952. // Set the open/close css state for the TitlePane
  953. // tags:
  954. // private
  955. var node = this.titleBarNode || this.focusNode;
  956. var oldCls = this._titleBarClass;
  957. this._titleBarClass = "dijit" + (this.toggleable ? "" : "Fixed") + (this.open ? "Open" : "Closed");
  958. domClass.replace(node, this._titleBarClass, oldCls || "");
  959. this.arrowNodeInner.innerHTML = this.open ? "-" : "+";
  960. },
  961. _onTitleKey: function(/*Event*/ e){
  962. // summary:
  963. // Handler for when user hits a key
  964. // tags:
  965. // private
  966. if(e.keyCode == keys.ENTER || e.keyCode == keys.SPACE){
  967. if(this.toggleable){
  968. this.toggle();
  969. event.stop(e);
  970. }
  971. }else if(e.keyCode == keys.DOWN_ARROW && this.open){
  972. this.containerNode.focus();
  973. e.preventDefault();
  974. }
  975. },
  976. _onTitleClick: function(){
  977. // summary:
  978. // Handler when user clicks the title bar
  979. // tags:
  980. // private
  981. if(this.toggleable){
  982. this.toggle();
  983. }
  984. },
  985. setTitle: function(/*String*/ title){
  986. // summary:
  987. // Deprecated. Use set('title', ...) instead.
  988. // tags:
  989. // deprecated
  990. kernel.deprecated("dijit.TitlePane.setTitle() is deprecated. Use set('title', ...) instead.", "", "2.0");
  991. this.set("title", title);
  992. }
  993. });
  994. });
  995. },
  996. 'dijit/form/_ComboBoxMenuMixin':function(){
  997. define("dijit/form/_ComboBoxMenuMixin", [
  998. "dojo/_base/array", // array.forEach
  999. "dojo/_base/declare", // declare
  1000. "dojo/dom-attr", // domAttr.set
  1001. "dojo/i18n", // i18n.getLocalization
  1002. "dojo/_base/window", // win.doc.createTextNode
  1003. "dojo/i18n!./nls/ComboBox"
  1004. ], function(array, declare, domAttr, i18n, win){
  1005. // module:
  1006. // dijit/form/_ComboBoxMenuMixin
  1007. // summary:
  1008. // Focus-less menu for internal use in `dijit.form.ComboBox`
  1009. return declare( "dijit.form._ComboBoxMenuMixin", null, {
  1010. // summary:
  1011. // Focus-less menu for internal use in `dijit.form.ComboBox`
  1012. // tags:
  1013. // private
  1014. // _messages: Object
  1015. // Holds "next" and "previous" text for paging buttons on drop down
  1016. _messages: null,
  1017. postMixInProperties: function(){
  1018. this.inherited(arguments);
  1019. this._messages = i18n.getLocalization("dijit.form", "ComboBox", this.lang);
  1020. },
  1021. buildRendering: function(){
  1022. this.inherited(arguments);
  1023. // fill in template with i18n messages
  1024. this.previousButton.innerHTML = this._messages["previousMessage"];
  1025. this.nextButton.innerHTML = this._messages["nextMessage"];
  1026. },
  1027. _setValueAttr: function(/*Object*/ value){
  1028. this.value = value;
  1029. this.onChange(value);
  1030. },
  1031. onClick: function(/*DomNode*/ node){
  1032. if(node == this.previousButton){
  1033. this._setSelectedAttr(null);
  1034. this.onPage(-1);
  1035. }else if(node == this.nextButton){
  1036. this._setSelectedAttr(null);
  1037. this.onPage(1);
  1038. }else{
  1039. this.onChange(node);
  1040. }
  1041. },
  1042. // stubs
  1043. onChange: function(/*Number*/ /*===== direction =====*/){
  1044. // summary:
  1045. // Notifies ComboBox/FilteringSelect that user selected an option.
  1046. // tags:
  1047. // callback
  1048. },
  1049. onPage: function(/*Number*/ /*===== direction =====*/){
  1050. // summary:
  1051. // Notifies ComboBox/FilteringSelect that user clicked to advance to next/previous page.
  1052. // tags:
  1053. // callback
  1054. },
  1055. onClose: function(){
  1056. // summary:
  1057. // Callback from dijit.popup code to this widget, notifying it that it closed
  1058. // tags:
  1059. // private
  1060. this._setSelectedAttr(null);
  1061. },
  1062. _createOption: function(/*Object*/ item, labelFunc){
  1063. // summary:
  1064. // Creates an option to appear on the popup menu subclassed by
  1065. // `dijit.form.FilteringSelect`.
  1066. var menuitem = this._createMenuItem();
  1067. var labelObject = labelFunc(item);
  1068. if(labelObject.html){
  1069. menuitem.innerHTML = labelObject.label;
  1070. }else{
  1071. menuitem.appendChild(
  1072. win.doc.createTextNode(labelObject.label)
  1073. );
  1074. }
  1075. // #3250: in blank options, assign a normal height
  1076. if(menuitem.innerHTML == ""){
  1077. menuitem.innerHTML = "&#160;"; // &nbsp;
  1078. }
  1079. // update menuitem.dir if BidiSupport was required
  1080. this.applyTextDir(menuitem, (menuitem.innerText || menuitem.textContent || ""));
  1081. menuitem.item=item;
  1082. return menuitem;
  1083. },
  1084. createOptions: function(results, options, labelFunc){
  1085. // summary:
  1086. // Fills in the items in the drop down list
  1087. // results:
  1088. // Array of items
  1089. // options:
  1090. // The options to the query function of the store
  1091. //
  1092. // labelFunc:
  1093. // Function to produce a label in the drop down list from a dojo.data item
  1094. this.items = results;
  1095. // display "Previous . . ." button
  1096. this.previousButton.style.display = (options.start == 0) ? "none" : "";
  1097. domAttr.set(this.previousButton, "id", this.id + "_prev");
  1098. // create options using _createOption function defined by parent
  1099. // ComboBox (or FilteringSelect) class
  1100. // #2309:
  1101. // iterate over cache nondestructively
  1102. array.forEach(results, function(item, i){
  1103. var menuitem = this._createOption(item, labelFunc);
  1104. menuitem.setAttribute("item", i); // index to this.items; use indirection to avoid mem leak
  1105. domAttr.set(menuitem, "id", this.id + i);
  1106. this.nextButton.parentNode.insertBefore(menuitem, this.nextButton);
  1107. }, this);
  1108. // display "Next . . ." button
  1109. var displayMore = false;
  1110. // Try to determine if we should show 'more'...
  1111. if(results.total && !results.total.then && results.total != -1){
  1112. if((options.start + options.count) < results.total){
  1113. displayMore = true;
  1114. }else if((options.start + options.count) > results.total && options.count == results.length){
  1115. // Weird return from a data store, where a start + count > maxOptions
  1116. // implies maxOptions isn't really valid and we have to go into faking it.
  1117. // And more or less assume more if count == results.length
  1118. displayMore = true;
  1119. }
  1120. }else if(options.count == results.length){
  1121. //Don't know the size, so we do the best we can based off count alone.
  1122. //So, if we have an exact match to count, assume more.
  1123. displayMore = true;
  1124. }
  1125. this.nextButton.style.display = displayMore ? "" : "none";
  1126. domAttr.set(this.nextButton,"id", this.id + "_next");
  1127. },
  1128. clearResultList: function(){
  1129. // summary:
  1130. // Clears the entries in the drop down list, but of course keeps the previous and next buttons.
  1131. var container = this.containerNode;
  1132. while(container.childNodes.length > 2){
  1133. container.removeChild(container.childNodes[container.childNodes.length-2]);
  1134. }
  1135. this._setSelectedAttr(null);
  1136. },
  1137. highlightFirstOption: function(){
  1138. // summary:
  1139. // Highlight the first real item in the list (not Previous Choices).
  1140. this.selectFirstNode();
  1141. },
  1142. highlightLastOption: function(){
  1143. // summary:
  1144. // Highlight the last real item in the list (not More Choices).
  1145. this.selectLastNode();
  1146. },
  1147. selectFirstNode: function(){
  1148. this.inherited(arguments);
  1149. if(this.getHighlightedOption() == this.previousButton){
  1150. this.selectNextNode();
  1151. }
  1152. },
  1153. selectLastNode: function(){
  1154. this.inherited(arguments);
  1155. if(this.getHighlightedOption() == this.nextButton){
  1156. this.selectPreviousNode();
  1157. }
  1158. },
  1159. getHighlightedOption: function(){
  1160. return this._getSelectedAttr();
  1161. }
  1162. });
  1163. });
  1164. },
  1165. 'dijit/form/_AutoCompleterMixin':function(){
  1166. define("dijit/form/_AutoCompleterMixin", [
  1167. "dojo/_base/connect", // keys keys.SHIFT
  1168. "dojo/data/util/filter", // patternToRegExp
  1169. "dojo/_base/declare", // declare
  1170. "dojo/_base/Deferred", // Deferred.when
  1171. "dojo/dom-attr", // domAttr.get
  1172. "dojo/_base/event", // event.stop
  1173. "dojo/keys",
  1174. "dojo/_base/lang", // lang.clone lang.hitch
  1175. "dojo/on",
  1176. "dojo/query", // query
  1177. "dojo/regexp", // regexp.escapeString
  1178. "dojo/_base/sniff", // has("ie")
  1179. "dojo/string", // string.substitute
  1180. "dojo/_base/window", // win.doc.selection.createRange
  1181. "./DataList",
  1182. "../registry", // registry.byId
  1183. "./_TextBoxMixin" // defines _TextBoxMixin.selectInputText
  1184. ], function(connect, filter, declare, Deferred, domAttr, event, keys, lang, on, query, regexp, has, string, win,
  1185. DataList, registry, _TextBoxMixin){
  1186. // module:
  1187. // dijit/form/_AutoCompleterMixin
  1188. // summary:
  1189. // A mixin that implements the base functionality for `dijit.form.ComboBox`/`dijit.form.FilteringSelect`
  1190. return declare("dijit.form._AutoCompleterMixin", null, {
  1191. // summary:
  1192. // A mixin that implements the base functionality for `dijit.form.ComboBox`/`dijit.form.FilteringSelect`
  1193. // description:
  1194. // All widgets that mix in dijit.form._AutoCompleterMixin must extend `dijit.form._FormValueWidget`.
  1195. // tags:
  1196. // protected
  1197. // item: Object
  1198. // This is the item returned by the dojo.data.store implementation that
  1199. // provides the data for this ComboBox, it's the currently selected item.
  1200. item: null,
  1201. // pageSize: Integer
  1202. // Argument to data provider.
  1203. // Specifies number of search results per page (before hitting "next" button)
  1204. pageSize: Infinity,
  1205. // store: [const] dojo.store.api.Store
  1206. // Reference to data provider object used by this ComboBox
  1207. store: null,
  1208. // fetchProperties: Object
  1209. // Mixin to the store's fetch.
  1210. // For example, to set the sort order of the ComboBox menu, pass:
  1211. // | { sort: [{attribute:"name",descending: true}] }
  1212. // To override the default queryOptions so that deep=false, do:
  1213. // | { queryOptions: {ignoreCase: true, deep: false} }
  1214. fetchProperties:{},
  1215. // query: Object
  1216. // A query that can be passed to 'store' to initially filter the items,
  1217. // before doing further filtering based on `searchAttr` and the key.
  1218. // Any reference to the `searchAttr` is ignored.
  1219. query: {},
  1220. // list: [const] String
  1221. // Alternate to specifying a store. Id of a dijit/form/DataList widget.
  1222. list: "",
  1223. _setListAttr: function(list){
  1224. // Avoid having list applied to the DOM node, since it has native meaning in modern browsers
  1225. this._set("list", list);
  1226. },
  1227. // autoComplete: Boolean
  1228. // If user types in a partial string, and then tab out of the `<input>` box,
  1229. // automatically copy the first entry displayed in the drop down list to
  1230. // the `<input>` field
  1231. autoComplete: true,
  1232. // highlightMatch: String
  1233. // One of: "first", "all" or "none".
  1234. //
  1235. // If the ComboBox/FilteringSelect opens with the search results and the searched
  1236. // string can be found, it will be highlighted. If set to "all"
  1237. // then will probably want to change `queryExpr` parameter to '*${0}*'
  1238. //
  1239. // Highlighting is only performed when `labelType` is "text", so as to not
  1240. // interfere with any HTML markup an HTML label might contain.
  1241. highlightMatch: "first",
  1242. // searchDelay: Integer
  1243. // Delay in milliseconds between when user types something and we start
  1244. // searching based on that value
  1245. searchDelay: 100,
  1246. // searchAttr: String
  1247. // Search for items in the data store where this attribute (in the item)
  1248. // matches what the user typed
  1249. searchAttr: "name",
  1250. // labelAttr: String?
  1251. // The entries in the drop down list come from this attribute in the
  1252. // dojo.data items.
  1253. // If not specified, the searchAttr attribute is used instead.
  1254. labelAttr: "",
  1255. // labelType: String
  1256. // Specifies how to interpret the labelAttr in the data store items.
  1257. // Can be "html" or "text".
  1258. labelType: "text",
  1259. // queryExpr: String
  1260. // This specifies what query ComboBox/FilteringSelect sends to the data store,
  1261. // based on what the user has typed. Changing this expression will modify
  1262. // whether the drop down shows only exact matches, a "starting with" match,
  1263. // etc. Use it in conjunction with highlightMatch.
  1264. // dojo.data query expression pattern.
  1265. // `${0}` will be substituted for the user text.
  1266. // `*` is used for wildcards.
  1267. // `${0}*` means "starts with", `*${0}*` means "contains", `${0}` means "is"
  1268. queryExpr: "${0}*",
  1269. // ignoreCase: Boolean
  1270. // Set true if the ComboBox/FilteringSelect should ignore case when matching possible items
  1271. ignoreCase: true,
  1272. // Flags to _HasDropDown to limit height of drop down to make it fit in viewport
  1273. maxHeight: -1,
  1274. // For backwards compatibility let onClick events propagate, even clicks on the down arrow button
  1275. _stopClickEvents: false,
  1276. _getCaretPos: function(/*DomNode*/ element){
  1277. // khtml 3.5.2 has selection* methods as does webkit nightlies from 2005-06-22
  1278. var pos = 0;
  1279. if(typeof(element.selectionStart) == "number"){
  1280. // FIXME: this is totally borked on Moz < 1.3. Any recourse?
  1281. pos = element.selectionStart;
  1282. }else if(has("ie")){
  1283. // in the case of a mouse click in a popup being handled,
  1284. // then the win.doc.selection is not the textarea, but the popup
  1285. // var r = win.doc.selection.createRange();
  1286. // hack to get IE 6 to play nice. What a POS browser.
  1287. var tr = win.doc.selection.createRange().duplicate();
  1288. var ntr = element.createTextRange();
  1289. tr.move("character",0);
  1290. ntr.move("character",0);
  1291. try{
  1292. // If control doesn't have focus, you get an exception.
  1293. // Seems to happen on reverse-tab, but can also happen on tab (seems to be a race condition - only happens sometimes).
  1294. // There appears to be no workaround for this - googled for quite a while.
  1295. ntr.setEndPoint("EndToEnd", tr);
  1296. pos = String(ntr.text).replace(/\r/g,"").length;
  1297. }catch(e){
  1298. // If focus has shifted, 0 is fine for caret pos.
  1299. }
  1300. }
  1301. return pos;
  1302. },
  1303. _setCaretPos: function(/*DomNode*/ element, /*Number*/ location){
  1304. location = parseInt(location);
  1305. _TextBoxMixin.selectInputText(element, location, location);
  1306. },
  1307. _setDisabledAttr: function(/*Boolean*/ value){
  1308. // Additional code to set disabled state of ComboBox node.
  1309. // Overrides _FormValueWidget._setDisabledAttr() or ValidationTextBox._setDisabledAttr().
  1310. this.inherited(arguments);
  1311. this.domNode.setAttribute("aria-disabled", value);
  1312. },
  1313. _abortQuery: function(){
  1314. // stop in-progress query
  1315. if(this.searchTimer){
  1316. clearTimeout(this.searchTimer);
  1317. this.searchTimer = null;
  1318. }
  1319. if(this._fetchHandle){
  1320. if(this._fetchHandle.cancel){
  1321. this._cancelingQuery = true;
  1322. this._fetchHandle.cancel();
  1323. this._cancelingQuery = false;
  1324. }
  1325. this._fetchHandle = null;
  1326. }
  1327. },
  1328. _onInput: function(/*Event*/ evt){
  1329. // summary:
  1330. // Handles paste events.
  1331. this.inherited(arguments);
  1332. if(evt.charOrCode == 229){ // IME or cut/paste event
  1333. this._onKeyPress(evt);
  1334. }
  1335. },
  1336. _onKey: function(/*Event*/ evt){
  1337. // summary:
  1338. // Handles keyboard events from synthetic dojo/_base/connect._keypress event
  1339. if(this.disabled || this.readOnly){ return; }
  1340. var key = evt.keyCode;
  1341. // except for cutting/pasting case - ctrl + x/v
  1342. if(evt.altKey || ((evt.ctrlKey || evt.metaKey) && (key != 86 && key != 88)) || key == keys.SHIFT){
  1343. return; // throw out weird key combinations and spurious events
  1344. }
  1345. var doSearch = false;
  1346. var pw = this.dropDown;
  1347. var highlighted = null;
  1348. this._prev_key_backspace = false;
  1349. this._abortQuery();
  1350. // _HasDropDown will do some of the work:
  1351. // 1. when drop down is not yet shown:
  1352. // - if user presses the down arrow key, call loadDropDown()
  1353. // 2. when drop down is already displayed:
  1354. // - on ESC key, call closeDropDown()
  1355. // - otherwise, call dropDown.handleKey() to process the keystroke
  1356. this.inherited(arguments);
  1357. if(this._opened){
  1358. highlighted = pw.getHighlightedOption();
  1359. }
  1360. switch(key){
  1361. case keys.PAGE_DOWN:
  1362. case keys.DOWN_ARROW:
  1363. case keys.PAGE_UP:
  1364. case keys.UP_ARROW:
  1365. // Keystroke caused ComboBox_menu to move to a different item.
  1366. // Copy new item to <input> box.
  1367. if(this._opened){
  1368. this._announceOption(highlighted);
  1369. }
  1370. event.stop(evt);
  1371. break;
  1372. case keys.ENTER:
  1373. // prevent submitting form if user presses enter. Also
  1374. // prevent accepting the value if either Next or Previous
  1375. // are selected
  1376. if(highlighted){
  1377. // only stop event on prev/next
  1378. if(highlighted == pw.nextButton){
  1379. this._nextSearch(1);
  1380. event.stop(evt);
  1381. break;
  1382. }else if(highlighted == pw.previousButton){
  1383. this._nextSearch(-1);
  1384. event.stop(evt);
  1385. break;
  1386. }
  1387. }else{
  1388. // Update 'value' (ex: KY) according to currently displayed text
  1389. this._setBlurValue(); // set value if needed
  1390. this._setCaretPos(this.focusNode, this.focusNode.value.length); // move cursor to end and cancel highlighting
  1391. }
  1392. // default case:
  1393. // if enter pressed while drop down is open, or for FilteringSelect,
  1394. // if we are in the middle of a query to convert a directly typed in value to an item,
  1395. // prevent submit
  1396. if(this._opened || this._fetchHandle){
  1397. event.stop(evt);
  1398. }
  1399. // fall through
  1400. case keys.TAB:
  1401. var newvalue = this.get('displayedValue');
  1402. // if the user had More Choices selected fall into the
  1403. // _onBlur handler
  1404. if(pw && (
  1405. newvalue == pw._messages["previousMessage"] ||
  1406. newvalue == pw._messages["nextMessage"])
  1407. ){
  1408. break;
  1409. }
  1410. if(highlighted){
  1411. this._selectOption(highlighted);
  1412. }
  1413. // fall through
  1414. case keys.ESCAPE:
  1415. if(this._opened){
  1416. this._lastQuery = null; // in case results come back later
  1417. this.closeDropDown();
  1418. }
  1419. break;
  1420. case ' ':
  1421. if(highlighted){
  1422. // user is effectively clicking a choice in the drop down menu
  1423. event.stop(evt);
  1424. this._selectOption(highlighted);
  1425. this.closeDropDown();
  1426. }else{
  1427. // user typed a space into the input box, treat as normal character
  1428. doSearch = true;
  1429. }
  1430. break;
  1431. case keys.DELETE:
  1432. case keys.BACKSPACE:
  1433. this._prev_key_backspace = true;
  1434. doSearch = true;
  1435. break;
  1436. }
  1437. if(doSearch){
  1438. // need to wait a tad before start search so that the event
  1439. // bubbles through DOM and we have value visible
  1440. this.item = undefined; // undefined means item needs to be set
  1441. this.searchTimer = setTimeout(lang.hitch(this, "_startSearchFromInput"),1);
  1442. }
  1443. },
  1444. _onKeyPress: function(evt){
  1445. // Non char keys (F1-F12 etc..) shouldn't open list.
  1446. // Ascii characters and IME input (Chinese, Japanese etc.) should.
  1447. if(typeof evt.charOrCode == "string" || evt.charOrCode == 229){
  1448. // need to wait a tad before start search so that the event
  1449. // bubbles through DOM and we have value visible
  1450. this.item = undefined; // undefined means item needs to be set
  1451. this.searchTimer = setTimeout(lang.hitch(this, "_startSearchFromInput"),1);
  1452. }
  1453. },
  1454. _autoCompleteText: function(/*String*/ text){
  1455. // summary:
  1456. // Fill in the textbox with the first item from the drop down
  1457. // list, and highlight the characters that were
  1458. // auto-completed. For example, if user typed "CA" and the
  1459. // drop down list appeared, the textbox would be changed to
  1460. // "California" and "ifornia" would be highlighted.
  1461. var fn = this.focusNode;
  1462. // IE7: clear selection so next highlight works all the time
  1463. _TextBoxMixin.selectInputText(fn, fn.value.length);
  1464. // does text autoComplete the value in the textbox?
  1465. var caseFilter = this.ignoreCase? 'toLowerCase' : 'substr';
  1466. if(text[caseFilter](0).indexOf(this.focusNode.value[caseFilter](0)) == 0){
  1467. var cpos = this.autoComplete ? this._getCaretPos(fn) : fn.value.length;
  1468. // only try to extend if we added the last character at the end of the input
  1469. if((cpos+1) > fn.value.length){
  1470. // only add to input node as we would overwrite Capitalisation of chars
  1471. // actually, that is ok
  1472. fn.value = text;//.substr(cpos);
  1473. // visually highlight the autocompleted characters
  1474. _TextBoxMixin.selectInputText(fn, cpos);
  1475. }
  1476. }else{
  1477. // text does not autoComplete; replace the whole value and highlight
  1478. fn.value = text;
  1479. _TextBoxMixin.selectInputText(fn);
  1480. }
  1481. },
  1482. _openResultList: function(/*Object*/ results, /*Object*/ query, /*Object*/ options){
  1483. // summary:
  1484. // Callback when a search completes.
  1485. // description:
  1486. // 1. generates drop-down list and calls _showResultList() to display it
  1487. // 2. if this result list is from user pressing "more choices"/"previous choices"
  1488. // then tell screen reader to announce new option
  1489. this._fetchHandle = null;
  1490. if( this.disabled ||
  1491. this.readOnly ||
  1492. (query[this.searchAttr] !== this._lastQuery) // TODO: better way to avoid getting unwanted notify
  1493. ){
  1494. return;
  1495. }
  1496. var wasSelected = this.dropDown.getHighlightedOption();
  1497. this.dropDown.clearResultList();
  1498. if(!results.length && options.start == 0){ // if no results and not just the previous choices button
  1499. this.closeDropDown();
  1500. return;
  1501. }
  1502. // Fill in the textbox with the first item from the drop down list,
  1503. // and highlight the characters that were auto-completed. For
  1504. // example, if user typed "CA" and the drop down list appeared, the
  1505. // textbox would be changed to "California" and "ifornia" would be
  1506. // highlighted.
  1507. this.dropDown.createOptions(
  1508. results,
  1509. options,
  1510. lang.hitch(this, "_getMenuLabelFromItem")
  1511. );
  1512. // show our list (only if we have content, else nothing)
  1513. this._showResultList();
  1514. // #4091:
  1515. // tell the screen reader that the paging callback finished by
  1516. // shouting the next choice
  1517. if(options.direction){
  1518. if(1 == options.direction){
  1519. this.dropDown.highlightFirstOption();
  1520. }else if(-1 == options.direction){
  1521. this.dropDown.highlightLastOption();
  1522. }
  1523. if(wasSelected){
  1524. this._announceOption(this.dropDown.getHighlightedOption());
  1525. }
  1526. }else if(this.autoComplete && !this._prev_key_backspace
  1527. // when the user clicks the arrow button to show the full list,
  1528. // startSearch looks for "*".
  1529. // it does not make sense to autocomplete
  1530. // if they are just previewing the options available.
  1531. && !/^[*]+$/.test(query[this.searchAttr].toString())){
  1532. this._announceOption(this.dropDown.containerNode.firstChild.nextSibling); // 1st real item
  1533. }
  1534. },
  1535. _showResultList: function(){
  1536. // summary:
  1537. // Display the drop down if not already displayed, or if it is displayed, then
  1538. // reposition it if necessary (reposition may be necessary if drop down's height changed).
  1539. this.closeDropDown(true);
  1540. this.openDropDown();
  1541. this.domNode.setAttribute("aria-expanded", "true");
  1542. },
  1543. loadDropDown: function(/*Function*/ /*===== callback =====*/){
  1544. // Overrides _HasDropDown.loadDropDown().
  1545. // This is called when user has pressed button icon or pressed the down arrow key
  1546. // to open the drop down.
  1547. this._startSearchAll();
  1548. },
  1549. isLoaded: function(){
  1550. // signal to _HasDropDown that it needs to call loadDropDown() to load the
  1551. // drop down asynchronously before displaying it
  1552. return false;
  1553. },
  1554. closeDropDown: function(){
  1555. // Overrides _HasDropDown.closeDropDown(). Closes the drop down (assuming that it's open).
  1556. // This method is the callback when the user types ESC or clicking
  1557. // the button icon while the drop down is open. It's also called by other code.
  1558. this._abortQuery();
  1559. if(this._opened){
  1560. this.inherited(arguments);
  1561. this.domNode.setAttribute("aria-expanded", "false");
  1562. this.focusNode.removeAttribute("aria-activedescendant");
  1563. }
  1564. },
  1565. _setBlurValue: function(){
  1566. // if the user clicks away from the textbox OR tabs away, set the
  1567. // value to the textbox value
  1568. // #4617:
  1569. // if value is now more choices or previous choices, revert
  1570. // the value
  1571. var newvalue = this.get('displayedValue');
  1572. var pw = this.dropDown;
  1573. if(pw && (
  1574. newvalue == pw._messages["previousMessage"] ||
  1575. newvalue == pw._messages["nextMessage"]
  1576. )
  1577. ){
  1578. this._setValueAttr(this._lastValueReported, true);
  1579. }else if(typeof this.item == "undefined"){
  1580. // Update 'value' (ex: KY) according to currently displayed text
  1581. this.item = null;
  1582. this.set('displayedValue', newvalue);
  1583. }else{
  1584. if(this.value != this._lastValueReported){
  1585. this._handleOnChange(this.value, true);
  1586. }
  1587. this._refreshState();
  1588. }
  1589. },
  1590. _setItemAttr: function(/*item*/ item, /*Boolean?*/ priorityChange, /*String?*/ displayedValue){
  1591. // summary:
  1592. // Set the displayed valued in the input box, and the hidden value
  1593. // that gets submitted, based on a dojo.data store item.
  1594. // description:
  1595. // Users shouldn't call this function; they should be calling
  1596. // set('item', value)
  1597. // tags:
  1598. // private
  1599. var value = '';
  1600. if(item){
  1601. if(!displayedValue){
  1602. displayedValue = this.store._oldAPI ? // remove getValue() for 2.0 (old dojo.data API)
  1603. this.store.getValue(item, this.searchAttr) : item[this.searchAttr];
  1604. }
  1605. value = this._getValueField() != this.searchAttr ? this.store.getIdentity(item) : displayedValue;
  1606. }
  1607. this.set('value', value, priorityChange, displayedValue, item);
  1608. },
  1609. _announceOption: function(/*Node*/ node){
  1610. // summary:
  1611. // a11y code that puts the highlighted option in the textbox.
  1612. // This way screen readers will know what is happening in the
  1613. // menu.
  1614. if(!node){
  1615. return;
  1616. }
  1617. // pull the text value from the item attached to the DOM node
  1618. var newValue;
  1619. if(node == this.dropDown.nextButton ||
  1620. node == this.dropDown.previousButton){
  1621. newValue = node.innerHTML;
  1622. this.item = undefined;
  1623. this.value = '';
  1624. }else{
  1625. var item = this.dropDown.items[node.getAttribute("item")];
  1626. newValue = (this.store._oldAPI ? // remove getValue() for 2.0 (old dojo.data API)
  1627. this.store.getValue(item, this.searchAttr) : item[this.searchAttr]).toString();
  1628. this.set('item', item, false, newValue);
  1629. }
  1630. // get the text that the user manually entered (cut off autocompleted text)
  1631. this.focusNode.value = this.focusNode.value.substring(0, this._lastInput.length);
  1632. // set up ARIA activedescendant
  1633. this.focusNode.setAttribute("aria-activedescendant", domAttr.get(node, "id"));
  1634. // autocomplete the rest of the option to announce change
  1635. this._autoCompleteText(newValue);
  1636. },
  1637. _selectOption: function(/*DomNode*/ target){
  1638. // summary:
  1639. // Menu callback function, called when an item in the menu is selected.
  1640. this.closeDropDown();
  1641. if(target){
  1642. this._announceOption(target);
  1643. }
  1644. this._setCaretPos(this.focusNode, this.focusNode.value.length);
  1645. this._handleOnChange(this.value, true);
  1646. },
  1647. _startSearchAll: function(){
  1648. this._startSearch('');
  1649. },
  1650. _startSearchFromInput: function(){
  1651. this._startSearch(this.focusNode.value.replace(/([\\\*\?])/g, "\\$1"));
  1652. },
  1653. _getQueryString: function(/*String*/ text){
  1654. return string.substitute(this.queryExpr, [text]);
  1655. },
  1656. _startSearch: function(/*String*/ key){
  1657. // summary:
  1658. // Starts a search for elements matching key (key=="" means to return all items),
  1659. // and calls _openResultList() when the search completes, to display the results.
  1660. if(!this.dropDown){
  1661. var popupId = this.id + "_popup",
  1662. dropDownConstructor = lang.isString(this.dropDownClass) ?
  1663. lang.getObject(this.dropDownClass, false) : this.dropDownClass;
  1664. this.dropDown = new dropDownConstructor({
  1665. onChange: lang.hitch(this, this._selectOption),
  1666. id: popupId,
  1667. dir: this.dir,
  1668. textDir: this.textDir
  1669. });
  1670. this.focusNode.removeAttribute("aria-activedescendant");
  1671. this.textbox.setAttribute("aria-owns",popupId); // associate popup with textbox
  1672. }
  1673. this._lastInput = key; // Store exactly what was entered by the user.
  1674. // Setup parameters to be passed to store.query().
  1675. // Create a new query to prevent accidentally querying for a hidden
  1676. // value from FilteringSelect's keyField
  1677. var query = lang.clone(this.query); // #5970
  1678. var options = {
  1679. start: 0,
  1680. count: this.pageSize,
  1681. queryOptions: { // remove for 2.0
  1682. ignoreCase: this.ignoreCase,
  1683. deep: true
  1684. }
  1685. };
  1686. lang.mixin(options, this.fetchProperties);
  1687. // Generate query
  1688. var qs = this._getQueryString(key), q;
  1689. if(this.store._oldAPI){
  1690. // remove this branch for 2.0
  1691. q = qs;
  1692. }else{
  1693. // Query on searchAttr is a regex for benefit of dojo.store.Memory,
  1694. // but with a toString() method to help dojo.store.JsonRest.
  1695. // Search string like "Co*" converted to regex like /^Co.*$/i.
  1696. q = filter.patternToRegExp(qs, this.ignoreCase);
  1697. q.toString = function(){ return qs; };
  1698. }
  1699. this._lastQuery = query[this.searchAttr] = q;
  1700. // Function to run the query, wait for the results, and then call _openResultList()
  1701. var _this = this,
  1702. startQuery = function(){
  1703. var resPromise = _this._fetchHandle = _this.store.query(query, options);
  1704. Deferred.when(resPromise, function(res){
  1705. _this._fetchHandle = null;
  1706. res.total = resPromise.total;
  1707. _this._openResultList(res, query, options);
  1708. }, function(err){
  1709. _this._fetchHandle = null;
  1710. if(!_this._cancelingQuery){ // don't treat canceled query as an error
  1711. console.error(_this.declaredClass + ' ' + err.toString());
  1712. _this.closeDropDown();
  1713. }
  1714. });
  1715. };
  1716. // #5970: set _lastQuery, *then* start the timeout
  1717. // otherwise, if the user types and the last query returns before the timeout,
  1718. // _lastQuery won't be set and their input gets rewritten
  1719. this.searchTimer = setTimeout(lang.hitch(this, function(query, _this){
  1720. this.searchTimer = null;
  1721. startQuery();
  1722. // Setup method to handle clicking next/previous buttons to page through results
  1723. this._nextSearch = this.dropDown.onPage = function(direction){
  1724. options.start += options.count * direction;
  1725. // tell callback the direction of the paging so the screen
  1726. // reader knows which menu option to shout
  1727. options.direction = direction;
  1728. startQuery();
  1729. _this.focus();
  1730. };
  1731. }, query, this), this.searchDelay);
  1732. },
  1733. _getValueField: function(){
  1734. // summary:
  1735. // Helper for postMixInProperties() to set this.value based on data inlined into the markup.
  1736. // Returns the attribute name in the item (in dijit.form._ComboBoxDataStore) to use as the value.
  1737. return this.searchAttr;
  1738. },
  1739. //////////// INITIALIZATION METHODS ///////////////////////////////////////
  1740. constructor: function(){
  1741. this.query={};
  1742. this.fetchProperties={};
  1743. },
  1744. postMixInProperties: function(){
  1745. if(!this.store){
  1746. var srcNodeRef = this.srcNodeRef;
  1747. var list = this.list;
  1748. if(list){
  1749. this.store = registry.byId(list);
  1750. }else{
  1751. // if user didn't specify store, then assume there are option tags
  1752. this.store = new DataList({}, srcNodeRef);
  1753. }
  1754. // if there is no value set and there is an option list, set
  1755. // the value to the first value to be consistent with native Select
  1756. // Firefox and Safari set value
  1757. // IE6 and Opera set selectedIndex, which is automatically set
  1758. // by the selected attribute of an option tag
  1759. // IE6 does not set value, Opera sets value = selectedIndex
  1760. if(!("value" in this.params)){
  1761. var item = (this.item = this.store.fetchSelectedItem());
  1762. if(item){
  1763. var valueField = this._getValueField();
  1764. // remove getValue() for 2.0 (old dojo.data API)
  1765. this.value = this.store._oldAPI ? this.store.getValue(item, valueField) : item[valueField];
  1766. }
  1767. }
  1768. }
  1769. this.inherited(arguments);
  1770. },
  1771. postCreate: function(){
  1772. // summary:
  1773. // Subclasses must call this method from their postCreate() methods
  1774. // tags:
  1775. // protected
  1776. // find any associated label element and add to ComboBox node.
  1777. var label=query('label[for="'+this.id+'"]');
  1778. if(label.length){
  1779. label[0].id = (this.id+"_label");
  1780. this.domNode.setAttribute("aria-labelledby", label[0].id);
  1781. }
  1782. this.inherited(arguments);
  1783. // HasDropDown calls _onKey() on keydown but we want to be notified of the synthetic
  1784. // dojo/_base/connect._keypress event too.
  1785. this.connect(this.focusNode, "onkeypress", "_onKeyPress");
  1786. },
  1787. _getMenuLabelFromItem: function(/*Item*/ item){
  1788. var label = this.labelFunc(item, this.store),
  1789. labelType = this.labelType;
  1790. // If labelType is not "text" we don't want to screw any markup ot whatever.
  1791. if(this.highlightMatch != "none" && this.labelType == "text" && this._lastInput){
  1792. label = this.doHighlight(label, this._escapeHtml(this._lastInput));
  1793. labelType = "html";
  1794. }
  1795. return {html: labelType == "html", label: label};
  1796. },
  1797. doHighlight: function(/*String*/ label, /*String*/ find){
  1798. // summary:
  1799. // Highlights the string entered by the user in the menu. By default this
  1800. // highlights the first occurrence found. Override this method
  1801. // to implement your custom highlighting.
  1802. // tags:
  1803. // protected
  1804. var
  1805. // Add (g)lobal modifier when this.highlightMatch == "all" and (i)gnorecase when this.ignoreCase == true
  1806. modifiers = (this.ignoreCase ? "i" : "") + (this.highlightMatch == "all" ? "g" : ""),
  1807. i = this.queryExpr.indexOf("${0}");
  1808. find = regexp.escapeString(find); // escape regexp special chars
  1809. return this._escapeHtml(label).replace(
  1810. // prepend ^ when this.queryExpr == "${0}*" and append $ when this.queryExpr == "*${0}"
  1811. new RegExp((i == 0 ? "^" : "") + "("+ find +")" + (i == (this.queryExpr.length - 4) ? "$" : ""), modifiers),
  1812. '<span class="dijitComboBoxHighlightMatch">$1</span>'
  1813. ); // returns String, (almost) valid HTML (entities encoded)
  1814. },
  1815. _escapeHtml: function(/*String*/ str){
  1816. // TODO Should become dojo.html.entities(), when exists use instead
  1817. // summary:
  1818. // Adds escape sequences for special characters in XML: &<>"'
  1819. str = String(str).replace(/&/gm, "&amp;").replace(/</gm, "&lt;")
  1820. .replace(/>/gm, "&gt;").replace(/"/gm, "&quot;"); //balance"
  1821. return str; // string
  1822. },
  1823. reset: function(){
  1824. // Overrides the _FormWidget.reset().
  1825. // Additionally reset the .item (to clean up).
  1826. this.item = null;
  1827. this.inherited(arguments);
  1828. },
  1829. labelFunc: function(/*item*/ item, /*dojo.store.api.Store*/ store){
  1830. // summary:
  1831. // Computes the label to display based on the dojo.data store item.
  1832. // returns:
  1833. // The label that the ComboBox should display
  1834. // tags:
  1835. // private
  1836. // Use toString() because XMLStore returns an XMLItem whereas this
  1837. // method is expected to return a String (#9354).
  1838. // Remove getValue() for 2.0 (old dojo.data API)
  1839. return (store._oldAPI ? store.getValue(item, this.labelAttr || this.searchAttr) :
  1840. item[this.labelAttr || this.searchAttr]).toString(); // String
  1841. },
  1842. _setValueAttr: function(/*String*/ value, /*Boolean?*/ priorityChange, /*String?*/ displayedValue, /*item?*/ item){
  1843. // summary:
  1844. // Hook so set('value', value) works.
  1845. // description:
  1846. // Sets the value of the select.
  1847. this._set("item", item||null); // value not looked up in store
  1848. if(!value){ value = ''; } // null translates to blank
  1849. this.inherited(arguments);
  1850. },
  1851. _setTextDirAttr: function(/*String*/ textDir){
  1852. // summary:
  1853. // Setter for textDir, needed for the dropDown's textDir update.
  1854. // description:
  1855. // Users shouldn't call this function; they should be calling
  1856. // set('textDir', value)
  1857. // tags:
  1858. // private
  1859. this.inherited(arguments);
  1860. // update the drop down also (_ComboBoxMenuMixin)
  1861. if(this.dropDown){
  1862. this.dropDown._set("textDir", textDir);
  1863. }
  1864. }
  1865. });
  1866. });
  1867. },
  1868. 'url:dijit/templates/ColorPalette.html':"<div class=\"dijitInline dijitColorPalette\">\n\t<table dojoAttachPoint=\"paletteTableNode\" class=\"dijitPaletteTable\" cellSpacing=\"0\" cellPadding=\"0\" role=\"grid\">\n\t\t<tbody data-dojo-attach-point=\"gridNode\"></tbody>\n\t</table>\n</div>\n",
  1869. 'dijit/form/MappedTextBox':function(){
  1870. define("dijit/form/MappedTextBox", [
  1871. "dojo/_base/declare", // declare
  1872. "dojo/dom-construct", // domConstruct.place
  1873. "./ValidationTextBox"
  1874. ], function(declare, domConstruct, ValidationTextBox){
  1875. /*=====
  1876. var ValidationTextBox = dijit.form.ValidationTextBox;
  1877. =====*/
  1878. // module:
  1879. // dijit/form/MappedTextBox
  1880. // summary:
  1881. // A dijit.form.ValidationTextBox subclass which provides a base class for widgets that have
  1882. // a visible formatted display value, and a serializable
  1883. // value in a hidden input field which is actually sent to the server.
  1884. return declare("dijit.form.MappedTextBox", ValidationTextBox, {
  1885. // summary:
  1886. // A dijit.form.ValidationTextBox subclass which provides a base class for widgets that have
  1887. // a visible formatted display value, and a serializable
  1888. // value in a hidden input field which is actually sent to the server.
  1889. // description:
  1890. // The visible display may
  1891. // be locale-dependent and interactive. The value sent to the server is stored in a hidden
  1892. // input field which uses the `name` attribute declared by the original widget. That value sent
  1893. // to the server is defined by the dijit.form.MappedTextBox.serialize method and is typically
  1894. // locale-neutral.
  1895. // tags:
  1896. // protected
  1897. postMixInProperties: function(){
  1898. this.inherited(arguments);
  1899. // we want the name attribute to go to the hidden <input>, not the displayed <input>,
  1900. // so override _FormWidget.postMixInProperties() setting of nameAttrSetting
  1901. this.nameAttrSetting = "";
  1902. },
  1903. // Override default behavior to assign name to focusNode
  1904. _setNameAttr: null,
  1905. serialize: function(val /*=====, options =====*/){
  1906. // summary:
  1907. // Overridable function used to convert the get('value') result to a canonical
  1908. // (non-localized) string. For example, will print dates in ISO format, and
  1909. // numbers the same way as they are represented in javascript.
  1910. // val: anything
  1911. // options: Object?
  1912. // tags:
  1913. // protected extension
  1914. return val.toString ? val.toString() : ""; // String
  1915. },
  1916. toString: function(){
  1917. // summary:
  1918. // Returns widget as a printable string using the widget's value
  1919. // tags:
  1920. // protected
  1921. var val = this.filter(this.get('value')); // call filter in case value is nonstring and filter has been customized
  1922. return val != null ? (typeof val == "string" ? val : this.serialize(val, this.constraints)) : ""; // String
  1923. },
  1924. validate: function(){
  1925. // Overrides `dijit.form.TextBox.validate`
  1926. this.valueNode.value = this.toString();
  1927. return this.inherited(arguments);
  1928. },
  1929. buildRendering: function(){
  1930. // Overrides `dijit._TemplatedMixin.buildRendering`
  1931. this.inherited(arguments);
  1932. // Create a hidden <input> node with the serialized value used for submit
  1933. // (as opposed to the displayed value).
  1934. // Passing in name as markup rather than calling domConstruct.create() with an attrs argument
  1935. // to make query(input[name=...]) work on IE. (see #8660)
  1936. this.valueNode = domConstruct.place("<input type='hidden'" + (this.name ? " name='" + this.name.replace(/'/g, "&quot;") + "'" : "") + "/>", this.textbox, "after");
  1937. },
  1938. reset: function(){
  1939. // Overrides `dijit.form.ValidationTextBox.reset` to
  1940. // reset the hidden textbox value to ''
  1941. this.valueNode.value = '';
  1942. this.inherited(arguments);
  1943. }
  1944. });
  1945. });
  1946. },
  1947. 'dijit/form/ComboBoxMixin':function(){
  1948. require({cache:{
  1949. 'url:dijit/form/templates/DropDownBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\"\n\tid=\"widget_${id}\"\n\trole=\"combobox\"\n\t><div class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer'\n\t\tdata-dojo-attach-point=\"_buttonNode, _popupStateNode\" role=\"presentation\"\n\t\t><input class=\"dijitReset dijitInputField dijitArrowButtonInner\" value=\"&#9660; \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t\t\t${_buttonInputDisabled}\n\t/></div\n\t><div class='dijitReset dijitValidationContainer'\n\t\t><input class=\"dijitReset dijitInputField dijitValidationIcon dijitValidationInner\" value=\"&#935; \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t/></div\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class='dijitReset dijitInputInner' ${!nameAttrSetting} type=\"text\" autocomplete=\"off\"\n\t\t\tdata-dojo-attach-point=\"textbox,focusNode\" role=\"textbox\" aria-haspopup=\"true\"\n\t/></div\n></div>\n"}});
  1950. define("dijit/form/ComboBoxMixin", [
  1951. "dojo/_base/declare", // declare
  1952. "dojo/_base/Deferred",
  1953. "dojo/_base/kernel", // kernel.deprecated
  1954. "dojo/_base/lang", // lang.mixin
  1955. "dojo/store/util/QueryResults", // dojo.store.util.QueryResults
  1956. "./_AutoCompleterMixin",
  1957. "./_ComboBoxMenu",
  1958. "../_HasDropDown",
  1959. "dojo/text!./templates/DropDownBox.html"
  1960. ], function(declare, Deferred, kernel, lang, QueryResults, _AutoCompleterMixin, _ComboBoxMenu, _HasDropDown, template){
  1961. /*=====
  1962. var _AutoCompleterMixin = dijit.form._AutoCompleterMixin;
  1963. var _ComboBoxMenu = dijit.form._ComboBoxMenu;
  1964. var _HasDropDown = dijit._HasDropDown;
  1965. =====*/
  1966. // module:
  1967. // dijit/form/ComboBoxMixin
  1968. // summary:
  1969. // Provides main functionality of ComboBox widget
  1970. return declare("dijit.form.ComboBoxMixin", [_HasDropDown, _AutoCompleterMixin], {
  1971. // summary:
  1972. // Provides main functionality of ComboBox widget
  1973. // dropDownClass: [protected extension] Function String
  1974. // Dropdown widget class used to select a date/time.
  1975. // Subclasses should specify this.
  1976. dropDownClass: _ComboBoxMenu,
  1977. // hasDownArrow: Boolean
  1978. // Set this textbox to have a down arrow button, to display the drop down list.
  1979. // Defaults to true.
  1980. hasDownArrow: true,
  1981. templateString: template,
  1982. baseClass: "dijitTextBox dijitComboBox",
  1983. /*=====
  1984. // store: [const] dojo.store.api.Store || dojo.data.api.Read
  1985. // Reference to data provider object used by this ComboBox.
  1986. //
  1987. // Should be dojo.store.api.Store, but dojo.data.api.Read supported
  1988. // for backwards compatibility.
  1989. store: null,
  1990. =====*/
  1991. // Set classes like dijitDownArrowButtonHover depending on
  1992. // mouse action over button node
  1993. cssStateNodes: {
  1994. "_buttonNode": "dijitDownArrowButton"
  1995. },
  1996. _setHasDownArrowAttr: function(/*Boolean*/ val){
  1997. this._set("hasDownArrow", val);
  1998. this._buttonNode.style.display = val ? "" : "none";
  1999. },
  2000. _showResultList: function(){
  2001. // hide the tooltip
  2002. this.displayMessage("");
  2003. this.inherited(arguments);
  2004. },
  2005. _setStoreAttr: function(store){
  2006. // For backwards-compatibility, accept dojo.data store in addition to dojo.store.store. Remove in 2.0.
  2007. if(!store.get){
  2008. lang.mixin(store, {
  2009. _oldAPI: true,
  2010. get: function(id){
  2011. // summary:
  2012. // Retrieves an object by it's identity. This will trigger a fetchItemByIdentity.
  2013. // Like dojo.store.DataStore.get() except returns native item.
  2014. var deferred = new Deferred();
  2015. this.fetchItemByIdentity({
  2016. identity: id,
  2017. onItem: function(object){
  2018. deferred.resolve(object);
  2019. },
  2020. onError: function(error){
  2021. deferred.reject(error);
  2022. }
  2023. });
  2024. return deferred.promise;
  2025. },
  2026. query: function(query, options){
  2027. // summary:
  2028. // Queries the store for objects. Like dojo.store.DataStore.query()
  2029. // except returned Deferred contains array of native items.
  2030. var deferred = new Deferred(function(){ fetchHandle.abort && fetchHandle.abort(); });
  2031. var fetchHandle = this.fetch(lang.mixin({
  2032. query: query,
  2033. onBegin: function(count){
  2034. deferred.total = count;
  2035. },
  2036. onComplete: function(results){
  2037. deferred.resolve(results);
  2038. },
  2039. onError: function(error){
  2040. deferred.reject(error);
  2041. }
  2042. }, options));
  2043. return QueryResults(deferred);
  2044. }
  2045. });
  2046. }
  2047. this._set("store", store);
  2048. },
  2049. postMixInProperties: function(){
  2050. // Since _setValueAttr() depends on this.store, _setStoreAttr() needs to execute first.
  2051. // Unfortunately, without special code, it ends up executing second.
  2052. if(this.params.store){
  2053. this._setStoreAttr(this.params.store);
  2054. }
  2055. this.inherited(arguments);
  2056. // User may try to access this.store.getValue() etc. in a custom labelFunc() function.
  2057. // It's not available with the new data store for handling inline <option> tags, so add it.
  2058. if(!this.params.store){
  2059. var clazz = this.declaredClass;
  2060. lang.mixin(this.store, {
  2061. getValue: function(item, attr){
  2062. kernel.deprecated(clazz + ".store.getValue(item, attr) is deprecated for builtin store. Use item.attr directly", "", "2.0");
  2063. return item[attr];
  2064. },
  2065. getLabel: function(item){
  2066. kernel.deprecated(clazz + ".store.getLabel(item) is deprecated for builtin store. Use item.label directly", "", "2.0");
  2067. return item.name;
  2068. },
  2069. fetch: function(args){
  2070. kernel.deprecated(clazz + ".store.fetch() is deprecated for builtin store.", "Use store.query()", "2.0");
  2071. var shim = ["dojo/data/ObjectStore"]; // indirection so it doesn't get rolled into a build
  2072. require(shim, lang.hitch(this, function(ObjectStore){
  2073. new ObjectStore({objectStore: this}).fetch(args);
  2074. }));
  2075. }
  2076. });
  2077. }
  2078. }
  2079. });
  2080. });
  2081. },
  2082. 'dijit/form/_TextBoxMixin':function(){
  2083. define("dijit/form/_TextBoxMixin", [
  2084. "dojo/_base/array", // array.forEach
  2085. "dojo/_base/declare", // declare
  2086. "dojo/dom", // dom.byId
  2087. "dojo/_base/event", // event.stop
  2088. "dojo/keys", // keys.ALT keys.CAPS_LOCK keys.CTRL keys.META keys.SHIFT
  2089. "dojo/_base/lang", // lang.mixin
  2090. ".." // for exporting dijit._setSelectionRange, dijit.selectInputText
  2091. ], function(array, declare, dom, event, keys, lang, dijit){
  2092. // module:
  2093. // dijit/form/_TextBoxMixin
  2094. // summary:
  2095. // A mixin for textbox form input widgets
  2096. var _TextBoxMixin = declare("dijit.form._TextBoxMixin", null, {
  2097. // summary:
  2098. // A mixin for textbox form input widgets
  2099. // trim: Boolean
  2100. // Removes leading and trailing whitespace if true. Default is false.
  2101. trim: false,
  2102. // uppercase: Boolean
  2103. // Converts all characters to uppercase if true. Default is false.
  2104. uppercase: false,
  2105. // lowercase: Boolean
  2106. // Converts all characters to lowercase if true. Default is false.
  2107. lowercase: false,
  2108. // propercase: Boolean
  2109. // Converts the first character of each word to uppercase if true.
  2110. propercase: false,
  2111. // maxLength: String
  2112. // HTML INPUT tag maxLength declaration.
  2113. maxLength: "",
  2114. // selectOnClick: [const] Boolean
  2115. // If true, all text will be selected when focused with mouse
  2116. selectOnClick: false,
  2117. // placeHolder: String
  2118. // Defines a hint to help users fill out the input field (as defined in HTML 5).
  2119. // This should only contain plain text (no html markup).
  2120. placeHolder: "",
  2121. _getValueAttr: function(){
  2122. // summary:
  2123. // Hook so get('value') works as we like.
  2124. // description:
  2125. // For `dijit.form.TextBox` this basically returns the value of the <input>.
  2126. //
  2127. // For `dijit.form.MappedTextBox` subclasses, which have both
  2128. // a "displayed value" and a separate "submit value",
  2129. // This treats the "displayed value" as the master value, computing the
  2130. // submit value from it via this.parse().
  2131. return this.parse(this.get('displayedValue'), this.constraints);
  2132. },
  2133. _setValueAttr: function(value, /*Boolean?*/ priorityChange, /*String?*/ formattedValue){
  2134. // summary:
  2135. // Hook so set('value', ...) works.
  2136. //
  2137. // description:
  2138. // Sets the value of the widget to "value" which can be of
  2139. // any type as determined by the widget.
  2140. //
  2141. // value:
  2142. // The visual element value is also set to a corresponding,
  2143. // but not necessarily the same, value.
  2144. //
  2145. // formattedValue:
  2146. // If specified, used to set the visual element value,
  2147. // otherwise a computed visual value is used.
  2148. //
  2149. // priorityChange:
  2150. // If true, an onChange event is fired immediately instead of
  2151. // waiting for the next blur event.
  2152. var filteredValue;
  2153. if(value !== undefined){
  2154. // TODO: this is calling filter() on both the display value and the actual value.
  2155. // I added a comment to the filter() definition about this, but it should be changed.
  2156. filteredValue = this.filter(value);
  2157. if(typeof formattedValue != "string"){
  2158. if(filteredValue !== null && ((typeof filteredValue != "number") || !isNaN(filteredValue))){
  2159. formattedValue = this.filter(this.format(filteredValue, this.constraints));
  2160. }else{ formattedValue = ''; }
  2161. }
  2162. }
  2163. if(formattedValue != null && formattedValue != undefined && ((typeof formattedValue) != "number" || !isNaN(formattedValue)) && this.textbox.value != formattedValue){
  2164. this.textbox.value = formattedValue;
  2165. this._set("displayedValue", this.get("displayedValue"));
  2166. }
  2167. if(this.textDir == "auto"){
  2168. this.applyTextDir(this.focusNode, formattedValue);
  2169. }
  2170. this.inherited(arguments, [filteredValue, priorityChange]);
  2171. },
  2172. // displayedValue: String
  2173. // For subclasses like ComboBox where the displayed value
  2174. // (ex: Kentucky) and the serialized value (ex: KY) are different,
  2175. // this represents the displayed value.
  2176. //
  2177. // Setting 'displayedValue' through set('displayedValue', ...)
  2178. // updates 'value', and vice-versa. Otherwise 'value' is updated
  2179. // from 'displayedValue' periodically, like onBlur etc.
  2180. //
  2181. // TODO: move declaration to MappedTextBox?
  2182. // Problem is that ComboBox references displayedValue,
  2183. // for benefit of FilteringSelect.
  2184. displayedValue: "",
  2185. _getDisplayedValueAttr: function(){
  2186. // summary:
  2187. // Hook so get('displayedValue') works.
  2188. // description:
  2189. // Returns the displayed value (what the user sees on the screen),
  2190. // after filtering (ie, trimming spaces etc.).
  2191. //
  2192. // For some subclasses of TextBox (like ComboBox), the displayed value
  2193. // is different from the serialized value that's actually
  2194. // sent to the server (see dijit.form.ValidationTextBox.serialize)
  2195. // TODO: maybe we should update this.displayedValue on every keystroke so that we don't need
  2196. // this method
  2197. // TODO: this isn't really the displayed value when the user is typing
  2198. return this.filter(this.textbox.value);
  2199. },
  2200. _setDisplayedValueAttr: function(/*String*/ value){
  2201. // summary:
  2202. // Hook so set('displayedValue', ...) works.
  2203. // description:
  2204. // Sets the value of the visual element to the string "value".
  2205. // The widget value is also set to a corresponding,
  2206. // but not necessarily the same, value.
  2207. if(value === null || value === undefined){ value = '' }
  2208. else if(typeof value != "string"){ value = String(value) }
  2209. this.textbox.value = value;
  2210. // sets the serialized value to something corresponding to specified displayedValue
  2211. // (if possible), and also updates the textbox.value, for example converting "123"
  2212. // to "123.00"
  2213. this._setValueAttr(this.get('value'), undefined);
  2214. this._set("displayedValue", this.get('displayedValue'));
  2215. // textDir support
  2216. if(this.textDir == "auto"){
  2217. this.applyTextDir(this.focusNode, value);
  2218. }
  2219. },
  2220. format: function(value /*=====, constraints =====*/){
  2221. // summary:
  2222. // Replaceable function to convert a value to a properly formatted string.
  2223. // value: String
  2224. // constraints: Object
  2225. // tags:
  2226. // protected extension
  2227. return ((value == null || value == undefined) ? "" : (value.toString ? value.toString() : value));
  2228. },
  2229. parse: function(value /*=====, constraints =====*/){
  2230. // summary:
  2231. // Replaceable function to convert a formatted string to a value
  2232. // value: String
  2233. // constraints: Object
  2234. // tags:
  2235. // protected extension
  2236. return value; // String
  2237. },
  2238. _refreshState: function(){
  2239. // summary:
  2240. // After the user types some characters, etc., this method is
  2241. // called to check the field for validity etc. The base method
  2242. // in `dijit.form.TextBox` does nothing, but subclasses override.
  2243. // tags:
  2244. // protected
  2245. },
  2246. /*=====
  2247. onInput: function(event){
  2248. // summary:
  2249. // Connect to this function to receive notifications of various user data-input events.
  2250. // Return false to cancel the event and prevent it from being processed.
  2251. // event:
  2252. // keydown | keypress | cut | paste | input
  2253. // tags:
  2254. // callback
  2255. },
  2256. =====*/
  2257. onInput: function(){},
  2258. __skipInputEvent: false,
  2259. _onInput: function(){
  2260. // summary:
  2261. // Called AFTER the input event has happened
  2262. // set text direction according to textDir that was defined in creation
  2263. if(this.textDir == "auto"){
  2264. this.applyTextDir(this.focusNode, this.focusNode.value);
  2265. }
  2266. this._refreshState();
  2267. // In case someone is watch()'ing for changes to displayedValue
  2268. this._set("displayedValue", this.get("displayedValue"));
  2269. },
  2270. postCreate: function(){
  2271. // setting the value here is needed since value="" in the template causes "undefined"
  2272. // and setting in the DOM (instead of the JS object) helps with form reset actions
  2273. this.textbox.setAttribute("value", this.textbox.value); // DOM and JS values should be the same
  2274. this.inherited(arguments);
  2275. // normalize input events to reduce spurious event processing
  2276. // onkeydown: do not forward modifier keys
  2277. // set charOrCode to numeric keycode
  2278. // onkeypress: do not forward numeric charOrCode keys (already sent through onkeydown)
  2279. // onpaste & oncut: set charOrCode to 229 (IME)
  2280. // oninput: if primary event not already processed, set charOrCode to 229 (IME), else do not forward
  2281. var handleEvent = function(e){
  2282. var charCode = e.charOrCode || e.keyCode || 229;
  2283. if(e.type == "keydown"){
  2284. switch(charCode){ // ignore "state" keys
  2285. case keys.SHIFT:
  2286. case keys.ALT:
  2287. case keys.CTRL:
  2288. case keys.META:
  2289. case keys.CAPS_LOCK:
  2290. return;
  2291. default:
  2292. if(charCode >= 65 && charCode <= 90){ return; } // keydown for A-Z can be processed with keypress
  2293. }
  2294. }
  2295. if(e.type == "keypress" && typeof charCode != "string"){ return; }
  2296. if(e.type == "input"){
  2297. if(this.__skipInputEvent){ // duplicate event
  2298. this.__skipInputEvent = false;
  2299. return;
  2300. }
  2301. }else{
  2302. this.__skipInputEvent = true;
  2303. }
  2304. // create fake event to set charOrCode and to know if preventDefault() was called
  2305. var faux = lang.mixin({}, e, {
  2306. charOrCode: charCode,
  2307. wasConsumed: false,
  2308. preventDefault: function(){
  2309. faux.wasConsumed = true;
  2310. e.preventDefault();
  2311. },
  2312. stopPropagation: function(){ e.stopPropagation(); }
  2313. });
  2314. // give web page author a chance to consume the event
  2315. if(this.onInput(faux) === false){
  2316. event.stop(faux); // return false means stop
  2317. }
  2318. if(faux.wasConsumed){ return; } // if preventDefault was called
  2319. setTimeout(lang.hitch(this, "_onInput", faux), 0); // widget notification after key has posted
  2320. };
  2321. array.forEach([ "onkeydown", "onkeypress", "onpaste", "oncut", "oninput", "oncompositionend" ], function(event){
  2322. this.connect(this.textbox, event, handleEvent);
  2323. }, this);
  2324. },
  2325. _blankValue: '', // if the textbox is blank, what value should be reported
  2326. filter: function(val){
  2327. // summary:
  2328. // Auto-corrections (such as trimming) that are applied to textbox
  2329. // value on blur or form submit.
  2330. // description:
  2331. // For MappedTextBox subclasses, this is called twice
  2332. // - once with the display value
  2333. // - once the value as set/returned by set('value', ...)
  2334. // and get('value'), ex: a Number for NumberTextBox.
  2335. //
  2336. // In the latter case it does corrections like converting null to NaN. In
  2337. // the former case the NumberTextBox.filter() method calls this.inherited()
  2338. // to execute standard trimming code in TextBox.filter().
  2339. //
  2340. // TODO: break this into two methods in 2.0
  2341. //
  2342. // tags:
  2343. // protected extension
  2344. if(val === null){ return this._blankValue; }
  2345. if(typeof val != "string"){ return val; }
  2346. if(this.trim){
  2347. val = lang.trim(val);
  2348. }
  2349. if(this.uppercase){
  2350. val = val.toUpperCase();
  2351. }
  2352. if(this.lowercase){
  2353. val = val.toLowerCase();
  2354. }
  2355. if(this.propercase){
  2356. val = val.replace(/[^\s]+/g, function(word){
  2357. return word.substring(0,1).toUpperCase() + word.substring(1);
  2358. });
  2359. }
  2360. return val;
  2361. },
  2362. _setBlurValue: function(){
  2363. this._setValueAttr(this.get('value'), true);
  2364. },
  2365. _onBlur: function(e){
  2366. if(this.disabled){ return; }
  2367. this._setBlurValue();
  2368. this.inherited(arguments);
  2369. if(this._selectOnClickHandle){
  2370. this.disconnect(this._selectOnClickHandle);
  2371. }
  2372. },
  2373. _isTextSelected: function(){
  2374. return this.textbox.selectionStart == this.textbox.selectionEnd;
  2375. },
  2376. _onFocus: function(/*String*/ by){
  2377. if(this.disabled || this.readOnly){ return; }
  2378. // Select all text on focus via click if nothing already selected.
  2379. // Since mouse-up will clear the selection need to defer selection until after mouse-up.
  2380. // Don't do anything on focus by tabbing into the widget since there's no associated mouse-up event.
  2381. if(this.selectOnClick && by == "mouse"){
  2382. this._selectOnClickHandle = this.connect(this.domNode, "onmouseup", function(){
  2383. // Only select all text on first click; otherwise users would have no way to clear
  2384. // the selection.
  2385. this.disconnect(this._selectOnClickHandle);
  2386. // Check if the user selected some text manually (mouse-down, mouse-move, mouse-up)
  2387. // and if not, then select all the text
  2388. if(this._isTextSelected()){
  2389. _TextBoxMixin.selectInputText(this.textbox);
  2390. }
  2391. });
  2392. }
  2393. // call this.inherited() before refreshState(), since this.inherited() will possibly scroll the viewport
  2394. // (to scroll the TextBox into view), which will affect how _refreshState() positions the tooltip
  2395. this.inherited(arguments);
  2396. this._refreshState();
  2397. },
  2398. reset: function(){
  2399. // Overrides dijit._FormWidget.reset().
  2400. // Additionally resets the displayed textbox value to ''
  2401. this.textbox.value = '';
  2402. this.inherited(arguments);
  2403. },
  2404. _setTextDirAttr: function(/*String*/ textDir){
  2405. // summary:
  2406. // Setter for textDir.
  2407. // description:
  2408. // Users shouldn't call this function; they should be calling
  2409. // set('textDir', value)
  2410. // tags:
  2411. // private
  2412. // only if new textDir is different from the old one
  2413. // and on widgets creation.
  2414. if(!this._created
  2415. || this.textDir != textDir){
  2416. this._set("textDir", textDir);
  2417. // so the change of the textDir will take place immediately.
  2418. this.applyTextDir(this.focusNode, this.focusNode.value);
  2419. }
  2420. }
  2421. });
  2422. _TextBoxMixin._setSelectionRange = dijit._setSelectionRange = function(/*DomNode*/ element, /*Number?*/ start, /*Number?*/ stop){
  2423. if(element.setSelectionRange){
  2424. element.setSelectionRange(start, stop);
  2425. }
  2426. };
  2427. _TextBoxMixin.selectInputText = dijit.selectInputText = function(/*DomNode*/ element, /*Number?*/ start, /*Number?*/ stop){
  2428. // summary:
  2429. // Select text in the input element argument, from start (default 0), to stop (default end).
  2430. // TODO: use functions in _editor/selection.js?
  2431. element = dom.byId(element);
  2432. if(isNaN(start)){ start = 0; }
  2433. if(isNaN(stop)){ stop = element.value ? element.value.length : 0; }
  2434. try{
  2435. element.focus();
  2436. _TextBoxMixin._setSelectionRange(element, start, stop);
  2437. }catch(e){ /* squelch random errors (esp. on IE) from unexpected focus changes or DOM nodes being hidden */ }
  2438. };
  2439. return _TextBoxMixin;
  2440. });
  2441. },
  2442. 'dijit/form/RadioButton':function(){
  2443. define("dijit/form/RadioButton", [
  2444. "dojo/_base/declare", // declare
  2445. "./CheckBox",
  2446. "./_RadioButtonMixin"
  2447. ], function(declare, CheckBox, _RadioButtonMixin){
  2448. /*=====
  2449. var CheckBox = dijit.form.CheckBox;
  2450. var _RadioButtonMixin = dijit.form._RadioButtonMixin;
  2451. =====*/
  2452. // module:
  2453. // dijit/form/RadioButton
  2454. // summary:
  2455. // Radio button widget
  2456. return declare("dijit.form.RadioButton", [CheckBox, _RadioButtonMixin], {
  2457. // summary:
  2458. // Same as an HTML radio, but with fancy styling.
  2459. baseClass: "dijitRadio"
  2460. });
  2461. });
  2462. },
  2463. 'dijit/form/_RadioButtonMixin':function(){
  2464. define("dijit/form/_RadioButtonMixin", [
  2465. "dojo/_base/array", // array.forEach
  2466. "dojo/_base/declare", // declare
  2467. "dojo/dom-attr", // domAttr.set
  2468. "dojo/_base/event", // event.stop
  2469. "dojo/_base/lang", // lang.hitch
  2470. "dojo/query", // query
  2471. "dojo/_base/window", // win.doc
  2472. "../registry" // registry.getEnclosingWidget
  2473. ], function(array, declare, domAttr, event, lang, query, win, registry){
  2474. // module:
  2475. // dijit/form/_RadioButtonMixin
  2476. // summary:
  2477. // Mixin to provide widget functionality for an HTML radio button
  2478. return declare("dijit.form._RadioButtonMixin", null, {
  2479. // summary:
  2480. // Mixin to provide widget functionality for an HTML radio button
  2481. // type: [private] String
  2482. // type attribute on <input> node.
  2483. // Users should not change this value.
  2484. type: "radio",
  2485. _getRelatedWidgets: function(){
  2486. // Private function needed to help iterate over all radio buttons in a group.
  2487. var ary = [];
  2488. query("input[type=radio]", this.focusNode.form || win.doc).forEach( // can't use name= since query doesn't support [] in the name
  2489. lang.hitch(this, function(inputNode){
  2490. if(inputNode.name == this.name && inputNode.form == this.focusNode.form){
  2491. var widget = registry.getEnclosingWidget(inputNode);
  2492. if(widget){
  2493. ary.push(widget);
  2494. }
  2495. }
  2496. })
  2497. );
  2498. return ary;
  2499. },
  2500. _setCheckedAttr: function(/*Boolean*/ value){
  2501. // If I am being checked then have to deselect currently checked radio button
  2502. this.inherited(arguments);
  2503. if(!this._created){ return; }
  2504. if(value){
  2505. array.forEach(this._getRelatedWidgets(), lang.hitch(this, function(widget){
  2506. if(widget != this && widget.checked){
  2507. widget.set('checked', false);
  2508. }
  2509. }));
  2510. }
  2511. },
  2512. _onClick: function(/*Event*/ e){
  2513. if(this.checked || this.disabled){ // nothing to do
  2514. event.stop(e);
  2515. return false;
  2516. }
  2517. if(this.readOnly){ // ignored by some browsers so we have to resync the DOM elements with widget values
  2518. event.stop(e);
  2519. array.forEach(this._getRelatedWidgets(), lang.hitch(this, function(widget){
  2520. domAttr.set(this.focusNode || this.domNode, 'checked', widget.checked);
  2521. }));
  2522. return false;
  2523. }
  2524. return this.inherited(arguments);
  2525. }
  2526. });
  2527. });
  2528. },
  2529. 'dojo/dnd/TimedMoveable':function(){
  2530. define("dojo/dnd/TimedMoveable", ["../main", "./Moveable"], function(dojo) {
  2531. // module:
  2532. // dojo/dnd/TimedMoveable
  2533. // summary:
  2534. // TODOC
  2535. /*=====
  2536. dojo.declare("dojo.dnd.__TimedMoveableArgs", [dojo.dnd.__MoveableArgs], {
  2537. // timeout: Number
  2538. // delay move by this number of ms,
  2539. // accumulating position changes during the timeout
  2540. timeout: 0
  2541. });
  2542. =====*/
  2543. // precalculate long expressions
  2544. var oldOnMove = dojo.dnd.Moveable.prototype.onMove;
  2545. dojo.declare("dojo.dnd.TimedMoveable", dojo.dnd.Moveable, {
  2546. // summary:
  2547. // A specialized version of Moveable to support an FPS throttling.
  2548. // This class puts an upper restriction on FPS, which may reduce
  2549. // the CPU load. The additional parameter "timeout" regulates
  2550. // the delay before actually moving the moveable object.
  2551. // object attributes (for markup)
  2552. timeout: 40, // in ms, 40ms corresponds to 25 fps
  2553. constructor: function(node, params){
  2554. // summary:
  2555. // an object that makes a node moveable with a timer
  2556. // node: Node||String
  2557. // a node (or node's id) to be moved
  2558. // params: dojo.dnd.__TimedMoveableArgs
  2559. // object with additional parameters.
  2560. // sanitize parameters
  2561. if(!params){ params = {}; }
  2562. if(params.timeout && typeof params.timeout == "number" && params.timeout >= 0){
  2563. this.timeout = params.timeout;
  2564. }
  2565. },
  2566. onMoveStop: function(/* dojo.dnd.Mover */ mover){
  2567. if(mover._timer){
  2568. // stop timer
  2569. clearTimeout(mover._timer);
  2570. // reflect the last received position
  2571. oldOnMove.call(this, mover, mover._leftTop)
  2572. }
  2573. dojo.dnd.Moveable.prototype.onMoveStop.apply(this, arguments);
  2574. },
  2575. onMove: function(/* dojo.dnd.Mover */ mover, /* Object */ leftTop){
  2576. mover._leftTop = leftTop;
  2577. if(!mover._timer){
  2578. var _t = this; // to avoid using dojo.hitch()
  2579. mover._timer = setTimeout(function(){
  2580. // we don't have any pending requests
  2581. mover._timer = null;
  2582. // reflect the last received position
  2583. oldOnMove.call(_t, mover, mover._leftTop);
  2584. }, this.timeout);
  2585. }
  2586. }
  2587. });
  2588. return dojo.dnd.TimedMoveable;
  2589. });
  2590. },
  2591. 'dijit/form/_ListMouseMixin':function(){
  2592. define("dijit/form/_ListMouseMixin", [
  2593. "dojo/_base/declare", // declare
  2594. "dojo/_base/event", // event.stop
  2595. "dojo/touch",
  2596. "./_ListBase"
  2597. ], function(declare, event, touch, _ListBase){
  2598. /*=====
  2599. var _ListBase = dijit.form._ListBase;
  2600. =====*/
  2601. // module:
  2602. // dijit/form/_ListMouseMixin
  2603. // summary:
  2604. // a mixin to handle mouse or touch events for a focus-less menu
  2605. return declare( "dijit.form._ListMouseMixin", _ListBase, {
  2606. // summary:
  2607. // a Mixin to handle mouse or touch events for a focus-less menu
  2608. // Abstract methods that must be defined externally:
  2609. // onClick: item was chosen (mousedown somewhere on the menu and mouseup somewhere on the menu)
  2610. // tags:
  2611. // private
  2612. postCreate: function(){
  2613. this.inherited(arguments);
  2614. this.connect(this.domNode, "onclick", function(evt){ this._onClick(evt, this._getTarget(evt)); });
  2615. this.connect(this.domNode, "onmousedown", "_onMouseDown");
  2616. this.connect(this.domNode, "onmouseup", "_onMouseUp");
  2617. this.connect(this.domNode, "onmouseover", "_onMouseOver");
  2618. this.connect(this.domNode, "onmouseout", "_onMouseOut");
  2619. },
  2620. _onClick: function(/*Event*/ evt, /*DomNode*/ target){
  2621. this._setSelectedAttr(target, false);
  2622. if(this._deferredClick){
  2623. this._deferredClick.remove();
  2624. }
  2625. this._deferredClick = this.defer(function(){
  2626. this._deferredClick = null;
  2627. this.onClick(target);
  2628. });
  2629. },
  2630. _onMouseDown: function(/*Event*/ evt){
  2631. if(this._hoveredNode){
  2632. this.onUnhover(this._hoveredNode);
  2633. this._hoveredNode = null;
  2634. }
  2635. this._isDragging = true;
  2636. this._setSelectedAttr(this._getTarget(evt), false);
  2637. },
  2638. _onMouseUp: function(/*Event*/ evt){
  2639. this._isDragging = false;
  2640. var selectedNode = this._getSelectedAttr();
  2641. var target = this._getTarget(evt);
  2642. var hoveredNode = this._hoveredNode;
  2643. if(selectedNode && target == selectedNode){
  2644. this.defer(function(){ this._onClick(evt, selectedNode); });
  2645. }else if(hoveredNode){ // drag to select
  2646. this.defer(function(){ this._onClick(evt, hoveredNode); });
  2647. }
  2648. },
  2649. _onMouseOut: function(/*Event*/ /*===== evt ====*/){
  2650. if(this._hoveredNode){
  2651. this.onUnhover(this._hoveredNode);
  2652. if(this._getSelectedAttr() == this._hoveredNode){
  2653. this.onSelect(this._hoveredNode);
  2654. }
  2655. this._hoveredNode = null;
  2656. }
  2657. if(this._isDragging){
  2658. this._cancelDrag = (new Date()).getTime() + 1000; // cancel in 1 second if no _onMouseOver fires
  2659. }
  2660. },
  2661. _onMouseOver: function(/*Event*/ evt){
  2662. if(this._cancelDrag){
  2663. var time = (new Date()).getTime();
  2664. if(time > this._cancelDrag){
  2665. this._isDragging = false;
  2666. }
  2667. this._cancelDrag = null;
  2668. }
  2669. var node = this._getTarget(evt);
  2670. if(!node){ return; }
  2671. if(this._hoveredNode != node){
  2672. if(this._hoveredNode){
  2673. this._onMouseOut({ target: this._hoveredNode });
  2674. }
  2675. if(node && node.parentNode == this.containerNode){
  2676. if(this._isDragging){
  2677. this._setSelectedAttr(node, false);
  2678. }else{
  2679. this._hoveredNode = node;
  2680. this.onHover(node);
  2681. }
  2682. }
  2683. }
  2684. }
  2685. });
  2686. });
  2687. },
  2688. 'url:dijit/form/templates/DropDownBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\"\n\tid=\"widget_${id}\"\n\trole=\"combobox\"\n\t><div class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer'\n\t\tdata-dojo-attach-point=\"_buttonNode, _popupStateNode\" role=\"presentation\"\n\t\t><input class=\"dijitReset dijitInputField dijitArrowButtonInner\" value=\"&#9660; \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t\t\t${_buttonInputDisabled}\n\t/></div\n\t><div class='dijitReset dijitValidationContainer'\n\t\t><input class=\"dijitReset dijitInputField dijitValidationIcon dijitValidationInner\" value=\"&#935; \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t/></div\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class='dijitReset dijitInputInner' ${!nameAttrSetting} type=\"text\" autocomplete=\"off\"\n\t\t\tdata-dojo-attach-point=\"textbox,focusNode\" role=\"textbox\" aria-haspopup=\"true\"\n\t/></div\n></div>\n",
  2689. 'dijit/form/NumberTextBox':function(){
  2690. define("dijit/form/NumberTextBox", [
  2691. "dojo/_base/declare", // declare
  2692. "dojo/_base/lang", // lang.hitch lang.mixin
  2693. "dojo/number", // number._realNumberRegexp number.format number.parse number.regexp
  2694. "./RangeBoundTextBox"
  2695. ], function(declare, lang, number, RangeBoundTextBox){
  2696. /*=====
  2697. var RangeBoundTextBox = dijit.form.RangeBoundTextBox;
  2698. =====*/
  2699. // module:
  2700. // dijit/form/NumberTextBox
  2701. // summary:
  2702. // A TextBox for entering numbers, with formatting and range checking
  2703. /*=====
  2704. declare(
  2705. "dijit.form.NumberTextBox.__Constraints",
  2706. [dijit.form.RangeBoundTextBox.__Constraints, number.__FormatOptions, number.__ParseOptions], {
  2707. // summary:
  2708. // Specifies both the rules on valid/invalid values (minimum, maximum,
  2709. // number of required decimal places), and also formatting options for
  2710. // displaying the value when the field is not focused.
  2711. // example:
  2712. // Minimum/maximum:
  2713. // To specify a field between 0 and 120:
  2714. // | {min:0,max:120}
  2715. // To specify a field that must be an integer:
  2716. // | {fractional:false}
  2717. // To specify a field where 0 to 3 decimal places are allowed on input:
  2718. // | {places:'0,3'}
  2719. });
  2720. =====*/
  2721. var NumberTextBoxMixin = declare("dijit.form.NumberTextBoxMixin", null, {
  2722. // summary:
  2723. // A mixin for all number textboxes
  2724. // tags:
  2725. // protected
  2726. // Override ValidationTextBox.regExpGen().... we use a reg-ex generating function rather
  2727. // than a straight regexp to deal with locale (plus formatting options too?)
  2728. regExpGen: number.regexp,
  2729. /*=====
  2730. // constraints: dijit.form.NumberTextBox.__Constraints
  2731. // Despite the name, this parameter specifies both constraints on the input
  2732. // (including minimum/maximum allowed values) as well as
  2733. // formatting options like places (the number of digits to display after
  2734. // the decimal point). See `dijit.form.NumberTextBox.__Constraints` for details.
  2735. constraints: {},
  2736. ======*/
  2737. // value: Number
  2738. // The value of this NumberTextBox as a Javascript Number (i.e., not a String).
  2739. // If the displayed value is blank, the value is NaN, and if the user types in
  2740. // an gibberish value (like "hello world"), the value is undefined
  2741. // (i.e. get('value') returns undefined).
  2742. //
  2743. // Symmetrically, set('value', NaN) will clear the displayed value,
  2744. // whereas set('value', undefined) will have no effect.
  2745. value: NaN,
  2746. // editOptions: [protected] Object
  2747. // Properties to mix into constraints when the value is being edited.
  2748. // This is here because we edit the number in the format "12345", which is
  2749. // different than the display value (ex: "12,345")
  2750. editOptions: { pattern: '#.######' },
  2751. /*=====
  2752. _formatter: function(value, options){
  2753. // summary:
  2754. // _formatter() is called by format(). It's the base routine for formatting a number,
  2755. // as a string, for example converting 12345 into "12,345".
  2756. // value: Number
  2757. // The number to be converted into a string.
  2758. // options: dojo.number.__FormatOptions?
  2759. // Formatting options
  2760. // tags:
  2761. // protected extension
  2762. return "12345"; // String
  2763. },
  2764. =====*/
  2765. _formatter: number.format,
  2766. postMixInProperties: function(){
  2767. this.inherited(arguments);
  2768. this._set("type", "text"); // in case type="number" was specified which messes up parse/format
  2769. },
  2770. _setConstraintsAttr: function(/*Object*/ constraints){
  2771. var places = typeof constraints.places == "number"? constraints.places : 0;
  2772. if(places){ places++; } // decimal rounding errors take away another digit of precision
  2773. if(typeof constraints.max != "number"){
  2774. constraints.max = 9 * Math.pow(10, 15-places);
  2775. }
  2776. if(typeof constraints.min != "number"){
  2777. constraints.min = -9 * Math.pow(10, 15-places);
  2778. }
  2779. this.inherited(arguments, [ constraints ]);
  2780. if(this.focusNode && this.focusNode.value && !isNaN(this.value)){
  2781. this.set('value', this.value);
  2782. }
  2783. },
  2784. _onFocus: function(){
  2785. if(this.disabled){ return; }
  2786. var val = this.get('value');
  2787. if(typeof val == "number" && !isNaN(val)){
  2788. var formattedValue = this.format(val, this.constraints);
  2789. if(formattedValue !== undefined){
  2790. this.textbox.value = formattedValue;
  2791. }
  2792. }
  2793. this.inherited(arguments);
  2794. },
  2795. format: function(/*Number*/ value, /*dojo.number.__FormatOptions*/ constraints){
  2796. // summary:
  2797. // Formats the value as a Number, according to constraints.
  2798. // tags:
  2799. // protected
  2800. var formattedValue = String(value);
  2801. if(typeof value != "number"){ return formattedValue; }
  2802. if(isNaN(value)){ return ""; }
  2803. // check for exponential notation that dojo.number.format chokes on
  2804. if(!("rangeCheck" in this && this.rangeCheck(value, constraints)) && constraints.exponent !== false && /\de[-+]?\d/i.test(formattedValue)){
  2805. return formattedValue;
  2806. }
  2807. if(this.editOptions && this.focused){
  2808. constraints = lang.mixin({}, constraints, this.editOptions);
  2809. }
  2810. return this._formatter(value, constraints);
  2811. },
  2812. /*=====
  2813. _parser: function(value, constraints){
  2814. // summary:
  2815. // Parses the string value as a Number, according to constraints.
  2816. // value: String
  2817. // String representing a number
  2818. // constraints: dojo.number.__ParseOptions
  2819. // Formatting options
  2820. // tags:
  2821. // protected
  2822. return 123.45; // Number
  2823. },
  2824. =====*/
  2825. _parser: number.parse,
  2826. parse: function(/*String*/ value, /*number.__FormatOptions*/ constraints){
  2827. // summary:
  2828. // Replaceable function to convert a formatted string to a number value
  2829. // tags:
  2830. // protected extension
  2831. var v = this._parser(value, lang.mixin({}, constraints, (this.editOptions && this.focused) ? this.editOptions : {}));
  2832. if(this.editOptions && this.focused && isNaN(v)){
  2833. v = this._parser(value, constraints); // parse w/o editOptions: not technically needed but is nice for the user
  2834. }
  2835. return v;
  2836. },
  2837. _getDisplayedValueAttr: function(){
  2838. var v = this.inherited(arguments);
  2839. return isNaN(v) ? this.textbox.value : v;
  2840. },
  2841. filter: function(/*Number*/ value){
  2842. // summary:
  2843. // This is called with both the display value (string), and the actual value (a number).
  2844. // When called with the actual value it does corrections so that '' etc. are represented as NaN.
  2845. // Otherwise it dispatches to the superclass's filter() method.
  2846. //
  2847. // See `dijit.form.TextBox.filter` for more details.
  2848. return (value === null || value === '' || value === undefined) ? NaN : this.inherited(arguments); // set('value', null||''||undefined) should fire onChange(NaN)
  2849. },
  2850. serialize: function(/*Number*/ value, /*Object?*/ options){
  2851. // summary:
  2852. // Convert value (a Number) into a canonical string (ie, how the number literal is written in javascript/java/C/etc.)
  2853. // tags:
  2854. // protected
  2855. return (typeof value != "number" || isNaN(value)) ? '' : this.inherited(arguments);
  2856. },
  2857. _setBlurValue: function(){
  2858. var val = lang.hitch(lang.mixin({}, this, { focused: true }), "get")('value'); // parse with editOptions
  2859. this._setValueAttr(val, true);
  2860. },
  2861. _setValueAttr: function(/*Number*/ value, /*Boolean?*/ priorityChange, /*String?*/ formattedValue){
  2862. // summary:
  2863. // Hook so set('value', ...) works.
  2864. if(value !== undefined && formattedValue === undefined){
  2865. formattedValue = String(value);
  2866. if(typeof value == "number"){
  2867. if(isNaN(value)){ formattedValue = '' }
  2868. // check for exponential notation that number.format chokes on
  2869. else if(("rangeCheck" in this && this.rangeCheck(value, this.constraints)) || this.constraints.exponent === false || !/\de[-+]?\d/i.test(formattedValue)){
  2870. formattedValue = undefined; // lets format compute a real string value
  2871. }
  2872. }else if(!value){ // 0 processed in if branch above, ''|null|undefined flows through here
  2873. formattedValue = '';
  2874. value = NaN;
  2875. }else{ // non-numeric values
  2876. value = undefined;
  2877. }
  2878. }
  2879. this.inherited(arguments, [value, priorityChange, formattedValue]);
  2880. },
  2881. _getValueAttr: function(){
  2882. // summary:
  2883. // Hook so get('value') works.
  2884. // Returns Number, NaN for '', or undefined for unparseable text
  2885. var v = this.inherited(arguments); // returns Number for all values accepted by parse() or NaN for all other displayed values
  2886. // If the displayed value of the textbox is gibberish (ex: "hello world"), this.inherited() above
  2887. // returns NaN; this if() branch converts the return value to undefined.
  2888. // Returning undefined prevents user text from being overwritten when doing _setValueAttr(_getValueAttr()).
  2889. // A blank displayed value is still returned as NaN.
  2890. if(isNaN(v) && this.textbox.value !== ''){
  2891. if(this.constraints.exponent !== false && /\de[-+]?\d/i.test(this.textbox.value) && (new RegExp("^"+number._realNumberRegexp(lang.mixin({}, this.constraints))+"$").test(this.textbox.value))){ // check for exponential notation that parse() rejected (erroneously?)
  2892. var n = Number(this.textbox.value);
  2893. return isNaN(n) ? undefined : n; // return exponential Number or undefined for random text (may not be possible to do with the above RegExp check)
  2894. }else{
  2895. return undefined; // gibberish
  2896. }
  2897. }else{
  2898. return v; // Number or NaN for ''
  2899. }
  2900. },
  2901. isValid: function(/*Boolean*/ isFocused){
  2902. // Overrides dijit.form.RangeBoundTextBox.isValid to check that the editing-mode value is valid since
  2903. // it may not be formatted according to the regExp validation rules
  2904. if(!this.focused || this._isEmpty(this.textbox.value)){
  2905. return this.inherited(arguments);
  2906. }else{
  2907. var v = this.get('value');
  2908. if(!isNaN(v) && this.rangeCheck(v, this.constraints)){
  2909. if(this.constraints.exponent !== false && /\de[-+]?\d/i.test(this.textbox.value)){ // exponential, parse doesn't like it
  2910. return true; // valid exponential number in range
  2911. }else{
  2912. return this.inherited(arguments);
  2913. }
  2914. }else{
  2915. return false;
  2916. }
  2917. }
  2918. }
  2919. });
  2920. /*=====
  2921. NumberTextBoxMixin = dijit.form.NumberTextBoxMixin;
  2922. =====*/
  2923. var NumberTextBox = declare("dijit.form.NumberTextBox", [RangeBoundTextBox,NumberTextBoxMixin], {
  2924. // summary:
  2925. // A TextBox for entering numbers, with formatting and range checking
  2926. // description:
  2927. // NumberTextBox is a textbox for entering and displaying numbers, supporting
  2928. // the following main features:
  2929. //
  2930. // 1. Enforce minimum/maximum allowed values (as well as enforcing that the user types
  2931. // a number rather than a random string)
  2932. // 2. NLS support (altering roles of comma and dot as "thousands-separator" and "decimal-point"
  2933. // depending on locale).
  2934. // 3. Separate modes for editing the value and displaying it, specifically that
  2935. // the thousands separator character (typically comma) disappears when editing
  2936. // but reappears after the field is blurred.
  2937. // 4. Formatting and constraints regarding the number of places (digits after the decimal point)
  2938. // allowed on input, and number of places displayed when blurred (see `constraints` parameter).
  2939. baseClass: "dijitTextBox dijitNumberTextBox"
  2940. });
  2941. NumberTextBox.Mixin = NumberTextBoxMixin; // for monkey patching
  2942. return NumberTextBox;
  2943. });
  2944. },
  2945. 'dijit/ColorPalette':function(){
  2946. require({cache:{
  2947. 'url:dijit/templates/ColorPalette.html':"<div class=\"dijitInline dijitColorPalette\">\n\t<table dojoAttachPoint=\"paletteTableNode\" class=\"dijitPaletteTable\" cellSpacing=\"0\" cellPadding=\"0\" role=\"grid\">\n\t\t<tbody data-dojo-attach-point=\"gridNode\"></tbody>\n\t</table>\n</div>\n"}});
  2948. define("dijit/ColorPalette", [
  2949. "require", // require.toUrl
  2950. "dojo/text!./templates/ColorPalette.html",
  2951. "./_Widget",
  2952. "./_TemplatedMixin",
  2953. "./_PaletteMixin",
  2954. "dojo/i18n", // i18n.getLocalization
  2955. "dojo/_base/Color", // dojo.Color dojo.Color.named
  2956. "dojo/_base/declare", // declare
  2957. "dojo/dom-class", // domClass.contains
  2958. "dojo/dom-construct", // domConstruct.place
  2959. "dojo/_base/window", // win.body
  2960. "dojo/string", // string.substitute
  2961. "dojo/i18n!dojo/nls/colors", // translations
  2962. "dojo/colors" // extend dojo.Color w/names of other colors
  2963. ], function(require, template, _Widget, _TemplatedMixin, _PaletteMixin, i18n, Color,
  2964. declare, domClass, domConstruct, win, string){
  2965. /*=====
  2966. var _Widget = dijit._Widget;
  2967. var _TemplatedMixin = dijit._TemplatedMixin;
  2968. var _PaletteMixin = dijit._PaletteMixin;
  2969. =====*/
  2970. // module:
  2971. // dijit/ColorPalette
  2972. // summary:
  2973. // A keyboard accessible color-picking widget
  2974. var ColorPalette = declare("dijit.ColorPalette", [_Widget, _TemplatedMixin, _PaletteMixin], {
  2975. // summary:
  2976. // A keyboard accessible color-picking widget
  2977. // description:
  2978. // Grid showing various colors, so the user can pick a certain color.
  2979. // Can be used standalone, or as a popup.
  2980. //
  2981. // example:
  2982. // | <div data-dojo-type="dijit.ColorPalette"></div>
  2983. //
  2984. // example:
  2985. // | var picker = new dijit.ColorPalette({ },srcNode);
  2986. // | picker.startup();
  2987. // palette: [const] String
  2988. // Size of grid, either "7x10" or "3x4".
  2989. palette: "7x10",
  2990. // _palettes: [protected] Map
  2991. // This represents the value of the colors.
  2992. // The first level is a hashmap of the different palettes available.
  2993. // The next two dimensions represent the columns and rows of colors.
  2994. _palettes: {
  2995. "7x10": [["white", "seashell", "cornsilk", "lemonchiffon","lightyellow", "palegreen", "paleturquoise", "lightcyan", "lavender", "plum"],
  2996. ["lightgray", "pink", "bisque", "moccasin", "khaki", "lightgreen", "lightseagreen", "lightskyblue", "cornflowerblue", "violet"],
  2997. ["silver", "lightcoral", "sandybrown", "orange", "palegoldenrod", "chartreuse", "mediumturquoise", "skyblue", "mediumslateblue","orchid"],
  2998. ["gray", "red", "orangered", "darkorange", "yellow", "limegreen", "darkseagreen", "royalblue", "slateblue", "mediumorchid"],
  2999. ["dimgray", "crimson", "chocolate", "coral", "gold", "forestgreen", "seagreen", "blue", "blueviolet", "darkorchid"],
  3000. ["darkslategray","firebrick","saddlebrown", "sienna", "olive", "green", "darkcyan", "mediumblue","darkslateblue", "darkmagenta" ],
  3001. ["black", "darkred", "maroon", "brown", "darkolivegreen", "darkgreen", "midnightblue", "navy", "indigo", "purple"]],
  3002. "3x4": [["white", "lime", "green", "blue"],
  3003. ["silver", "yellow", "fuchsia", "navy"],
  3004. ["gray", "red", "purple", "black"]]
  3005. },
  3006. // templateString: String
  3007. // The template of this widget.
  3008. templateString: template,
  3009. baseClass: "dijitColorPalette",
  3010. _dyeFactory: function(value, row, col){
  3011. // Overrides _PaletteMixin._dyeFactory().
  3012. return new this._dyeClass(value, row, col);
  3013. },
  3014. buildRendering: function(){
  3015. // Instantiate the template, which makes a skeleton into which we'll insert a bunch of
  3016. // <img> nodes
  3017. this.inherited(arguments);
  3018. // Creates customized constructor for dye class (color of a single cell) for
  3019. // specified palette and high-contrast vs. normal mode. Used in _getDye().
  3020. this._dyeClass = declare(ColorPalette._Color, {
  3021. hc: domClass.contains(win.body(), "dijit_a11y"),
  3022. palette: this.palette
  3023. });
  3024. // Creates <img> nodes in each cell of the template.
  3025. this._preparePalette(
  3026. this._palettes[this.palette],
  3027. i18n.getLocalization("dojo", "colors", this.lang));
  3028. }
  3029. });
  3030. ColorPalette._Color = declare("dijit._Color", Color, {
  3031. // summary:
  3032. // Object associated with each cell in a ColorPalette palette.
  3033. // Implements dijit.Dye.
  3034. // Template for each cell in normal (non-high-contrast mode). Each cell contains a wrapper
  3035. // node for showing the border (called dijitPaletteImg for back-compat), and dijitColorPaletteSwatch
  3036. // for showing the color.
  3037. template:
  3038. "<span class='dijitInline dijitPaletteImg'>" +
  3039. "<img src='${blankGif}' alt='${alt}' class='dijitColorPaletteSwatch' style='background-color: ${color}'/>" +
  3040. "</span>",
  3041. // Template for each cell in high contrast mode. Each cell contains an image with the whole palette,
  3042. // but scrolled and clipped to show the correct color only
  3043. hcTemplate:
  3044. "<span class='dijitInline dijitPaletteImg' style='position: relative; overflow: hidden; height: 12px; width: 14px;'>" +
  3045. "<img src='${image}' alt='${alt}' style='position: absolute; left: ${left}px; top: ${top}px; ${size}'/>" +
  3046. "</span>",
  3047. // _imagePaths: [protected] Map
  3048. // This is stores the path to the palette images used for high-contrast mode display
  3049. _imagePaths: {
  3050. "7x10": require.toUrl("./themes/a11y/colors7x10.png"),
  3051. "3x4": require.toUrl("./themes/a11y/colors3x4.png")
  3052. },
  3053. constructor: function(/*String*/alias, /*Number*/ row, /*Number*/ col){
  3054. this._alias = alias;
  3055. this._row = row;
  3056. this._col = col;
  3057. this.setColor(Color.named[alias]);
  3058. },
  3059. getValue: function(){
  3060. // summary:
  3061. // Note that although dijit._Color is initialized with a value like "white" getValue() always
  3062. // returns a hex value
  3063. return this.toHex();
  3064. },
  3065. fillCell: function(/*DOMNode*/ cell, /*String*/ blankGif){
  3066. var html = string.substitute(this.hc ? this.hcTemplate : this.template, {
  3067. // substitution variables for normal mode
  3068. color: this.toHex(),
  3069. blankGif: blankGif,
  3070. alt: this._alias,
  3071. // variables used for high contrast mode
  3072. image: this._imagePaths[this.palette].toString(),
  3073. left: this._col * -20 - 5,
  3074. top: this._row * -20 - 5,
  3075. size: this.palette == "7x10" ? "height: 145px; width: 206px" : "height: 64px; width: 86px"
  3076. });
  3077. domConstruct.place(html, cell);
  3078. }
  3079. });
  3080. return ColorPalette;
  3081. });
  3082. },
  3083. 'url:dijit/form/templates/CheckBox.html':"<div class=\"dijit dijitReset dijitInline\" role=\"presentation\"\n\t><input\n\t \t${!nameAttrSetting} type=\"${type}\" ${checkedAttrSetting}\n\t\tclass=\"dijitReset dijitCheckBoxInput\"\n\t\tdata-dojo-attach-point=\"focusNode\"\n\t \tdata-dojo-attach-event=\"onclick:_onClick\"\n/></div>\n",
  3084. 'dijit/form/RangeBoundTextBox':function(){
  3085. define("dijit/form/RangeBoundTextBox", [
  3086. "dojo/_base/declare", // declare
  3087. "dojo/i18n", // i18n.getLocalization
  3088. "./MappedTextBox"
  3089. ], function(declare, i18n, MappedTextBox){
  3090. /*=====
  3091. var MappedTextBox = dijit.form.MappedTextBox;
  3092. =====*/
  3093. // module:
  3094. // dijit/form/RangeBoundTextBox
  3095. // summary:
  3096. // Base class for textbox form widgets which defines a range of valid values.
  3097. /*=====
  3098. dijit.form.RangeBoundTextBox.__Constraints = function(){
  3099. // min: Number
  3100. // Minimum signed value. Default is -Infinity
  3101. // max: Number
  3102. // Maximum signed value. Default is +Infinity
  3103. this.min = min;
  3104. this.max = max;
  3105. }
  3106. =====*/
  3107. return declare("dijit.form.RangeBoundTextBox", MappedTextBox, {
  3108. // summary:
  3109. // Base class for textbox form widgets which defines a range of valid values.
  3110. // rangeMessage: String
  3111. // The message to display if value is out-of-range
  3112. rangeMessage: "",
  3113. /*=====
  3114. // constraints: dijit.form.RangeBoundTextBox.__Constraints
  3115. constraints: {},
  3116. ======*/
  3117. rangeCheck: function(/*Number*/ primitive, /*dijit.form.RangeBoundTextBox.__Constraints*/ constraints){
  3118. // summary:
  3119. // Overridable function used to validate the range of the numeric input value.
  3120. // tags:
  3121. // protected
  3122. return ("min" in constraints? (this.compare(primitive,constraints.min) >= 0) : true) &&
  3123. ("max" in constraints? (this.compare(primitive,constraints.max) <= 0) : true); // Boolean
  3124. },
  3125. isInRange: function(/*Boolean*/ /*===== isFocused =====*/){
  3126. // summary:
  3127. // Tests if the value is in the min/max range specified in constraints
  3128. // tags:
  3129. // protected
  3130. return this.rangeCheck(this.get('value'), this.constraints);
  3131. },
  3132. _isDefinitelyOutOfRange: function(){
  3133. // summary:
  3134. // Returns true if the value is out of range and will remain
  3135. // out of range even if the user types more characters
  3136. var val = this.get('value');
  3137. var isTooLittle = false;
  3138. var isTooMuch = false;
  3139. if("min" in this.constraints){
  3140. var min = this.constraints.min;
  3141. min = this.compare(val, ((typeof min == "number") && min >= 0 && val !=0) ? 0 : min);
  3142. isTooLittle = (typeof min == "number") && min < 0;
  3143. }
  3144. if("max" in this.constraints){
  3145. var max = this.constraints.max;
  3146. max = this.compare(val, ((typeof max != "number") || max > 0) ? max : 0);
  3147. isTooMuch = (typeof max == "number") && max > 0;
  3148. }
  3149. return isTooLittle || isTooMuch;
  3150. },
  3151. _isValidSubset: function(){
  3152. // summary:
  3153. // Overrides `dijit.form.ValidationTextBox._isValidSubset`.
  3154. // Returns true if the input is syntactically valid, and either within
  3155. // range or could be made in range by more typing.
  3156. return this.inherited(arguments) && !this._isDefinitelyOutOfRange();
  3157. },
  3158. isValid: function(/*Boolean*/ isFocused){
  3159. // Overrides dijit.form.ValidationTextBox.isValid to check that the value is also in range.
  3160. return this.inherited(arguments) &&
  3161. ((this._isEmpty(this.textbox.value) && !this.required) || this.isInRange(isFocused)); // Boolean
  3162. },
  3163. getErrorMessage: function(/*Boolean*/ isFocused){
  3164. // Overrides dijit.form.ValidationTextBox.getErrorMessage to print "out of range" message if appropriate
  3165. var v = this.get('value');
  3166. if(v !== null && v !== '' && v !== undefined && (typeof v != "number" || !isNaN(v)) && !this.isInRange(isFocused)){ // don't check isInRange w/o a real value
  3167. return this.rangeMessage; // String
  3168. }
  3169. return this.inherited(arguments);
  3170. },
  3171. postMixInProperties: function(){
  3172. this.inherited(arguments);
  3173. if(!this.rangeMessage){
  3174. this.messages = i18n.getLocalization("dijit.form", "validate", this.lang);
  3175. this.rangeMessage = this.messages.rangeMessage;
  3176. }
  3177. },
  3178. _setConstraintsAttr: function(/*Object*/ constraints){
  3179. this.inherited(arguments);
  3180. if(this.focusNode){ // not set when called from postMixInProperties
  3181. if(this.constraints.min !== undefined){
  3182. this.focusNode.setAttribute("aria-valuemin", this.constraints.min);
  3183. }else{
  3184. this.focusNode.removeAttribute("aria-valuemin");
  3185. }
  3186. if(this.constraints.max !== undefined){
  3187. this.focusNode.setAttribute("aria-valuemax", this.constraints.max);
  3188. }else{
  3189. this.focusNode.removeAttribute("aria-valuemax");
  3190. }
  3191. }
  3192. },
  3193. _setValueAttr: function(/*Number*/ value, /*Boolean?*/ priorityChange){
  3194. // summary:
  3195. // Hook so set('value', ...) works.
  3196. this.focusNode.setAttribute("aria-valuenow", value);
  3197. this.inherited(arguments);
  3198. },
  3199. applyTextDir: function(/*===== element, text =====*/){
  3200. // summary:
  3201. // The function overridden in the _BidiSupport module,
  3202. // originally used for setting element.dir according to this.textDir.
  3203. // In this case does nothing.
  3204. // element: Object
  3205. // text: String
  3206. // tags:
  3207. // protected.
  3208. }
  3209. });
  3210. });
  3211. },
  3212. 'dojo/store/util/SimpleQueryEngine':function(){
  3213. define("dojo/store/util/SimpleQueryEngine", ["../../_base/array"], function(arrayUtil) {
  3214. // module:
  3215. // dojo/store/util/SimpleQueryEngine
  3216. // summary:
  3217. // The module defines a simple filtering query engine for object stores.
  3218. return function(query, options){
  3219. // summary:
  3220. // Simple query engine that matches using filter functions, named filter
  3221. // functions or objects by name-value on a query object hash
  3222. //
  3223. // description:
  3224. // The SimpleQueryEngine provides a way of getting a QueryResults through
  3225. // the use of a simple object hash as a filter. The hash will be used to
  3226. // match properties on data objects with the corresponding value given. In
  3227. // other words, only exact matches will be returned.
  3228. //
  3229. // This function can be used as a template for more complex query engines;
  3230. // for example, an engine can be created that accepts an object hash that
  3231. // contains filtering functions, or a string that gets evaluated, etc.
  3232. //
  3233. // When creating a new dojo.store, simply set the store's queryEngine
  3234. // field as a reference to this function.
  3235. //
  3236. // query: Object
  3237. // An object hash with fields that may match fields of items in the store.
  3238. // Values in the hash will be compared by normal == operator, but regular expressions
  3239. // or any object that provides a test() method are also supported and can be
  3240. // used to match strings by more complex expressions
  3241. // (and then the regex's or object's test() method will be used to match values).
  3242. //
  3243. // options: dojo.store.util.SimpleQueryEngine.__queryOptions?
  3244. // An object that contains optional information such as sort, start, and count.
  3245. //
  3246. // returns: Function
  3247. // A function that caches the passed query under the field "matches". See any
  3248. // of the "query" methods on dojo.stores.
  3249. //
  3250. // example:
  3251. // Define a store with a reference to this engine, and set up a query method.
  3252. //
  3253. // | var myStore = function(options){
  3254. // | // ...more properties here
  3255. // | this.queryEngine = dojo.store.util.SimpleQueryEngine;
  3256. // | // define our query method
  3257. // | this.query = function(query, options){
  3258. // | return dojo.store.util.QueryResults(this.queryEngine(query, options)(this.data));
  3259. // | };
  3260. // | };
  3261. // create our matching query function
  3262. switch(typeof query){
  3263. default:
  3264. throw new Error("Can not query with a " + typeof query);
  3265. case "object": case "undefined":
  3266. var queryObject = query;
  3267. query = function(object){
  3268. for(var key in queryObject){
  3269. var required = queryObject[key];
  3270. if(required && required.test){
  3271. if(!required.test(object[key])){
  3272. return false;
  3273. }
  3274. }else if(required != object[key]){
  3275. return false;
  3276. }
  3277. }
  3278. return true;
  3279. };
  3280. break;
  3281. case "string":
  3282. // named query
  3283. if(!this[query]){
  3284. throw new Error("No filter function " + query + " was found in store");
  3285. }
  3286. query = this[query];
  3287. // fall through
  3288. case "function":
  3289. // fall through
  3290. }
  3291. function execute(array){
  3292. // execute the whole query, first we filter
  3293. var results = arrayUtil.filter(array, query);
  3294. // next we sort
  3295. if(options && options.sort){
  3296. results.sort(function(a, b){
  3297. for(var sort, i=0; sort = options.sort[i]; i++){
  3298. var aValue = a[sort.attribute];
  3299. var bValue = b[sort.attribute];
  3300. // valueOf enables proper comparison of dates
  3301. aValue = aValue != null ? aValue.valueOf() : aValue;
  3302. bValue = bValue != null ? bValue.valueOf() : bValue;
  3303. if (aValue != bValue) {
  3304. return !!sort.descending == aValue > bValue ? -1 : 1;
  3305. }
  3306. }
  3307. return 0;
  3308. });
  3309. }
  3310. // now we paginate
  3311. if(options && (options.start || options.count)){
  3312. var total = results.length;
  3313. results = results.slice(options.start || 0, (options.start || 0) + (options.count || Infinity));
  3314. results.total = total;
  3315. }
  3316. return results;
  3317. }
  3318. execute.matches = query;
  3319. return execute;
  3320. };
  3321. });
  3322. },
  3323. 'dojox/color/_base':function(){
  3324. define("dojox/color/_base", ["dojo/_base/kernel", "../main", "dojo/_base/lang", "dojo/_base/Color", "dojo/colors"],
  3325. function(dojo, dojox, lang, Color, colors){
  3326. var cx = lang.getObject("dojox.color", true);
  3327. /*===== cx = dojox.color =====*/
  3328. // alias all the dojo.Color mechanisms
  3329. cx.Color=Color;
  3330. cx.blend=Color.blendColors;
  3331. cx.fromRgb=Color.fromRgb;
  3332. cx.fromHex=Color.fromHex;
  3333. cx.fromArray=Color.fromArray;
  3334. cx.fromString=Color.fromString;
  3335. // alias the dojo.colors mechanisms
  3336. cx.greyscale=colors.makeGrey;
  3337. lang.mixin(cx,{
  3338. fromCmy: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow){
  3339. // summary
  3340. // Create a dojox.color.Color from a CMY defined color.
  3341. // All colors should be expressed as 0-100 (percentage)
  3342. if(lang.isArray(cyan)){
  3343. magenta=cyan[1], yellow=cyan[2], cyan=cyan[0];
  3344. } else if(lang.isObject(cyan)){
  3345. magenta=cyan.m, yellow=cyan.y, cyan=cyan.c;
  3346. }
  3347. cyan/=100, magenta/=100, yellow/=100;
  3348. var r=1-cyan, g=1-magenta, b=1-yellow;
  3349. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  3350. },
  3351. fromCmyk: function(/* Object|Array|int */cyan, /*int*/magenta, /*int*/yellow, /*int*/black){
  3352. // summary
  3353. // Create a dojox.color.Color from a CMYK defined color.
  3354. // All colors should be expressed as 0-100 (percentage)
  3355. if(lang.isArray(cyan)){
  3356. magenta=cyan[1], yellow=cyan[2], black=cyan[3], cyan=cyan[0];
  3357. } else if(lang.isObject(cyan)){
  3358. magenta=cyan.m, yellow=cyan.y, black=cyan.b, cyan=cyan.c;
  3359. }
  3360. cyan/=100, magenta/=100, yellow/=100, black/=100;
  3361. var r,g,b;
  3362. r = 1-Math.min(1, cyan*(1-black)+black);
  3363. g = 1-Math.min(1, magenta*(1-black)+black);
  3364. b = 1-Math.min(1, yellow*(1-black)+black);
  3365. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  3366. },
  3367. fromHsl: function(/* Object|Array|int */hue, /* int */saturation, /* int */luminosity){
  3368. // summary
  3369. // Create a dojox.color.Color from an HSL defined color.
  3370. // hue from 0-359 (degrees), saturation and luminosity 0-100.
  3371. if(lang.isArray(hue)){
  3372. saturation=hue[1], luminosity=hue[2], hue=hue[0];
  3373. } else if(lang.isObject(hue)){
  3374. saturation=hue.s, luminosity=hue.l, hue=hue.h;
  3375. }
  3376. saturation/=100;
  3377. luminosity/=100;
  3378. while(hue<0){ hue+=360; }
  3379. while(hue>=360){ hue-=360; }
  3380. var r, g, b;
  3381. if(hue<120){
  3382. r=(120-hue)/60, g=hue/60, b=0;
  3383. } else if (hue<240){
  3384. r=0, g=(240-hue)/60, b=(hue-120)/60;
  3385. } else {
  3386. r=(hue-240)/60, g=0, b=(360-hue)/60;
  3387. }
  3388. r=2*saturation*Math.min(r, 1)+(1-saturation);
  3389. g=2*saturation*Math.min(g, 1)+(1-saturation);
  3390. b=2*saturation*Math.min(b, 1)+(1-saturation);
  3391. if(luminosity<0.5){
  3392. r*=luminosity, g*=luminosity, b*=luminosity;
  3393. }else{
  3394. r=(1-luminosity)*r+2*luminosity-1;
  3395. g=(1-luminosity)*g+2*luminosity-1;
  3396. b=(1-luminosity)*b+2*luminosity-1;
  3397. }
  3398. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  3399. }
  3400. });
  3401. cx.fromHsv = function(/* Object|Array|int */hue, /* int */saturation, /* int */value){
  3402. // summary
  3403. // Create a dojox.color.Color from an HSV defined color.
  3404. // hue from 0-359 (degrees), saturation and value 0-100.
  3405. if(lang.isArray(hue)){
  3406. saturation=hue[1], value=hue[2], hue=hue[0];
  3407. } else if (lang.isObject(hue)){
  3408. saturation=hue.s, value=hue.v, hue=hue.h;
  3409. }
  3410. if(hue==360){ hue=0; }
  3411. saturation/=100;
  3412. value/=100;
  3413. var r, g, b;
  3414. if(saturation==0){
  3415. r=value, b=value, g=value;
  3416. }else{
  3417. var hTemp=hue/60, i=Math.floor(hTemp), f=hTemp-i;
  3418. var p=value*(1-saturation);
  3419. var q=value*(1-(saturation*f));
  3420. var t=value*(1-(saturation*(1-f)));
  3421. switch(i){
  3422. case 0:{ r=value, g=t, b=p; break; }
  3423. case 1:{ r=q, g=value, b=p; break; }
  3424. case 2:{ r=p, g=value, b=t; break; }
  3425. case 3:{ r=p, g=q, b=value; break; }
  3426. case 4:{ r=t, g=p, b=value; break; }
  3427. case 5:{ r=value, g=p, b=q; break; }
  3428. }
  3429. }
  3430. return new Color({ r:Math.round(r*255), g:Math.round(g*255), b:Math.round(b*255) }); // dojox.color.Color
  3431. };
  3432. lang.extend(Color,{
  3433. toCmy: function(){
  3434. // summary
  3435. // Convert this Color to a CMY definition.
  3436. var cyan=1-(this.r/255), magenta=1-(this.g/255), yellow=1-(this.b/255);
  3437. return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100) }; // Object
  3438. },
  3439. toCmyk: function(){
  3440. // summary
  3441. // Convert this Color to a CMYK definition.
  3442. var cyan, magenta, yellow, black;
  3443. var r=this.r/255, g=this.g/255, b=this.b/255;
  3444. black = Math.min(1-r, 1-g, 1-b);
  3445. cyan = (1-r-black)/(1-black);
  3446. magenta = (1-g-black)/(1-black);
  3447. yellow = (1-b-black)/(1-black);
  3448. return { c:Math.round(cyan*100), m:Math.round(magenta*100), y:Math.round(yellow*100), b:Math.round(black*100) }; // Object
  3449. },
  3450. toHsl: function(){
  3451. // summary
  3452. // Convert this Color to an HSL definition.
  3453. var r=this.r/255, g=this.g/255, b=this.b/255;
  3454. var min = Math.min(r, b, g), max = Math.max(r, g, b);
  3455. var delta = max-min;
  3456. var h=0, s=0, l=(min+max)/2;
  3457. if(l>0 && l<1){
  3458. s = delta/((l<0.5)?(2*l):(2-2*l));
  3459. }
  3460. if(delta>0){
  3461. if(max==r && max!=g){
  3462. h+=(g-b)/delta;
  3463. }
  3464. if(max==g && max!=b){
  3465. h+=(2+(b-r)/delta);
  3466. }
  3467. if(max==b && max!=r){
  3468. h+=(4+(r-g)/delta);
  3469. }
  3470. h*=60;
  3471. }
  3472. return { h:h, s:Math.round(s*100), l:Math.round(l*100) }; // Object
  3473. },
  3474. toHsv: function(){
  3475. // summary
  3476. // Convert this Color to an HSV definition.
  3477. var r=this.r/255, g=this.g/255, b=this.b/255;
  3478. var min = Math.min(r, b, g), max = Math.max(r, g, b);
  3479. var delta = max-min;
  3480. var h = null, s = (max==0)?0:(delta/max);
  3481. if(s==0){
  3482. h = 0;
  3483. }else{
  3484. if(r==max){
  3485. h = 60*(g-b)/delta;
  3486. }else if(g==max){
  3487. h = 120 + 60*(b-r)/delta;
  3488. }else{
  3489. h = 240 + 60*(r-g)/delta;
  3490. }
  3491. if(h<0){ h+=360; }
  3492. }
  3493. return { h:h, s:Math.round(s*100), v:Math.round(max*100) }; // Object
  3494. }
  3495. });
  3496. return cx;
  3497. });
  3498. },
  3499. 'dojo/store/Memory':function(){
  3500. define("dojo/store/Memory", ["../_base/declare", "./util/QueryResults", "./util/SimpleQueryEngine"], function(declare, QueryResults, SimpleQueryEngine) {
  3501. // module:
  3502. // dojo/store/Memory
  3503. // summary:
  3504. // The module defines an in-memory object store.
  3505. return declare("dojo.store.Memory", null, {
  3506. // summary:
  3507. // This is a basic in-memory object store. It implements dojo.store.api.Store.
  3508. constructor: function(/*dojo.store.Memory*/ options){
  3509. // summary:
  3510. // Creates a memory object store.
  3511. // options:
  3512. // This provides any configuration information that will be mixed into the store.
  3513. // This should generally include the data property to provide the starting set of data.
  3514. for(var i in options){
  3515. this[i] = options[i];
  3516. }
  3517. this.setData(this.data || []);
  3518. },
  3519. // data: Array
  3520. // The array of all the objects in the memory store
  3521. data:null,
  3522. // idProperty: String
  3523. // Indicates the property to use as the identity property. The values of this
  3524. // property should be unique.
  3525. idProperty: "id",
  3526. // index: Object
  3527. // An index of data indices into the data array by id
  3528. index:null,
  3529. // queryEngine: Function
  3530. // Defines the query engine to use for querying the data store
  3531. queryEngine: SimpleQueryEngine,
  3532. get: function(id){
  3533. // summary:
  3534. // Retrieves an object by its identity
  3535. // id: Number
  3536. // The identity to use to lookup the object
  3537. // returns: Object
  3538. // The object in the store that matches the given id.
  3539. return this.data[this.index[id]];
  3540. },
  3541. getIdentity: function(object){
  3542. // summary:
  3543. // Returns an object's identity
  3544. // object: Object
  3545. // The object to get the identity from
  3546. // returns: Number
  3547. return object[this.idProperty];
  3548. },
  3549. put: function(object, options){
  3550. // summary:
  3551. // Stores an object
  3552. // object: Object
  3553. // The object to store.
  3554. // options: dojo.store.api.Store.PutDirectives??
  3555. // Additional metadata for storing the data. Includes an "id"
  3556. // property if a specific id is to be used.
  3557. // returns: Number
  3558. var data = this.data,
  3559. index = this.index,
  3560. idProperty = this.idProperty;
  3561. var id = (options && "id" in options) ? options.id : idProperty in object ? object[idProperty] : Math.random();
  3562. if(id in index){
  3563. // object exists
  3564. if(options && options.overwrite === false){
  3565. throw new Error("Object already exists");
  3566. }
  3567. // replace the entry in data
  3568. data[index[id]] = object;
  3569. }else{
  3570. // add the new object
  3571. index[id] = data.push(object) - 1;
  3572. }
  3573. return id;
  3574. },
  3575. add: function(object, options){
  3576. // summary:
  3577. // Creates an object, throws an error if the object already exists
  3578. // object: Object
  3579. // The object to store.
  3580. // options: dojo.store.api.Store.PutDirectives??
  3581. // Additional metadata for storing the data. Includes an "id"
  3582. // property if a specific id is to be used.
  3583. // returns: Number
  3584. (options = options || {}).overwrite = false;
  3585. // call put with overwrite being false
  3586. return this.put(object, options);
  3587. },
  3588. remove: function(id){
  3589. // summary:
  3590. // Deletes an object by its identity
  3591. // id: Number
  3592. // The identity to use to delete the object
  3593. // returns: Boolean
  3594. // Returns true if an object was removed, falsy (undefined) if no object matched the id
  3595. var index = this.index;
  3596. var data = this.data;
  3597. if(id in index){
  3598. data.splice(index[id], 1);
  3599. // now we have to reindex
  3600. this.setData(data);
  3601. return true;
  3602. }
  3603. },
  3604. query: function(query, options){
  3605. // summary:
  3606. // Queries the store for objects.
  3607. // query: Object
  3608. // The query to use for retrieving objects from the store.
  3609. // options: dojo.store.api.Store.QueryOptions?
  3610. // The optional arguments to apply to the resultset.
  3611. // returns: dojo.store.api.Store.QueryResults
  3612. // The results of the query, extended with iterative methods.
  3613. //
  3614. // example:
  3615. // Given the following store:
  3616. //
  3617. // | var store = new dojo.store.Memory({
  3618. // | data: [
  3619. // | {id: 1, name: "one", prime: false },
  3620. // | {id: 2, name: "two", even: true, prime: true},
  3621. // | {id: 3, name: "three", prime: true},
  3622. // | {id: 4, name: "four", even: true, prime: false},
  3623. // | {id: 5, name: "five", prime: true}
  3624. // | ]
  3625. // | });
  3626. //
  3627. // ...find all items where "prime" is true:
  3628. //
  3629. // | var results = store.query({ prime: true });
  3630. //
  3631. // ...or find all items where "even" is true:
  3632. //
  3633. // | var results = store.query({ even: true });
  3634. return QueryResults(this.queryEngine(query, options)(this.data));
  3635. },
  3636. setData: function(data){
  3637. // summary:
  3638. // Sets the given data as the source for this store, and indexes it
  3639. // data: Object[]
  3640. // An array of objects to use as the source of data.
  3641. if(data.items){
  3642. // just for convenience with the data format IFRS expects
  3643. this.idProperty = data.identifier || this.idProperty;
  3644. data = this.data = data.items;
  3645. }else{
  3646. this.data = data;
  3647. }
  3648. this.index = {};
  3649. for(var i = 0, l = data.length; i < l; i++){
  3650. this.index[data[i][this.idProperty]] = i;
  3651. }
  3652. }
  3653. });
  3654. });
  3655. },
  3656. 'dijit/form/ComboBox':function(){
  3657. define("dijit/form/ComboBox", [
  3658. "dojo/_base/declare", // declare
  3659. "./ValidationTextBox",
  3660. "./ComboBoxMixin"
  3661. ], function(declare, ValidationTextBox, ComboBoxMixin){
  3662. /*=====
  3663. var ValidationTextBox = dijit.form.ValidationTextBox;
  3664. var ComboBoxMixin = dijit.form.ComboBoxMixin;
  3665. =====*/
  3666. // module:
  3667. // dijit/form/ComboBox
  3668. // summary:
  3669. // Auto-completing text box
  3670. return declare("dijit.form.ComboBox", [ValidationTextBox, ComboBoxMixin], {
  3671. // summary:
  3672. // Auto-completing text box
  3673. //
  3674. // description:
  3675. // The drop down box's values are populated from an class called
  3676. // a data provider, which returns a list of values based on the characters
  3677. // that the user has typed into the input box.
  3678. // If OPTION tags are used as the data provider via markup,
  3679. // then the OPTION tag's child text node is used as the widget value
  3680. // when selected. The OPTION tag's value attribute is ignored.
  3681. // To set the default value when using OPTION tags, specify the selected
  3682. // attribute on 1 of the child OPTION tags.
  3683. //
  3684. // Some of the options to the ComboBox are actually arguments to the data
  3685. // provider.
  3686. });
  3687. });
  3688. },
  3689. 'dijit/form/_CheckBoxMixin':function(){
  3690. define("dijit/form/_CheckBoxMixin", [
  3691. "dojo/_base/declare", // declare
  3692. "dojo/dom-attr", // domAttr.set
  3693. "dojo/_base/event" // event.stop
  3694. ], function(declare, domAttr, event){
  3695. // module:
  3696. // dijit/form/_CheckBoxMixin
  3697. // summary:
  3698. // Mixin to provide widget functionality corresponding to an HTML checkbox
  3699. return declare("dijit.form._CheckBoxMixin", null, {
  3700. // summary:
  3701. // Mixin to provide widget functionality corresponding to an HTML checkbox
  3702. //
  3703. // description:
  3704. // User interacts with real html inputs.
  3705. // On onclick (which occurs by mouse click, space-bar, or
  3706. // using the arrow keys to switch the selected radio button),
  3707. // we update the state of the checkbox/radio.
  3708. //
  3709. // type: [private] String
  3710. // type attribute on <input> node.
  3711. // Overrides `dijit.form.Button.type`. Users should not change this value.
  3712. type: "checkbox",
  3713. // value: String
  3714. // As an initialization parameter, equivalent to value field on normal checkbox
  3715. // (if checked, the value is passed as the value when form is submitted).
  3716. value: "on",
  3717. // readOnly: Boolean
  3718. // Should this widget respond to user input?
  3719. // In markup, this is specified as "readOnly".
  3720. // Similar to disabled except readOnly form values are submitted.
  3721. readOnly: false,
  3722. // aria-pressed for toggle buttons, and aria-checked for checkboxes
  3723. _aria_attr: "aria-checked",
  3724. _setReadOnlyAttr: function(/*Boolean*/ value){
  3725. this._set("readOnly", value);
  3726. domAttr.set(this.focusNode, 'readOnly', value);
  3727. },
  3728. // Override dijit.form.Button._setLabelAttr() since we don't even have a containerNode.
  3729. // Normally users won't try to set label, except when CheckBox or RadioButton is the child of a dojox.layout.TabContainer
  3730. _setLabelAttr: undefined,
  3731. postMixInProperties: function(){
  3732. if(this.value == ""){
  3733. this.value = "on";
  3734. }
  3735. this.inherited(arguments);
  3736. },
  3737. reset: function(){
  3738. this.inherited(arguments);
  3739. // Handle unlikely event that the <input type=checkbox> value attribute has changed
  3740. this._set("value", this.params.value || "on");
  3741. domAttr.set(this.focusNode, 'value', this.value);
  3742. },
  3743. _onClick: function(/*Event*/ e){
  3744. // summary:
  3745. // Internal function to handle click actions - need to check
  3746. // readOnly, since button no longer does that check.
  3747. if(this.readOnly){
  3748. event.stop(e);
  3749. return false;
  3750. }
  3751. return this.inherited(arguments);
  3752. }
  3753. });
  3754. });
  3755. },
  3756. 'url:dijit/form/templates/ValidationTextBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\"\n\tid=\"widget_${id}\" role=\"presentation\"\n\t><div class='dijitReset dijitValidationContainer'\n\t\t><input class=\"dijitReset dijitInputField dijitValidationIcon dijitValidationInner\" value=\"&#935; \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t/></div\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class=\"dijitReset dijitInputInner\" data-dojo-attach-point='textbox,focusNode' autocomplete=\"off\"\n\t\t\t${!nameAttrSetting} type='${type}'\n\t/></div\n></div>\n",
  3757. 'url:dijit/form/templates/TextBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\" id=\"widget_${id}\" role=\"presentation\"\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class=\"dijitReset dijitInputInner\" data-dojo-attach-point='textbox,focusNode' autocomplete=\"off\"\n\t\t\t${!nameAttrSetting} type='${type}'\n\t/></div\n></div>\n",
  3758. 'dijit/form/DataList':function(){
  3759. define("dijit/form/DataList", [
  3760. "dojo/_base/declare", // declare
  3761. "dojo/dom", // dom.byId
  3762. "dojo/_base/lang", // lang.trim
  3763. "dojo/query", // query
  3764. "dojo/store/Memory", // dojo.store.Memory
  3765. "../registry" // registry.add registry.remove
  3766. ], function(declare, dom, lang, query, MemoryStore, registry){
  3767. // module:
  3768. // dijit/form/DataList
  3769. // summary:
  3770. // Inefficient but small data store specialized for inlined data via OPTION tags
  3771. function toItem(/*DOMNode*/ option){
  3772. // summary:
  3773. // Convert <option> node to hash
  3774. return {
  3775. id: option.value,
  3776. value: option.value,
  3777. name: lang.trim(option.innerText || option.textContent || '')
  3778. };
  3779. }
  3780. return declare("dijit.form.DataList", MemoryStore, {
  3781. // summary:
  3782. // Inefficient but small data store specialized for inlined data via OPTION tags
  3783. //
  3784. // description:
  3785. // Provides a store for inlined data like:
  3786. //
  3787. // | <datalist>
  3788. // | <option value="AL">Alabama</option>
  3789. // | ...
  3790. constructor: function(/*Object?*/ params, /*DomNode|String*/ srcNodeRef){
  3791. // store pointer to original DOM tree
  3792. this.domNode = dom.byId(srcNodeRef);
  3793. lang.mixin(this, params);
  3794. if(this.id){
  3795. registry.add(this); // add to registry so it can be easily found by id
  3796. }
  3797. this.domNode.style.display = "none";
  3798. this.inherited(arguments, [{
  3799. data: query("option", this.domNode).map(toItem)
  3800. }]);
  3801. },
  3802. destroy: function(){
  3803. registry.remove(this.id);
  3804. },
  3805. fetchSelectedItem: function(){
  3806. // summary:
  3807. // Get the option marked as selected, like `<option selected>`.
  3808. // Not part of dojo.data API.
  3809. var option = query("> option[selected]", this.domNode)[0] || query("> option", this.domNode)[0];
  3810. return option && toItem(option);
  3811. }
  3812. });
  3813. });
  3814. },
  3815. 'url:dijit/templates/Dialog.html':"<div class=\"dijitDialog\" role=\"dialog\" aria-labelledby=\"${id}_title\">\n\t<div data-dojo-attach-point=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span data-dojo-attach-point=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\"></span>\n\t<span data-dojo-attach-point=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" data-dojo-attach-event=\"ondijitclick: onCancel\" title=\"${buttonCancel}\" role=\"button\" tabIndex=\"0\">\n\t\t<span data-dojo-attach-point=\"closeText\" class=\"closeText\" title=\"${buttonCancel}\">x</span>\n\t</span>\n\t</div>\n\t\t<div data-dojo-attach-point=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n",
  3816. 'dijit/form/CheckBox':function(){
  3817. require({cache:{
  3818. 'url:dijit/form/templates/CheckBox.html':"<div class=\"dijit dijitReset dijitInline\" role=\"presentation\"\n\t><input\n\t \t${!nameAttrSetting} type=\"${type}\" ${checkedAttrSetting}\n\t\tclass=\"dijitReset dijitCheckBoxInput\"\n\t\tdata-dojo-attach-point=\"focusNode\"\n\t \tdata-dojo-attach-event=\"onclick:_onClick\"\n/></div>\n"}});
  3819. define("dijit/form/CheckBox", [
  3820. "require",
  3821. "dojo/_base/declare", // declare
  3822. "dojo/dom-attr", // domAttr.set
  3823. "dojo/_base/kernel",
  3824. "dojo/query", // query
  3825. "dojo/ready",
  3826. "./ToggleButton",
  3827. "./_CheckBoxMixin",
  3828. "dojo/text!./templates/CheckBox.html",
  3829. "dojo/NodeList-dom" // NodeList.addClass/removeClass
  3830. ], function(require, declare, domAttr, kernel, query, ready, ToggleButton, _CheckBoxMixin, template){
  3831. /*=====
  3832. var ToggleButton = dijit.form.ToggleButton;
  3833. var _CheckBoxMixin = dijit.form._CheckBoxMixin;
  3834. =====*/
  3835. // module:
  3836. // dijit/form/CheckBox
  3837. // summary:
  3838. // Checkbox widget
  3839. // Back compat w/1.6, remove for 2.0
  3840. if(!kernel.isAsync){
  3841. ready(0, function(){
  3842. var requires = ["dijit/form/RadioButton"];
  3843. require(requires); // use indirection so modules not rolled into a build
  3844. });
  3845. }
  3846. return declare("dijit.form.CheckBox", [ToggleButton, _CheckBoxMixin], {
  3847. // summary:
  3848. // Same as an HTML checkbox, but with fancy styling.
  3849. //
  3850. // description:
  3851. // User interacts with real html inputs.
  3852. // On onclick (which occurs by mouse click, space-bar, or
  3853. // using the arrow keys to switch the selected radio button),
  3854. // we update the state of the checkbox/radio.
  3855. //
  3856. // There are two modes:
  3857. // 1. High contrast mode
  3858. // 2. Normal mode
  3859. //
  3860. // In case 1, the regular html inputs are shown and used by the user.
  3861. // In case 2, the regular html inputs are invisible but still used by
  3862. // the user. They are turned quasi-invisible and overlay the background-image.
  3863. templateString: template,
  3864. baseClass: "dijitCheckBox",
  3865. _setValueAttr: function(/*String|Boolean*/ newValue, /*Boolean*/ priorityChange){
  3866. // summary:
  3867. // Handler for value= attribute to constructor, and also calls to
  3868. // set('value', val).
  3869. // description:
  3870. // During initialization, just saves as attribute to the <input type=checkbox>.
  3871. //
  3872. // After initialization,
  3873. // when passed a boolean, controls whether or not the CheckBox is checked.
  3874. // If passed a string, changes the value attribute of the CheckBox (the one
  3875. // specified as "value" when the CheckBox was constructed (ex: <input
  3876. // data-dojo-type="dijit.CheckBox" value="chicken">)
  3877. // widget.set('value', string) will check the checkbox and change the value to the
  3878. // specified string
  3879. // widget.set('value', boolean) will change the checked state.
  3880. if(typeof newValue == "string"){
  3881. this._set("value", newValue);
  3882. domAttr.set(this.focusNode, 'value', newValue);
  3883. newValue = true;
  3884. }
  3885. if(this._created){
  3886. this.set('checked', newValue, priorityChange);
  3887. }
  3888. },
  3889. _getValueAttr: function(){
  3890. // summary:
  3891. // Hook so get('value') works.
  3892. // description:
  3893. // If the CheckBox is checked, returns the value attribute.
  3894. // Otherwise returns false.
  3895. return (this.checked ? this.value : false);
  3896. },
  3897. // Override behavior from Button, since we don't have an iconNode
  3898. _setIconClassAttr: null,
  3899. postMixInProperties: function(){
  3900. this.inherited(arguments);
  3901. // Need to set initial checked state as part of template, so that form submit works.
  3902. // domAttr.set(node, "checked", bool) doesn't work on IE until node has been attached
  3903. // to <body>, see #8666
  3904. this.checkedAttrSetting = this.checked ? "checked" : "";
  3905. },
  3906. _fillContent: function(){
  3907. // Override Button::_fillContent() since it doesn't make sense for CheckBox,
  3908. // since CheckBox doesn't even have a container
  3909. },
  3910. _onFocus: function(){
  3911. if(this.id){
  3912. query("label[for='"+this.id+"']").addClass("dijitFocusedLabel");
  3913. }
  3914. this.inherited(arguments);
  3915. },
  3916. _onBlur: function(){
  3917. if(this.id){
  3918. query("label[for='"+this.id+"']").removeClass("dijitFocusedLabel");
  3919. }
  3920. this.inherited(arguments);
  3921. }
  3922. });
  3923. });
  3924. },
  3925. 'dijit/_PaletteMixin':function(){
  3926. define("dijit/_PaletteMixin", [
  3927. "dojo/_base/declare", // declare
  3928. "dojo/dom-attr", // domAttr.set
  3929. "dojo/dom-class", // domClass.add domClass.remove
  3930. "dojo/dom-construct", // domConstruct.create domConstruct.place
  3931. "dojo/_base/event", // event.stop
  3932. "dojo/keys", // keys
  3933. "dojo/_base/lang", // lang.getObject
  3934. "./_CssStateMixin",
  3935. "./focus",
  3936. "./typematic"
  3937. ], function(declare, domAttr, domClass, domConstruct, event, keys, lang, _CssStateMixin, focus, typematic){
  3938. /*=====
  3939. var _CssStateMixin = dijit._CssStateMixin;
  3940. =====*/
  3941. // module:
  3942. // dijit/_PaletteMixin
  3943. // summary:
  3944. // A keyboard accessible palette, for picking a color/emoticon/etc.
  3945. return declare("dijit._PaletteMixin", [_CssStateMixin], {
  3946. // summary:
  3947. // A keyboard accessible palette, for picking a color/emoticon/etc.
  3948. // description:
  3949. // A mixin for a grid showing various entities, so the user can pick a certain entity.
  3950. // defaultTimeout: Number
  3951. // Number of milliseconds before a held key or button becomes typematic
  3952. defaultTimeout: 500,
  3953. // timeoutChangeRate: Number
  3954. // Fraction of time used to change the typematic timer between events
  3955. // 1.0 means that each typematic event fires at defaultTimeout intervals
  3956. // < 1.0 means that each typematic event fires at an increasing faster rate
  3957. timeoutChangeRate: 0.90,
  3958. // value: String
  3959. // Currently selected color/emoticon/etc.
  3960. value: "",
  3961. // _selectedCell: [private] Integer
  3962. // Index of the currently selected cell. Initially, none selected
  3963. _selectedCell: -1,
  3964. /*=====
  3965. // _currentFocus: [private] DomNode
  3966. // The currently focused cell (if the palette itself has focus), or otherwise
  3967. // the cell to be focused when the palette itself gets focus.
  3968. // Different from value, which represents the selected (i.e. clicked) cell.
  3969. _currentFocus: null,
  3970. =====*/
  3971. /*=====
  3972. // _xDim: [protected] Integer
  3973. // This is the number of cells horizontally across.
  3974. _xDim: null,
  3975. =====*/
  3976. /*=====
  3977. // _yDim: [protected] Integer
  3978. // This is the number of cells vertically down.
  3979. _yDim: null,
  3980. =====*/
  3981. // tabIndex: String
  3982. // Widget tab index.
  3983. tabIndex: "0",
  3984. // cellClass: [protected] String
  3985. // CSS class applied to each cell in the palette
  3986. cellClass: "dijitPaletteCell",
  3987. // dyeClass: [protected] String
  3988. // Name of javascript class for Object created for each cell of the palette.
  3989. // dyeClass should implements dijit.Dye interface
  3990. dyeClass: '',
  3991. // summary: String
  3992. // Localized summary for the palette table
  3993. summary: '',
  3994. _setSummaryAttr: "paletteTableNode",
  3995. _dyeFactory: function(value /*===== , row, col =====*/){
  3996. // summary:
  3997. // Return instance of dijit.Dye for specified cell of palette
  3998. // tags:
  3999. // extension
  4000. var dyeClassObj = lang.getObject(this.dyeClass);
  4001. return new dyeClassObj(value);
  4002. },
  4003. _preparePalette: function(choices, titles) {
  4004. // summary:
  4005. // Subclass must call _preparePalette() from postCreate(), passing in the tooltip
  4006. // for each cell
  4007. // choices: String[][]
  4008. // id's for each cell of the palette, used to create Dye JS object for each cell
  4009. // titles: String[]
  4010. // Localized tooltip for each cell
  4011. this._cells = [];
  4012. var url = this._blankGif;
  4013. this.connect(this.gridNode, "ondijitclick", "_onCellClick");
  4014. for(var row=0; row < choices.length; row++){
  4015. var rowNode = domConstruct.create("tr", {tabIndex: "-1"}, this.gridNode);
  4016. for(var col=0; col < choices[row].length; col++){
  4017. var value = choices[row][col];
  4018. if(value){
  4019. var cellObject = this._dyeFactory(value, row, col);
  4020. var cellNode = domConstruct.create("td", {
  4021. "class": this.cellClass,
  4022. tabIndex: "-1",
  4023. title: titles[value],
  4024. role: "gridcell"
  4025. });
  4026. // prepare cell inner structure
  4027. cellObject.fillCell(cellNode, url);
  4028. domConstruct.place(cellNode, rowNode);
  4029. cellNode.index = this._cells.length;
  4030. // save cell info into _cells
  4031. this._cells.push({node:cellNode, dye:cellObject});
  4032. }
  4033. }
  4034. }
  4035. this._xDim = choices[0].length;
  4036. this._yDim = choices.length;
  4037. // Now set all events
  4038. // The palette itself is navigated to with the tab key on the keyboard
  4039. // Keyboard navigation within the Palette is with the arrow keys
  4040. // Spacebar selects the cell.
  4041. // For the up key the index is changed by negative the x dimension.
  4042. var keyIncrementMap = {
  4043. UP_ARROW: -this._xDim,
  4044. // The down key the index is increase by the x dimension.
  4045. DOWN_ARROW: this._xDim,
  4046. // Right and left move the index by 1.
  4047. RIGHT_ARROW: this.isLeftToRight() ? 1 : -1,
  4048. LEFT_ARROW: this.isLeftToRight() ? -1 : 1
  4049. };
  4050. for(var key in keyIncrementMap){
  4051. this._connects.push(
  4052. typematic.addKeyListener(
  4053. this.domNode,
  4054. {charOrCode:keys[key], ctrlKey:false, altKey:false, shiftKey:false},
  4055. this,
  4056. function(){
  4057. var increment = keyIncrementMap[key];
  4058. return function(count){ this._navigateByKey(increment, count); };
  4059. }(),
  4060. this.timeoutChangeRate,
  4061. this.defaultTimeout
  4062. )
  4063. );
  4064. }
  4065. },
  4066. postCreate: function(){
  4067. this.inherited(arguments);
  4068. // Set initial navigable node.
  4069. this._setCurrent(this._cells[0].node);
  4070. },
  4071. focus: function(){
  4072. // summary:
  4073. // Focus this widget. Puts focus on the most recently focused cell.
  4074. // The cell already has tabIndex set, just need to set CSS and focus it
  4075. focus.focus(this._currentFocus);
  4076. },
  4077. _onCellClick: function(/*Event*/ evt){
  4078. // summary:
  4079. // Handler for click, enter key & space key. Selects the cell.
  4080. // evt:
  4081. // The event.
  4082. // tags:
  4083. // private
  4084. var target = evt.target;
  4085. // Find TD associated with click event. For ColorPalette user likely clicked IMG inside of TD
  4086. while(target.tagName != "TD"){
  4087. if(!target.parentNode || target == this.gridNode){ // probably can never happen, but just in case
  4088. return;
  4089. }
  4090. target = target.parentNode;
  4091. }
  4092. var value = this._getDye(target).getValue();
  4093. // First focus the clicked cell, and then send onChange() notification.
  4094. // onChange() (via _setValueAttr) must be after the focus call, because
  4095. // it may trigger a refocus to somewhere else (like the Editor content area), and that
  4096. // second focus should win.
  4097. this._setCurrent(target);
  4098. focus.focus(target);
  4099. this._setValueAttr(value, true);
  4100. event.stop(evt);
  4101. },
  4102. _setCurrent: function(/*DomNode*/ node){
  4103. // summary:
  4104. // Sets which node is the focused cell.
  4105. // description:
  4106. // At any point in time there's exactly one
  4107. // cell with tabIndex != -1. If focus is inside the palette then
  4108. // focus is on that cell.
  4109. //
  4110. // After calling this method, arrow key handlers and mouse click handlers
  4111. // should focus the cell in a setTimeout().
  4112. // tags:
  4113. // protected
  4114. if("_currentFocus" in this){
  4115. // Remove tabIndex on old cell
  4116. domAttr.set(this._currentFocus, "tabIndex", "-1");
  4117. }
  4118. // Set tabIndex of new cell
  4119. this._currentFocus = node;
  4120. if(node){
  4121. domAttr.set(node, "tabIndex", this.tabIndex);
  4122. }
  4123. },
  4124. _setValueAttr: function(value, priorityChange){
  4125. // summary:
  4126. // This selects a cell. It triggers the onChange event.
  4127. // value: String value of the cell to select
  4128. // tags:
  4129. // protected
  4130. // priorityChange:
  4131. // Optional parameter used to tell the select whether or not to fire
  4132. // onChange event.
  4133. // clear old selected cell
  4134. if(this._selectedCell >= 0){
  4135. domClass.remove(this._cells[this._selectedCell].node, this.cellClass + "Selected");
  4136. }
  4137. this._selectedCell = -1;
  4138. // search for cell matching specified value
  4139. if(value){
  4140. for(var i = 0; i < this._cells.length; i++){
  4141. if(value == this._cells[i].dye.getValue()){
  4142. this._selectedCell = i;
  4143. domClass.add(this._cells[i].node, this.cellClass + "Selected");
  4144. break;
  4145. }
  4146. }
  4147. }
  4148. // record new value, or null if no matching cell
  4149. this._set("value", this._selectedCell >= 0 ? value : null);
  4150. if(priorityChange || priorityChange === undefined){
  4151. this.onChange(value);
  4152. }
  4153. },
  4154. onChange: function(/*===== value =====*/){
  4155. // summary:
  4156. // Callback when a cell is selected.
  4157. // value: String
  4158. // Value corresponding to cell.
  4159. },
  4160. _navigateByKey: function(increment, typeCount){
  4161. // summary:
  4162. // This is the callback for typematic.
  4163. // It changes the focus and the highlighed cell.
  4164. // increment:
  4165. // How much the key is navigated.
  4166. // typeCount:
  4167. // How many times typematic has fired.
  4168. // tags:
  4169. // private
  4170. // typecount == -1 means the key is released.
  4171. if(typeCount == -1){ return; }
  4172. var newFocusIndex = this._currentFocus.index + increment;
  4173. if(newFocusIndex < this._cells.length && newFocusIndex > -1){
  4174. var focusNode = this._cells[newFocusIndex].node;
  4175. this._setCurrent(focusNode);
  4176. // Actually focus the node, for the benefit of screen readers.
  4177. // Use setTimeout because IE doesn't like changing focus inside of an event handler
  4178. setTimeout(lang.hitch(dijit, "focus", focusNode), 0);
  4179. }
  4180. },
  4181. _getDye: function(/*DomNode*/ cell){
  4182. // summary:
  4183. // Get JS object for given cell DOMNode
  4184. return this._cells[cell.index].dye;
  4185. }
  4186. });
  4187. /*=====
  4188. declare("dijit.Dye",
  4189. null,
  4190. {
  4191. // summary:
  4192. // Interface for the JS Object associated with a palette cell (i.e. DOMNode)
  4193. constructor: function(alias, row, col){
  4194. // summary:
  4195. // Initialize according to value or alias like "white"
  4196. // alias: String
  4197. },
  4198. getValue: function(){
  4199. // summary:
  4200. // Return "value" of cell; meaning of "value" varies by subclass.
  4201. // description:
  4202. // For example color hex value, emoticon ascii value etc, entity hex value.
  4203. },
  4204. fillCell: function(cell, blankGif){
  4205. // summary:
  4206. // Add cell DOMNode inner structure
  4207. // cell: DomNode
  4208. // The surrounding cell
  4209. // blankGif: String
  4210. // URL for blank cell image
  4211. }
  4212. }
  4213. );
  4214. =====*/
  4215. });
  4216. },
  4217. 'url:dijit/templates/TitlePane.html':"<div>\n\t<div data-dojo-attach-event=\"onclick:_onTitleClick, onkeydown:_onTitleKey\"\n\t\t\tclass=\"dijitTitlePaneTitle\" data-dojo-attach-point=\"titleBarNode\">\n\t\t<div class=\"dijitTitlePaneTitleFocus\" data-dojo-attach-point=\"focusNode\">\n\t\t\t<img src=\"${_blankGif}\" alt=\"\" data-dojo-attach-point=\"arrowNode\" class=\"dijitArrowNode\" role=\"presentation\"\n\t\t\t/><span data-dojo-attach-point=\"arrowNodeInner\" class=\"dijitArrowNodeInner\"></span\n\t\t\t><span data-dojo-attach-point=\"titleNode\" class=\"dijitTitlePaneTextNode\"></span>\n\t\t</div>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\" data-dojo-attach-point=\"hideNode\" role=\"presentation\">\n\t\t<div class=\"dijitReset\" data-dojo-attach-point=\"wipeNode\" role=\"presentation\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" data-dojo-attach-point=\"containerNode\" role=\"region\" id=\"${id}_pane\">\n\t\t\t\t<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n",
  4218. 'dijit/form/ValidationTextBox':function(){
  4219. require({cache:{
  4220. 'url:dijit/form/templates/ValidationTextBox.html':"<div class=\"dijit dijitReset dijitInline dijitLeft\"\n\tid=\"widget_${id}\" role=\"presentation\"\n\t><div class='dijitReset dijitValidationContainer'\n\t\t><input class=\"dijitReset dijitInputField dijitValidationIcon dijitValidationInner\" value=\"&#935; \" type=\"text\" tabIndex=\"-1\" readonly=\"readonly\" role=\"presentation\"\n\t/></div\n\t><div class=\"dijitReset dijitInputField dijitInputContainer\"\n\t\t><input class=\"dijitReset dijitInputInner\" data-dojo-attach-point='textbox,focusNode' autocomplete=\"off\"\n\t\t\t${!nameAttrSetting} type='${type}'\n\t/></div\n></div>\n"}});
  4221. define("dijit/form/ValidationTextBox", [
  4222. "dojo/_base/declare", // declare
  4223. "dojo/i18n", // i18n.getLocalization
  4224. "./TextBox",
  4225. "../Tooltip",
  4226. "dojo/text!./templates/ValidationTextBox.html",
  4227. "dojo/i18n!./nls/validate"
  4228. ], function(declare, i18n, TextBox, Tooltip, template){
  4229. /*=====
  4230. var Tooltip = dijit.Tooltip;
  4231. var TextBox = dijit.form.TextBox;
  4232. =====*/
  4233. // module:
  4234. // dijit/form/ValidationTextBox
  4235. // summary:
  4236. // Base class for textbox widgets with the ability to validate content of various types and provide user feedback.
  4237. /*=====
  4238. dijit.form.ValidationTextBox.__Constraints = function(){
  4239. // locale: String
  4240. // locale used for validation, picks up value from this widget's lang attribute
  4241. // _flags_: anything
  4242. // various flags passed to regExpGen function
  4243. this.locale = "";
  4244. this._flags_ = "";
  4245. }
  4246. =====*/
  4247. return declare("dijit.form.ValidationTextBox", TextBox, {
  4248. // summary:
  4249. // Base class for textbox widgets with the ability to validate content of various types and provide user feedback.
  4250. // tags:
  4251. // protected
  4252. templateString: template,
  4253. baseClass: "dijitTextBox dijitValidationTextBox",
  4254. // required: Boolean
  4255. // User is required to enter data into this field.
  4256. required: false,
  4257. // promptMessage: String
  4258. // If defined, display this hint string immediately on focus to the textbox, if empty.
  4259. // Also displays if the textbox value is Incomplete (not yet valid but will be with additional input).
  4260. // Think of this like a tooltip that tells the user what to do, not an error message
  4261. // that tells the user what they've done wrong.
  4262. //
  4263. // Message disappears when user starts typing.
  4264. promptMessage: "",
  4265. // invalidMessage: String
  4266. // The message to display if value is invalid.
  4267. // The translated string value is read from the message file by default.
  4268. // Set to "" to use the promptMessage instead.
  4269. invalidMessage: "$_unset_$",
  4270. // missingMessage: String
  4271. // The message to display if value is empty and the field is required.
  4272. // The translated string value is read from the message file by default.
  4273. // Set to "" to use the invalidMessage instead.
  4274. missingMessage: "$_unset_$",
  4275. // message: String
  4276. // Currently error/prompt message.
  4277. // When using the default tooltip implementation, this will only be
  4278. // displayed when the field is focused.
  4279. message: "",
  4280. // constraints: dijit.form.ValidationTextBox.__Constraints
  4281. // user-defined object needed to pass parameters to the validator functions
  4282. constraints: {},
  4283. // regExp: [extension protected] String
  4284. // regular expression string used to validate the input
  4285. // Do not specify both regExp and regExpGen
  4286. regExp: ".*",
  4287. regExpGen: function(/*dijit.form.ValidationTextBox.__Constraints*/ /*===== constraints =====*/){
  4288. // summary:
  4289. // Overridable function used to generate regExp when dependent on constraints.
  4290. // Do not specify both regExp and regExpGen.
  4291. // tags:
  4292. // extension protected
  4293. return this.regExp; // String
  4294. },
  4295. // state: [readonly] String
  4296. // Shows current state (ie, validation result) of input (""=Normal, Incomplete, or Error)
  4297. state: "",
  4298. // tooltipPosition: String[]
  4299. // See description of `dijit.Tooltip.defaultPosition` for details on this parameter.
  4300. tooltipPosition: [],
  4301. _setValueAttr: function(){
  4302. // summary:
  4303. // Hook so set('value', ...) works.
  4304. this.inherited(arguments);
  4305. this.validate(this.focused);
  4306. },
  4307. validator: function(/*anything*/ value, /*dijit.form.ValidationTextBox.__Constraints*/ constraints){
  4308. // summary:
  4309. // Overridable function used to validate the text input against the regular expression.
  4310. // tags:
  4311. // protected
  4312. return (new RegExp("^(?:" + this.regExpGen(constraints) + ")"+(this.required?"":"?")+"$")).test(value) &&
  4313. (!this.required || !this._isEmpty(value)) &&
  4314. (this._isEmpty(value) || this.parse(value, constraints) !== undefined); // Boolean
  4315. },
  4316. _isValidSubset: function(){
  4317. // summary:
  4318. // Returns true if the value is either already valid or could be made valid by appending characters.
  4319. // This is used for validation while the user [may be] still typing.
  4320. return this.textbox.value.search(this._partialre) == 0;
  4321. },
  4322. isValid: function(/*Boolean*/ /*===== isFocused =====*/){
  4323. // summary:
  4324. // Tests if value is valid.
  4325. // Can override with your own routine in a subclass.
  4326. // tags:
  4327. // protected
  4328. return this.validator(this.textbox.value, this.constraints);
  4329. },
  4330. _isEmpty: function(value){
  4331. // summary:
  4332. // Checks for whitespace
  4333. return (this.trim ? /^\s*$/ : /^$/).test(value); // Boolean
  4334. },
  4335. getErrorMessage: function(/*Boolean*/ /*===== isFocused =====*/){
  4336. // summary:
  4337. // Return an error message to show if appropriate
  4338. // tags:
  4339. // protected
  4340. return (this.required && this._isEmpty(this.textbox.value)) ? this.missingMessage : this.invalidMessage; // String
  4341. },
  4342. getPromptMessage: function(/*Boolean*/ /*===== isFocused =====*/){
  4343. // summary:
  4344. // Return a hint message to show when widget is first focused
  4345. // tags:
  4346. // protected
  4347. return this.promptMessage; // String
  4348. },
  4349. _maskValidSubsetError: true,
  4350. validate: function(/*Boolean*/ isFocused){
  4351. // summary:
  4352. // Called by oninit, onblur, and onkeypress.
  4353. // description:
  4354. // Show missing or invalid messages if appropriate, and highlight textbox field.
  4355. // tags:
  4356. // protected
  4357. var message = "";
  4358. var isValid = this.disabled || this.isValid(isFocused);
  4359. if(isValid){ this._maskValidSubsetError = true; }
  4360. var isEmpty = this._isEmpty(this.textbox.value);
  4361. var isValidSubset = !isValid && isFocused && this._isValidSubset();
  4362. this._set("state", isValid ? "" : (((((!this._hasBeenBlurred || isFocused) && isEmpty) || isValidSubset) && this._maskValidSubsetError) ? "Incomplete" : "Error"));
  4363. this.focusNode.setAttribute("aria-invalid", isValid ? "false" : "true");
  4364. if(this.state == "Error"){
  4365. this._maskValidSubsetError = isFocused && isValidSubset; // we want the error to show up after a blur and refocus
  4366. message = this.getErrorMessage(isFocused);
  4367. }else if(this.state == "Incomplete"){
  4368. message = this.getPromptMessage(isFocused); // show the prompt whenever the value is not yet complete
  4369. this._maskValidSubsetError = !this._hasBeenBlurred || isFocused; // no Incomplete warnings while focused
  4370. }else if(isEmpty){
  4371. message = this.getPromptMessage(isFocused); // show the prompt whenever there's no error and no text
  4372. }
  4373. this.set("message", message);
  4374. return isValid;
  4375. },
  4376. displayMessage: function(/*String*/ message){
  4377. // summary:
  4378. // Overridable method to display validation errors/hints.
  4379. // By default uses a tooltip.
  4380. // tags:
  4381. // extension
  4382. if(message && this.focused){
  4383. Tooltip.show(message, this.domNode, this.tooltipPosition, !this.isLeftToRight());
  4384. }else{
  4385. Tooltip.hide(this.domNode);
  4386. }
  4387. },
  4388. _refreshState: function(){
  4389. // Overrides TextBox._refreshState()
  4390. this.validate(this.focused);
  4391. this.inherited(arguments);
  4392. },
  4393. //////////// INITIALIZATION METHODS ///////////////////////////////////////
  4394. constructor: function(){
  4395. this.constraints = {};
  4396. },
  4397. _setConstraintsAttr: function(/*Object*/ constraints){
  4398. if(!constraints.locale && this.lang){
  4399. constraints.locale = this.lang;
  4400. }
  4401. this._set("constraints", constraints);
  4402. this._computePartialRE();
  4403. },
  4404. _computePartialRE: function(){
  4405. var p = this.regExpGen(this.constraints);
  4406. this.regExp = p;
  4407. var partialre = "";
  4408. // parse the regexp and produce a new regexp that matches valid subsets
  4409. // if the regexp is .* then there's no use in matching subsets since everything is valid
  4410. if(p != ".*"){ this.regExp.replace(/\\.|\[\]|\[.*?[^\\]{1}\]|\{.*?\}|\(\?[=:!]|./g,
  4411. function(re){
  4412. switch(re.charAt(0)){
  4413. case '{':
  4414. case '+':
  4415. case '?':
  4416. case '*':
  4417. case '^':
  4418. case '$':
  4419. case '|':
  4420. case '(':
  4421. partialre += re;
  4422. break;
  4423. case ")":
  4424. partialre += "|$)";
  4425. break;
  4426. default:
  4427. partialre += "(?:"+re+"|$)";
  4428. break;
  4429. }
  4430. }
  4431. );}
  4432. try{ // this is needed for now since the above regexp parsing needs more test verification
  4433. "".search(partialre);
  4434. }catch(e){ // should never be here unless the original RE is bad or the parsing is bad
  4435. partialre = this.regExp;
  4436. console.warn('RegExp error in ' + this.declaredClass + ': ' + this.regExp);
  4437. } // should never be here unless the original RE is bad or the parsing is bad
  4438. this._partialre = "^(?:" + partialre + ")$";
  4439. },
  4440. postMixInProperties: function(){
  4441. this.inherited(arguments);
  4442. this.messages = i18n.getLocalization("dijit.form", "validate", this.lang);
  4443. if(this.invalidMessage == "$_unset_$"){ this.invalidMessage = this.messages.invalidMessage; }
  4444. if(!this.invalidMessage){ this.invalidMessage = this.promptMessage; }
  4445. if(this.missingMessage == "$_unset_$"){ this.missingMessage = this.messages.missingMessage; }
  4446. if(!this.missingMessage){ this.missingMessage = this.invalidMessage; }
  4447. this._setConstraintsAttr(this.constraints); // this needs to happen now (and later) due to codependency on _set*Attr calls attachPoints
  4448. },
  4449. _setDisabledAttr: function(/*Boolean*/ value){
  4450. this.inherited(arguments); // call FormValueWidget._setDisabledAttr()
  4451. this._refreshState();
  4452. },
  4453. _setRequiredAttr: function(/*Boolean*/ value){
  4454. this._set("required", value);
  4455. this.focusNode.setAttribute("aria-required", value);
  4456. this._refreshState();
  4457. },
  4458. _setMessageAttr: function(/*String*/ message){
  4459. this._set("message", message);
  4460. this.displayMessage(message);
  4461. },
  4462. reset:function(){
  4463. // Overrides dijit.form.TextBox.reset() by also
  4464. // hiding errors about partial matches
  4465. this._maskValidSubsetError = true;
  4466. this.inherited(arguments);
  4467. },
  4468. _onBlur: function(){
  4469. // the message still exists but for back-compat, and to erase the tooltip
  4470. // (if the message is being displayed as a tooltip), call displayMessage('')
  4471. this.displayMessage('');
  4472. this.inherited(arguments);
  4473. }
  4474. });
  4475. });
  4476. },
  4477. 'dojo/data/util/filter':function(){
  4478. define("dojo/data/util/filter", ["../../_base/lang"], function(lang) {
  4479. // module:
  4480. // dojo/data/util/filter
  4481. // summary:
  4482. // TODOC
  4483. var filter = lang.getObject("dojo.data.util.filter", true);
  4484. filter.patternToRegExp = function(/*String*/pattern, /*boolean?*/ ignoreCase){
  4485. // summary:
  4486. // Helper function to convert a simple pattern to a regular expression for matching.
  4487. // description:
  4488. // Returns a regular expression object that conforms to the defined conversion rules.
  4489. // For example:
  4490. // ca* -> /^ca.*$/
  4491. // *ca* -> /^.*ca.*$/
  4492. // *c\*a* -> /^.*c\*a.*$/
  4493. // *c\*a?* -> /^.*c\*a..*$/
  4494. // and so on.
  4495. //
  4496. // pattern: string
  4497. // A simple matching pattern to convert that follows basic rules:
  4498. // * Means match anything, so ca* means match anything starting with ca
  4499. // ? Means match single character. So, b?b will match to bob and bab, and so on.
  4500. // \ is an escape character. So for example, \* means do not treat * as a match, but literal character *.
  4501. // To use a \ as a character in the string, it must be escaped. So in the pattern it should be
  4502. // represented by \\ to be treated as an ordinary \ character instead of an escape.
  4503. //
  4504. // ignoreCase:
  4505. // An optional flag to indicate if the pattern matching should be treated as case-sensitive or not when comparing
  4506. // By default, it is assumed case sensitive.
  4507. var rxp = "^";
  4508. var c = null;
  4509. for(var i = 0; i < pattern.length; i++){
  4510. c = pattern.charAt(i);
  4511. switch(c){
  4512. case '\\':
  4513. rxp += c;
  4514. i++;
  4515. rxp += pattern.charAt(i);
  4516. break;
  4517. case '*':
  4518. rxp += ".*"; break;
  4519. case '?':
  4520. rxp += "."; break;
  4521. case '$':
  4522. case '^':
  4523. case '/':
  4524. case '+':
  4525. case '.':
  4526. case '|':
  4527. case '(':
  4528. case ')':
  4529. case '{':
  4530. case '}':
  4531. case '[':
  4532. case ']':
  4533. rxp += "\\"; //fallthrough
  4534. default:
  4535. rxp += c;
  4536. }
  4537. }
  4538. rxp += "$";
  4539. if(ignoreCase){
  4540. return new RegExp(rxp,"mi"); //RegExp
  4541. }else{
  4542. return new RegExp(rxp,"m"); //RegExp
  4543. }
  4544. };
  4545. return filter;
  4546. });
  4547. },
  4548. 'dijit/form/FilteringSelect':function(){
  4549. define("dijit/form/FilteringSelect", [
  4550. "dojo/data/util/filter", // filter.patternToRegExp
  4551. "dojo/_base/declare", // declare
  4552. "dojo/_base/Deferred", // Deferred.when
  4553. "dojo/_base/lang", // lang.mixin
  4554. "./MappedTextBox",
  4555. "./ComboBoxMixin"
  4556. ], function(filter, declare, Deferred, lang, MappedTextBox, ComboBoxMixin){
  4557. /*=====
  4558. var MappedTextBox = dijit.form.MappedTextBox;
  4559. var ComboBoxMixin = dijit.form.ComboBoxMixin;
  4560. =====*/
  4561. // module:
  4562. // dijit/form/FilteringSelect
  4563. // summary:
  4564. // An enhanced version of the HTML SELECT tag, populated dynamically
  4565. return declare("dijit.form.FilteringSelect", [MappedTextBox, ComboBoxMixin], {
  4566. // summary:
  4567. // An enhanced version of the HTML SELECT tag, populated dynamically
  4568. //
  4569. // description:
  4570. // An enhanced version of the HTML SELECT tag, populated dynamically. It works
  4571. // very nicely with very large data sets because it can load and page data as needed.
  4572. // It also resembles ComboBox, but does not allow values outside of the provided ones.
  4573. // If OPTION tags are used as the data provider via markup, then the
  4574. // OPTION tag's child text node is used as the displayed value when selected
  4575. // while the OPTION tag's value attribute is used as the widget value on form submit.
  4576. // To set the default value when using OPTION tags, specify the selected
  4577. // attribute on 1 of the child OPTION tags.
  4578. //
  4579. // Similar features:
  4580. // - There is a drop down list of possible values.
  4581. // - You can only enter a value from the drop down list. (You can't
  4582. // enter an arbitrary value.)
  4583. // - The value submitted with the form is the hidden value (ex: CA),
  4584. // not the displayed value a.k.a. label (ex: California)
  4585. //
  4586. // Enhancements over plain HTML version:
  4587. // - If you type in some text then it will filter down the list of
  4588. // possible values in the drop down list.
  4589. // - List can be specified either as a static list or via a javascript
  4590. // function (that can get the list from a server)
  4591. // required: Boolean
  4592. // True (default) if user is required to enter a value into this field.
  4593. required: true,
  4594. _lastDisplayedValue: "",
  4595. _isValidSubset: function(){
  4596. return this._opened;
  4597. },
  4598. isValid: function(){
  4599. // Overrides ValidationTextBox.isValid()
  4600. return !!this.item || (!this.required && this.get('displayedValue') == ""); // #5974
  4601. },
  4602. _refreshState: function(){
  4603. if(!this.searchTimer){ // state will be refreshed after results are returned
  4604. this.inherited(arguments);
  4605. }
  4606. },
  4607. _callbackSetLabel: function(
  4608. /*Array*/ result,
  4609. /*Object*/ query,
  4610. /*Object*/ options,
  4611. /*Boolean?*/ priorityChange){
  4612. // summary:
  4613. // Callback from dojo.store after lookup of user entered value finishes
  4614. // setValue does a synchronous lookup,
  4615. // so it calls _callbackSetLabel directly,
  4616. // and so does not pass dataObject
  4617. // still need to test against _lastQuery in case it came too late
  4618. if((query && query[this.searchAttr] !== this._lastQuery) || (!query && result.length && this.store.getIdentity(result[0]) != this._lastQuery)){
  4619. return;
  4620. }
  4621. if(!result.length){
  4622. //#3268: don't modify display value on bad input
  4623. //#3285: change CSS to indicate error
  4624. this.set("value", '', priorityChange || (priorityChange === undefined && !this.focused), this.textbox.value, null);
  4625. }else{
  4626. this.set('item', result[0], priorityChange);
  4627. }
  4628. },
  4629. _openResultList: function(/*Object*/ results, /*Object*/ query, /*Object*/ options){
  4630. // Callback when a data store query completes.
  4631. // Overrides ComboBox._openResultList()
  4632. // #3285: tap into search callback to see if user's query resembles a match
  4633. if(query[this.searchAttr] !== this._lastQuery){
  4634. return;
  4635. }
  4636. this.inherited(arguments);
  4637. if(this.item === undefined){ // item == undefined for keyboard search
  4638. // If the search returned no items that means that the user typed
  4639. // in something invalid (and they can't make it valid by typing more characters),
  4640. // so flag the FilteringSelect as being in an invalid state
  4641. this.validate(true);
  4642. }
  4643. },
  4644. _getValueAttr: function(){
  4645. // summary:
  4646. // Hook for get('value') to work.
  4647. // don't get the textbox value but rather the previously set hidden value.
  4648. // Use this.valueNode.value which isn't always set for other MappedTextBox widgets until blur
  4649. return this.valueNode.value;
  4650. },
  4651. _getValueField: function(){
  4652. // Overrides ComboBox._getValueField()
  4653. return "value";
  4654. },
  4655. _setValueAttr: function(/*String*/ value, /*Boolean?*/ priorityChange, /*String?*/ displayedValue, /*item?*/ item){
  4656. // summary:
  4657. // Hook so set('value', value) works.
  4658. // description:
  4659. // Sets the value of the select.
  4660. // Also sets the label to the corresponding value by reverse lookup.
  4661. if(!this._onChangeActive){ priorityChange = null; }
  4662. if(item === undefined){
  4663. if(value === null || value === ''){
  4664. value = '';
  4665. if(!lang.isString(displayedValue)){
  4666. this._setDisplayedValueAttr(displayedValue||'', priorityChange);
  4667. return;
  4668. }
  4669. }
  4670. var self = this;
  4671. this._lastQuery = value;
  4672. Deferred.when(this.store.get(value), function(item){
  4673. self._callbackSetLabel(item? [item] : [], undefined, undefined, priorityChange);
  4674. });
  4675. }else{
  4676. this.valueNode.value = value;
  4677. this.inherited(arguments);
  4678. }
  4679. },
  4680. _setItemAttr: function(/*item*/ item, /*Boolean?*/ priorityChange, /*String?*/ displayedValue){
  4681. // summary:
  4682. // Set the displayed valued in the input box, and the hidden value
  4683. // that gets submitted, based on a dojo.data store item.
  4684. // description:
  4685. // Users shouldn't call this function; they should be calling
  4686. // set('item', value)
  4687. // tags:
  4688. // private
  4689. this.inherited(arguments);
  4690. this._lastDisplayedValue = this.textbox.value;
  4691. },
  4692. _getDisplayQueryString: function(/*String*/ text){
  4693. return text.replace(/([\\\*\?])/g, "\\$1");
  4694. },
  4695. _setDisplayedValueAttr: function(/*String*/ label, /*Boolean?*/ priorityChange){
  4696. // summary:
  4697. // Hook so set('displayedValue', label) works.
  4698. // description:
  4699. // Sets textbox to display label. Also performs reverse lookup
  4700. // to set the hidden value. label should corresponding to item.searchAttr.
  4701. if(label == null){ label = ''; }
  4702. // This is called at initialization along with every custom setter.
  4703. // Usually (or always?) the call can be ignored. If it needs to be
  4704. // processed then at least make sure that the XHR request doesn't trigger an onChange()
  4705. // event, even if it returns after creation has finished
  4706. if(!this._created){
  4707. if(!("displayedValue" in this.params)){
  4708. return;
  4709. }
  4710. priorityChange = false;
  4711. }
  4712. // Do a reverse lookup to map the specified displayedValue to the hidden value.
  4713. // Note that if there's a custom labelFunc() this code
  4714. if(this.store){
  4715. this.closeDropDown();
  4716. var query = lang.clone(this.query); // #6196: populate query with user-specifics
  4717. // Generate query
  4718. var qs = this._getDisplayQueryString(label), q;
  4719. if(this.store._oldAPI){
  4720. // remove this branch for 2.0
  4721. q = qs;
  4722. }else{
  4723. // Query on searchAttr is a regex for benefit of dojo.store.Memory,
  4724. // but with a toString() method to help dojo.store.JsonRest.
  4725. // Search string like "Co*" converted to regex like /^Co.*$/i.
  4726. q = filter.patternToRegExp(qs, this.ignoreCase);
  4727. q.toString = function(){ return qs; };
  4728. }
  4729. this._lastQuery = query[this.searchAttr] = q;
  4730. // If the label is not valid, the callback will never set it,
  4731. // so the last valid value will get the warning textbox. Set the
  4732. // textbox value now so that the impending warning will make
  4733. // sense to the user
  4734. this.textbox.value = label;
  4735. this._lastDisplayedValue = label;
  4736. this._set("displayedValue", label); // for watch("displayedValue") notification
  4737. var _this = this;
  4738. var options = {
  4739. queryOptions: {
  4740. ignoreCase: this.ignoreCase,
  4741. deep: true
  4742. }
  4743. };
  4744. lang.mixin(options, this.fetchProperties);
  4745. this._fetchHandle = this.store.query(query, options);
  4746. Deferred.when(this._fetchHandle, function(result){
  4747. _this._fetchHandle = null;
  4748. _this._callbackSetLabel(result || [], query, options, priorityChange);
  4749. }, function(err){
  4750. _this._fetchHandle = null;
  4751. if(!_this._cancelingQuery){ // don't treat canceled query as an error
  4752. console.error('dijit.form.FilteringSelect: ' + err.toString());
  4753. }
  4754. });
  4755. }
  4756. },
  4757. undo: function(){
  4758. this.set('displayedValue', this._lastDisplayedValue);
  4759. }
  4760. });
  4761. });
  4762. },
  4763. 'dojo/colors':function(){
  4764. define("dojo/colors", ["./_base/kernel", "./_base/lang", "./_base/Color", "./_base/array"], function(dojo, lang, Color, ArrayUtil) {
  4765. // module:
  4766. // dojo/colors
  4767. // summary:
  4768. // TODOC
  4769. var ColorExt = lang.getObject("dojo.colors", true);
  4770. //TODO: this module appears to break naming conventions
  4771. /*=====
  4772. lang.mixin(dojo, {
  4773. colors: {
  4774. // summary: Color utilities, extending Base dojo.Color
  4775. }
  4776. });
  4777. =====*/
  4778. // this is a standard conversion prescribed by the CSS3 Color Module
  4779. var hue2rgb = function(m1, m2, h){
  4780. if(h < 0){ ++h; }
  4781. if(h > 1){ --h; }
  4782. var h6 = 6 * h;
  4783. if(h6 < 1){ return m1 + (m2 - m1) * h6; }
  4784. if(2 * h < 1){ return m2; }
  4785. if(3 * h < 2){ return m1 + (m2 - m1) * (2 / 3 - h) * 6; }
  4786. return m1;
  4787. };
  4788. // Override base Color.fromRgb with the impl in this module
  4789. dojo.colorFromRgb = Color.fromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
  4790. // summary:
  4791. // get rgb(a) array from css-style color declarations
  4792. // description:
  4793. // this function can handle all 4 CSS3 Color Module formats: rgb,
  4794. // rgba, hsl, hsla, including rgb(a) with percentage values.
  4795. var m = color.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);
  4796. if(m){
  4797. var c = m[2].split(/\s*,\s*/), l = c.length, t = m[1], a;
  4798. if((t == "rgb" && l == 3) || (t == "rgba" && l == 4)){
  4799. var r = c[0];
  4800. if(r.charAt(r.length - 1) == "%"){
  4801. // 3 rgb percentage values
  4802. a = ArrayUtil.map(c, function(x){
  4803. return parseFloat(x) * 2.56;
  4804. });
  4805. if(l == 4){ a[3] = c[3]; }
  4806. return Color.fromArray(a, obj); // dojo.Color
  4807. }
  4808. return Color.fromArray(c, obj); // dojo.Color
  4809. }
  4810. if((t == "hsl" && l == 3) || (t == "hsla" && l == 4)){
  4811. // normalize hsl values
  4812. var H = ((parseFloat(c[0]) % 360) + 360) % 360 / 360,
  4813. S = parseFloat(c[1]) / 100,
  4814. L = parseFloat(c[2]) / 100,
  4815. // calculate rgb according to the algorithm
  4816. // recommended by the CSS3 Color Module
  4817. m2 = L <= 0.5 ? L * (S + 1) : L + S - L * S,
  4818. m1 = 2 * L - m2;
  4819. a = [
  4820. hue2rgb(m1, m2, H + 1 / 3) * 256,
  4821. hue2rgb(m1, m2, H) * 256,
  4822. hue2rgb(m1, m2, H - 1 / 3) * 256,
  4823. 1
  4824. ];
  4825. if(l == 4){ a[3] = c[3]; }
  4826. return Color.fromArray(a, obj); // dojo.Color
  4827. }
  4828. }
  4829. return null; // dojo.Color
  4830. };
  4831. var confine = function(c, low, high){
  4832. // summary:
  4833. // sanitize a color component by making sure it is a number,
  4834. // and clamping it to valid values
  4835. c = Number(c);
  4836. return isNaN(c) ? high : c < low ? low : c > high ? high : c; // Number
  4837. };
  4838. Color.prototype.sanitize = function(){
  4839. // summary: makes sure that the object has correct attributes
  4840. var t = this;
  4841. t.r = Math.round(confine(t.r, 0, 255));
  4842. t.g = Math.round(confine(t.g, 0, 255));
  4843. t.b = Math.round(confine(t.b, 0, 255));
  4844. t.a = confine(t.a, 0, 1);
  4845. return this; // dojo.Color
  4846. };
  4847. ColorExt.makeGrey = Color.makeGrey = function(/*Number*/ g, /*Number?*/ a){
  4848. // summary: creates a greyscale color with an optional alpha
  4849. return Color.fromArray([g, g, g, a]); // dojo.Color
  4850. };
  4851. // mixin all CSS3 named colors not already in _base, along with SVG 1.0 variant spellings
  4852. lang.mixin(Color.named, {
  4853. "aliceblue": [240,248,255],
  4854. "antiquewhite": [250,235,215],
  4855. "aquamarine": [127,255,212],
  4856. "azure": [240,255,255],
  4857. "beige": [245,245,220],
  4858. "bisque": [255,228,196],
  4859. "blanchedalmond": [255,235,205],
  4860. "blueviolet": [138,43,226],
  4861. "brown": [165,42,42],
  4862. "burlywood": [222,184,135],
  4863. "cadetblue": [95,158,160],
  4864. "chartreuse": [127,255,0],
  4865. "chocolate": [210,105,30],
  4866. "coral": [255,127,80],
  4867. "cornflowerblue": [100,149,237],
  4868. "cornsilk": [255,248,220],
  4869. "crimson": [220,20,60],
  4870. "cyan": [0,255,255],
  4871. "darkblue": [0,0,139],
  4872. "darkcyan": [0,139,139],
  4873. "darkgoldenrod": [184,134,11],
  4874. "darkgray": [169,169,169],
  4875. "darkgreen": [0,100,0],
  4876. "darkgrey": [169,169,169],
  4877. "darkkhaki": [189,183,107],
  4878. "darkmagenta": [139,0,139],
  4879. "darkolivegreen": [85,107,47],
  4880. "darkorange": [255,140,0],
  4881. "darkorchid": [153,50,204],
  4882. "darkred": [139,0,0],
  4883. "darksalmon": [233,150,122],
  4884. "darkseagreen": [143,188,143],
  4885. "darkslateblue": [72,61,139],
  4886. "darkslategray": [47,79,79],
  4887. "darkslategrey": [47,79,79],
  4888. "darkturquoise": [0,206,209],
  4889. "darkviolet": [148,0,211],
  4890. "deeppink": [255,20,147],
  4891. "deepskyblue": [0,191,255],
  4892. "dimgray": [105,105,105],
  4893. "dimgrey": [105,105,105],
  4894. "dodgerblue": [30,144,255],
  4895. "firebrick": [178,34,34],
  4896. "floralwhite": [255,250,240],
  4897. "forestgreen": [34,139,34],
  4898. "gainsboro": [220,220,220],
  4899. "ghostwhite": [248,248,255],
  4900. "gold": [255,215,0],
  4901. "goldenrod": [218,165,32],
  4902. "greenyellow": [173,255,47],
  4903. "grey": [128,128,128],
  4904. "honeydew": [240,255,240],
  4905. "hotpink": [255,105,180],
  4906. "indianred": [205,92,92],
  4907. "indigo": [75,0,130],
  4908. "ivory": [255,255,240],
  4909. "khaki": [240,230,140],
  4910. "lavender": [230,230,250],
  4911. "lavenderblush": [255,240,245],
  4912. "lawngreen": [124,252,0],
  4913. "lemonchiffon": [255,250,205],
  4914. "lightblue": [173,216,230],
  4915. "lightcoral": [240,128,128],
  4916. "lightcyan": [224,255,255],
  4917. "lightgoldenrodyellow": [250,250,210],
  4918. "lightgray": [211,211,211],
  4919. "lightgreen": [144,238,144],
  4920. "lightgrey": [211,211,211],
  4921. "lightpink": [255,182,193],
  4922. "lightsalmon": [255,160,122],
  4923. "lightseagreen": [32,178,170],
  4924. "lightskyblue": [135,206,250],
  4925. "lightslategray": [119,136,153],
  4926. "lightslategrey": [119,136,153],
  4927. "lightsteelblue": [176,196,222],
  4928. "lightyellow": [255,255,224],
  4929. "limegreen": [50,205,50],
  4930. "linen": [250,240,230],
  4931. "magenta": [255,0,255],
  4932. "mediumaquamarine": [102,205,170],
  4933. "mediumblue": [0,0,205],
  4934. "mediumorchid": [186,85,211],
  4935. "mediumpurple": [147,112,219],
  4936. "mediumseagreen": [60,179,113],
  4937. "mediumslateblue": [123,104,238],
  4938. "mediumspringgreen": [0,250,154],
  4939. "mediumturquoise": [72,209,204],
  4940. "mediumvioletred": [199,21,133],
  4941. "midnightblue": [25,25,112],
  4942. "mintcream": [245,255,250],
  4943. "mistyrose": [255,228,225],
  4944. "moccasin": [255,228,181],
  4945. "navajowhite": [255,222,173],
  4946. "oldlace": [253,245,230],
  4947. "olivedrab": [107,142,35],
  4948. "orange": [255,165,0],
  4949. "orangered": [255,69,0],
  4950. "orchid": [218,112,214],
  4951. "palegoldenrod": [238,232,170],
  4952. "palegreen": [152,251,152],
  4953. "paleturquoise": [175,238,238],
  4954. "palevioletred": [219,112,147],
  4955. "papayawhip": [255,239,213],
  4956. "peachpuff": [255,218,185],
  4957. "peru": [205,133,63],
  4958. "pink": [255,192,203],
  4959. "plum": [221,160,221],
  4960. "powderblue": [176,224,230],
  4961. "rosybrown": [188,143,143],
  4962. "royalblue": [65,105,225],
  4963. "saddlebrown": [139,69,19],
  4964. "salmon": [250,128,114],
  4965. "sandybrown": [244,164,96],
  4966. "seagreen": [46,139,87],
  4967. "seashell": [255,245,238],
  4968. "sienna": [160,82,45],
  4969. "skyblue": [135,206,235],
  4970. "slateblue": [106,90,205],
  4971. "slategray": [112,128,144],
  4972. "slategrey": [112,128,144],
  4973. "snow": [255,250,250],
  4974. "springgreen": [0,255,127],
  4975. "steelblue": [70,130,180],
  4976. "tan": [210,180,140],
  4977. "thistle": [216,191,216],
  4978. "tomato": [255,99,71],
  4979. "turquoise": [64,224,208],
  4980. "violet": [238,130,238],
  4981. "wheat": [245,222,179],
  4982. "whitesmoke": [245,245,245],
  4983. "yellowgreen": [154,205,50]
  4984. });
  4985. return Color;
  4986. });
  4987. },
  4988. 'dijit/form/_FormSelectWidget':function(){
  4989. define("dijit/form/_FormSelectWidget", [
  4990. "dojo/_base/array", // array.filter array.forEach array.map array.some
  4991. "dojo/aspect", // aspect.after
  4992. "dojo/data/util/sorter", // util.sorter.createSortFunction
  4993. "dojo/_base/declare", // declare
  4994. "dojo/dom", // dom.setSelectable
  4995. "dojo/dom-class", // domClass.toggle
  4996. "dojo/_base/kernel", // _scopeName
  4997. "dojo/_base/lang", // lang.delegate lang.isArray lang.isObject lang.hitch
  4998. "dojo/query", // query
  4999. "./_FormValueWidget"
  5000. ], function(array, aspect, sorter, declare, dom, domClass, kernel, lang, query, _FormValueWidget){
  5001. /*=====
  5002. var _FormValueWidget = dijit.form._FormValueWidget;
  5003. =====*/
  5004. // module:
  5005. // dijit/form/_FormSelectWidget
  5006. // summary:
  5007. // Extends _FormValueWidget in order to provide "select-specific"
  5008. // values - i.e., those values that are unique to <select> elements.
  5009. /*=====
  5010. dijit.form.__SelectOption = function(){
  5011. // value: String
  5012. // The value of the option. Setting to empty (or missing) will
  5013. // place a separator at that location
  5014. // label: String
  5015. // The label for our option. It can contain html tags.
  5016. // selected: Boolean
  5017. // Whether or not we are a selected option
  5018. // disabled: Boolean
  5019. // Whether or not this specific option is disabled
  5020. this.value = value;
  5021. this.label = label;
  5022. this.selected = selected;
  5023. this.disabled = disabled;
  5024. }
  5025. =====*/
  5026. return declare("dijit.form._FormSelectWidget", _FormValueWidget, {
  5027. // summary:
  5028. // Extends _FormValueWidget in order to provide "select-specific"
  5029. // values - i.e., those values that are unique to <select> elements.
  5030. // This also provides the mechanism for reading the elements from
  5031. // a store, if desired.
  5032. // multiple: [const] Boolean
  5033. // Whether or not we are multi-valued
  5034. multiple: false,
  5035. // options: dijit.form.__SelectOption[]
  5036. // The set of options for our select item. Roughly corresponds to
  5037. // the html <option> tag.
  5038. options: null,
  5039. // store: dojo.data.api.Identity
  5040. // A store which, at the very least implements dojo.data.api.Identity
  5041. // to use for getting our list of options - rather than reading them
  5042. // from the <option> html tags.
  5043. store: null,
  5044. // query: object
  5045. // A query to use when fetching items from our store
  5046. query: null,
  5047. // queryOptions: object
  5048. // Query options to use when fetching from the store
  5049. queryOptions: null,
  5050. // onFetch: Function
  5051. // A callback to do with an onFetch - but before any items are actually
  5052. // iterated over (i.e. to filter even further what you want to add)
  5053. onFetch: null,
  5054. // sortByLabel: Boolean
  5055. // Flag to sort the options returned from a store by the label of
  5056. // the store.
  5057. sortByLabel: true,
  5058. // loadChildrenOnOpen: Boolean
  5059. // By default loadChildren is called when the items are fetched from the
  5060. // store. This property allows delaying loadChildren (and the creation
  5061. // of the options/menuitems) until the user clicks the button to open the
  5062. // dropdown.
  5063. loadChildrenOnOpen: false,
  5064. getOptions: function(/*anything*/ valueOrIdx){
  5065. // summary:
  5066. // Returns a given option (or options).
  5067. // valueOrIdx:
  5068. // If passed in as a string, that string is used to look up the option
  5069. // in the array of options - based on the value property.
  5070. // (See dijit.form.__SelectOption).
  5071. //
  5072. // If passed in a number, then the option with the given index (0-based)
  5073. // within this select will be returned.
  5074. //
  5075. // If passed in a dijit.form.__SelectOption, the same option will be
  5076. // returned if and only if it exists within this select.
  5077. //
  5078. // If passed an array, then an array will be returned with each element
  5079. // in the array being looked up.
  5080. //
  5081. // If not passed a value, then all options will be returned
  5082. //
  5083. // returns:
  5084. // The option corresponding with the given value or index. null
  5085. // is returned if any of the following are true:
  5086. // - A string value is passed in which doesn't exist
  5087. // - An index is passed in which is outside the bounds of the array of options
  5088. // - A dijit.form.__SelectOption is passed in which is not a part of the select
  5089. // NOTE: the compare for passing in a dijit.form.__SelectOption checks
  5090. // if the value property matches - NOT if the exact option exists
  5091. // NOTE: if passing in an array, null elements will be placed in the returned
  5092. // array when a value is not found.
  5093. var lookupValue = valueOrIdx, opts = this.options || [], l = opts.length;
  5094. if(lookupValue === undefined){
  5095. return opts; // dijit.form.__SelectOption[]
  5096. }
  5097. if(lang.isArray(lookupValue)){
  5098. return array.map(lookupValue, "return this.getOptions(item);", this); // dijit.form.__SelectOption[]
  5099. }
  5100. if(lang.isObject(valueOrIdx)){
  5101. // We were passed an option - so see if it's in our array (directly),
  5102. // and if it's not, try and find it by value.
  5103. if(!array.some(this.options, function(o, idx){
  5104. if(o === lookupValue ||
  5105. (o.value && o.value === lookupValue.value)){
  5106. lookupValue = idx;
  5107. return true;
  5108. }
  5109. return false;
  5110. })){
  5111. lookupValue = -1;
  5112. }
  5113. }
  5114. if(typeof lookupValue == "string"){
  5115. for(var i=0; i<l; i++){
  5116. if(opts[i].value === lookupValue){
  5117. lookupValue = i;
  5118. break;
  5119. }
  5120. }
  5121. }
  5122. if(typeof lookupValue == "number" && lookupValue >= 0 && lookupValue < l){
  5123. return this.options[lookupValue]; // dijit.form.__SelectOption
  5124. }
  5125. return null; // null
  5126. },
  5127. addOption: function(/*dijit.form.__SelectOption|dijit.form.__SelectOption[]*/ option){
  5128. // summary:
  5129. // Adds an option or options to the end of the select. If value
  5130. // of the option is empty or missing, a separator is created instead.
  5131. // Passing in an array of options will yield slightly better performance
  5132. // since the children are only loaded once.
  5133. if(!lang.isArray(option)){ option = [option]; }
  5134. array.forEach(option, function(i){
  5135. if(i && lang.isObject(i)){
  5136. this.options.push(i);
  5137. }
  5138. }, this);
  5139. this._loadChildren();
  5140. },
  5141. removeOption: function(/*String|dijit.form.__SelectOption|Number|Array*/ valueOrIdx){
  5142. // summary:
  5143. // Removes the given option or options. You can remove by string
  5144. // (in which case the value is removed), number (in which case the
  5145. // index in the options array is removed), or select option (in
  5146. // which case, the select option with a matching value is removed).
  5147. // You can also pass in an array of those values for a slightly
  5148. // better performance since the children are only loaded once.
  5149. if(!lang.isArray(valueOrIdx)){ valueOrIdx = [valueOrIdx]; }
  5150. var oldOpts = this.getOptions(valueOrIdx);
  5151. array.forEach(oldOpts, function(i){
  5152. // We can get null back in our array - if our option was not found. In
  5153. // that case, we don't want to blow up...
  5154. if(i){
  5155. this.options = array.filter(this.options, function(node){
  5156. return (node.value !== i.value || node.label !== i.label);
  5157. });
  5158. this._removeOptionItem(i);
  5159. }
  5160. }, this);
  5161. this._loadChildren();
  5162. },
  5163. updateOption: function(/*dijit.form.__SelectOption|dijit.form.__SelectOption[]*/ newOption){
  5164. // summary:
  5165. // Updates the values of the given option. The option to update
  5166. // is matched based on the value of the entered option. Passing
  5167. // in an array of new options will yield better performance since
  5168. // the children will only be loaded once.
  5169. if(!lang.isArray(newOption)){ newOption = [newOption]; }
  5170. array.forEach(newOption, function(i){
  5171. var oldOpt = this.getOptions(i), k;
  5172. if(oldOpt){
  5173. for(k in i){ oldOpt[k] = i[k]; }
  5174. }
  5175. }, this);
  5176. this._loadChildren();
  5177. },
  5178. setStore: function(/*dojo.data.api.Identity*/ store,
  5179. /*anything?*/ selectedValue,
  5180. /*Object?*/ fetchArgs){
  5181. // summary:
  5182. // Sets the store you would like to use with this select widget.
  5183. // The selected value is the value of the new store to set. This
  5184. // function returns the original store, in case you want to reuse
  5185. // it or something.
  5186. // store: dojo.data.api.Identity
  5187. // The store you would like to use - it MUST implement dojo.data.api.Identity,
  5188. // and MAY implement dojo.data.api.Notification.
  5189. // selectedValue: anything?
  5190. // The value that this widget should set itself to *after* the store
  5191. // has been loaded
  5192. // fetchArgs: Object?
  5193. // The arguments that will be passed to the store's fetch() function
  5194. var oStore = this.store;
  5195. fetchArgs = fetchArgs || {};
  5196. if(oStore !== store){
  5197. // Our store has changed, so update our notifications
  5198. var h;
  5199. while(h = this._notifyConnections.pop()){ h.remove(); }
  5200. if(store && store.getFeatures()["dojo.data.api.Notification"]){
  5201. this._notifyConnections = [
  5202. aspect.after(store, "onNew", lang.hitch(this, "_onNewItem"), true),
  5203. aspect.after(store, "onDelete", lang.hitch(this, "_onDeleteItem"), true),
  5204. aspect.after(store, "onSet", lang.hitch(this, "_onSetItem"), true)
  5205. ];
  5206. }
  5207. this._set("store", store);
  5208. }
  5209. // Turn off change notifications while we make all these changes
  5210. this._onChangeActive = false;
  5211. // Remove existing options (if there are any)
  5212. if(this.options && this.options.length){
  5213. this.removeOption(this.options);
  5214. }
  5215. // Add our new options
  5216. if(store){
  5217. this._loadingStore = true;
  5218. store.fetch(lang.delegate(fetchArgs, {
  5219. onComplete: function(items, opts){
  5220. if(this.sortByLabel && !fetchArgs.sort && items.length){
  5221. items.sort(sorter.createSortFunction([{
  5222. attribute: store.getLabelAttributes(items[0])[0]
  5223. }], store));
  5224. }
  5225. if(fetchArgs.onFetch){
  5226. items = fetchArgs.onFetch.call(this, items, opts);
  5227. }
  5228. // TODO: Add these guys as a batch, instead of separately
  5229. array.forEach(items, function(i){
  5230. this._addOptionForItem(i);
  5231. }, this);
  5232. // Set our value (which might be undefined), and then tweak
  5233. // it to send a change event with the real value
  5234. this._loadingStore = false;
  5235. this.set("value", "_pendingValue" in this ? this._pendingValue : selectedValue);
  5236. delete this._pendingValue;
  5237. if(!this.loadChildrenOnOpen){
  5238. this._loadChildren();
  5239. }else{
  5240. this._pseudoLoadChildren(items);
  5241. }
  5242. this._fetchedWith = opts;
  5243. this._lastValueReported = this.multiple ? [] : null;
  5244. this._onChangeActive = true;
  5245. this.onSetStore();
  5246. this._handleOnChange(this.value);
  5247. },
  5248. scope: this
  5249. }));
  5250. }else{
  5251. delete this._fetchedWith;
  5252. }
  5253. return oStore; // dojo.data.api.Identity
  5254. },
  5255. // TODO: implement set() and watch() for store and query, although not sure how to handle
  5256. // setting them individually rather than together (as in setStore() above)
  5257. _setValueAttr: function(/*anything*/ newValue, /*Boolean?*/ priorityChange){
  5258. // summary:
  5259. // set the value of the widget.
  5260. // If a string is passed, then we set our value from looking it up.
  5261. if(this._loadingStore){
  5262. // Our store is loading - so save our value, and we'll set it when
  5263. // we're done
  5264. this._pendingValue = newValue;
  5265. return;
  5266. }
  5267. var opts = this.getOptions() || [];
  5268. if(!lang.isArray(newValue)){
  5269. newValue = [newValue];
  5270. }
  5271. array.forEach(newValue, function(i, idx){
  5272. if(!lang.isObject(i)){
  5273. i = i + "";
  5274. }
  5275. if(typeof i === "string"){
  5276. newValue[idx] = array.filter(opts, function(node){
  5277. return node.value === i;
  5278. })[0] || {value: "", label: ""};
  5279. }
  5280. }, this);
  5281. // Make sure some sane default is set
  5282. newValue = array.filter(newValue, function(i){ return i && i.value; });
  5283. if(!this.multiple && (!newValue[0] || !newValue[0].value) && opts.length){
  5284. newValue[0] = opts[0];
  5285. }
  5286. array.forEach(opts, function(i){
  5287. i.selected = array.some(newValue, function(v){ return v.value === i.value; });
  5288. });
  5289. var val = array.map(newValue, function(i){ return i.value; }),
  5290. disp = array.map(newValue, function(i){ return i.label; });
  5291. this._set("value", this.multiple ? val : val[0]);
  5292. this._setDisplay(this.multiple ? disp : disp[0]);
  5293. this._updateSelection();
  5294. this._handleOnChange(this.value, priorityChange);
  5295. },
  5296. _getDisplayedValueAttr: function(){
  5297. // summary:
  5298. // returns the displayed value of the widget
  5299. var val = this.get("value");
  5300. if(!lang.isArray(val)){
  5301. val = [val];
  5302. }
  5303. var ret = array.map(this.getOptions(val), function(v){
  5304. if(v && "label" in v){
  5305. return v.label;
  5306. }else if(v){
  5307. return v.value;
  5308. }
  5309. return null;
  5310. }, this);
  5311. return this.multiple ? ret : ret[0];
  5312. },
  5313. _loadChildren: function(){
  5314. // summary:
  5315. // Loads the children represented by this widget's options.
  5316. // reset the menu to make it populatable on the next click
  5317. if(this._loadingStore){ return; }
  5318. array.forEach(this._getChildren(), function(child){
  5319. child.destroyRecursive();
  5320. });
  5321. // Add each menu item
  5322. array.forEach(this.options, this._addOptionItem, this);
  5323. // Update states
  5324. this._updateSelection();
  5325. },
  5326. _updateSelection: function(){
  5327. // summary:
  5328. // Sets the "selected" class on the item for styling purposes
  5329. this._set("value", this._getValueFromOpts());
  5330. var val = this.value;
  5331. if(!lang.isArray(val)){
  5332. val = [val];
  5333. }
  5334. if(val && val[0]){
  5335. array.forEach(this._getChildren(), function(child){
  5336. var isSelected = array.some(val, function(v){
  5337. return child.option && (v === child.option.value);
  5338. });
  5339. domClass.toggle(child.domNode, this.baseClass + "SelectedOption", isSelected);
  5340. child.domNode.setAttribute("aria-selected", isSelected);
  5341. }, this);
  5342. }
  5343. },
  5344. _getValueFromOpts: function(){
  5345. // summary:
  5346. // Returns the value of the widget by reading the options for
  5347. // the selected flag
  5348. var opts = this.getOptions() || [];
  5349. if(!this.multiple && opts.length){
  5350. // Mirror what a select does - choose the first one
  5351. var opt = array.filter(opts, function(i){
  5352. return i.selected;
  5353. })[0];
  5354. if(opt && opt.value){
  5355. return opt.value
  5356. }else{
  5357. opts[0].selected = true;
  5358. return opts[0].value;
  5359. }
  5360. }else if(this.multiple){
  5361. // Set value to be the sum of all selected
  5362. return array.map(array.filter(opts, function(i){
  5363. return i.selected;
  5364. }), function(i){
  5365. return i.value;
  5366. }) || [];
  5367. }
  5368. return "";
  5369. },
  5370. // Internal functions to call when we have store notifications come in
  5371. _onNewItem: function(/*item*/ item, /*Object?*/ parentInfo){
  5372. if(!parentInfo || !parentInfo.parent){
  5373. // Only add it if we are top-level
  5374. this._addOptionForItem(item);
  5375. }
  5376. },
  5377. _onDeleteItem: function(/*item*/ item){
  5378. var store = this.store;
  5379. this.removeOption(store.getIdentity(item));
  5380. },
  5381. _onSetItem: function(/*item*/ item){
  5382. this.updateOption(this._getOptionObjForItem(item));
  5383. },
  5384. _getOptionObjForItem: function(item){
  5385. // summary:
  5386. // Returns an option object based off the given item. The "value"
  5387. // of the option item will be the identity of the item, the "label"
  5388. // of the option will be the label of the item. If the item contains
  5389. // children, the children value of the item will be set
  5390. var store = this.store, label = store.getLabel(item),
  5391. value = (label ? store.getIdentity(item) : null);
  5392. return {value: value, label: label, item:item}; // dijit.form.__SelectOption
  5393. },
  5394. _addOptionForItem: function(/*item*/ item){
  5395. // summary:
  5396. // Creates (and adds) the option for the given item
  5397. var store = this.store;
  5398. if(!store.isItemLoaded(item)){
  5399. // We are not loaded - so let's load it and add later
  5400. store.loadItem({item: item, onItem: function(i){
  5401. this._addOptionForItem(i);
  5402. },
  5403. scope: this});
  5404. return;
  5405. }
  5406. var newOpt = this._getOptionObjForItem(item);
  5407. this.addOption(newOpt);
  5408. },
  5409. constructor: function(/*Object*/ keywordArgs){
  5410. // summary:
  5411. // Saves off our value, if we have an initial one set so we
  5412. // can use it if we have a store as well (see startup())
  5413. this._oValue = (keywordArgs || {}).value || null;
  5414. this._notifyConnections = [];
  5415. },
  5416. buildRendering: function(){
  5417. this.inherited(arguments);
  5418. dom.setSelectable(this.focusNode, false);
  5419. },
  5420. _fillContent: function(){
  5421. // summary:
  5422. // Loads our options and sets up our dropdown correctly. We
  5423. // don't want any content, so we don't call any inherit chain
  5424. // function.
  5425. var opts = this.options;
  5426. if(!opts){
  5427. opts = this.options = this.srcNodeRef ? query("> *",
  5428. this.srcNodeRef).map(function(node){
  5429. if(node.getAttribute("type") === "separator"){
  5430. return { value: "", label: "", selected: false, disabled: false };
  5431. }
  5432. return {
  5433. value: (node.getAttribute("data-" + kernel._scopeName + "-value") || node.getAttribute("value")),
  5434. label: String(node.innerHTML),
  5435. // FIXME: disabled and selected are not valid on complex markup children (which is why we're
  5436. // looking for data-dojo-value above. perhaps we should data-dojo-props="" this whole thing?)
  5437. // decide before 1.6
  5438. selected: node.getAttribute("selected") || false,
  5439. disabled: node.getAttribute("disabled") || false
  5440. };
  5441. }, this) : [];
  5442. }
  5443. if(!this.value){
  5444. this._set("value", this._getValueFromOpts());
  5445. }else if(this.multiple && typeof this.value == "string"){
  5446. this._set("value", this.value.split(","));
  5447. }
  5448. },
  5449. postCreate: function(){
  5450. // summary:
  5451. // sets up our event handling that we need for functioning
  5452. // as a select
  5453. this.inherited(arguments);
  5454. // Make our event connections for updating state
  5455. this.connect(this, "onChange", "_updateSelection");
  5456. this.connect(this, "startup", "_loadChildren");
  5457. this._setValueAttr(this.value, null);
  5458. },
  5459. startup: function(){
  5460. // summary:
  5461. // Connects in our store, if we have one defined
  5462. this.inherited(arguments);
  5463. var store = this.store, fetchArgs = {};
  5464. array.forEach(["query", "queryOptions", "onFetch"], function(i){
  5465. if(this[i]){
  5466. fetchArgs[i] = this[i];
  5467. }
  5468. delete this[i];
  5469. }, this);
  5470. if(store && store.getFeatures()["dojo.data.api.Identity"]){
  5471. // Temporarily set our store to null so that it will get set
  5472. // and connected appropriately
  5473. this.store = null;
  5474. this.setStore(store, this._oValue, fetchArgs);
  5475. }
  5476. },
  5477. destroy: function(){
  5478. // summary:
  5479. // Clean up our connections
  5480. var h;
  5481. while(h = this._notifyConnections.pop()){ h.remove(); }
  5482. this.inherited(arguments);
  5483. },
  5484. _addOptionItem: function(/*dijit.form.__SelectOption*/ /*===== option =====*/){
  5485. // summary:
  5486. // User-overridable function which, for the given option, adds an
  5487. // item to the select. If the option doesn't have a value, then a
  5488. // separator is added in that place. Make sure to store the option
  5489. // in the created option widget.
  5490. },
  5491. _removeOptionItem: function(/*dijit.form.__SelectOption*/ /*===== option =====*/){
  5492. // summary:
  5493. // User-overridable function which, for the given option, removes
  5494. // its item from the select.
  5495. },
  5496. _setDisplay: function(/*String or String[]*/ /*===== newDisplay =====*/){
  5497. // summary:
  5498. // Overridable function which will set the display for the
  5499. // widget. newDisplay is either a string (in the case of
  5500. // single selects) or array of strings (in the case of multi-selects)
  5501. },
  5502. _getChildren: function(){
  5503. // summary:
  5504. // Overridable function to return the children that this widget contains.
  5505. return [];
  5506. },
  5507. _getSelectedOptionsAttr: function(){
  5508. // summary:
  5509. // hooks into this.attr to provide a mechanism for getting the
  5510. // option items for the current value of the widget.
  5511. return this.getOptions(this.get("value"));
  5512. },
  5513. _pseudoLoadChildren: function(/*item[]*/ /*===== items =====*/){
  5514. // summary:
  5515. // a function that will "fake" loading children, if needed, and
  5516. // if we have set to not load children until the widget opens.
  5517. // items:
  5518. // An array of items that will be loaded, when needed
  5519. },
  5520. onSetStore: function(){
  5521. // summary:
  5522. // a function that can be connected to in order to receive a
  5523. // notification that the store has finished loading and all options
  5524. // from that store are available
  5525. }
  5526. });
  5527. });
  5528. },
  5529. 'dijit/form/Select':function(){
  5530. require({cache:{
  5531. 'url:dijit/form/templates/Select.html':"<table class=\"dijit dijitReset dijitInline dijitLeft\"\n\tdata-dojo-attach-point=\"_buttonNode,tableNode,focusNode\" cellspacing='0' cellpadding='0'\n\trole=\"combobox\" aria-haspopup=\"true\"\n\t><tbody role=\"presentation\"><tr role=\"presentation\"\n\t\t><td class=\"dijitReset dijitStretch dijitButtonContents dijitButtonNode\" role=\"presentation\"\n\t\t\t><span class=\"dijitReset dijitInline dijitButtonText\" data-dojo-attach-point=\"containerNode,_popupStateNode\"></span\n\t\t\t><input type=\"hidden\" ${!nameAttrSetting} data-dojo-attach-point=\"valueNode\" value=\"${value}\" aria-hidden=\"true\"\n\t\t/></td><td class=\"dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton\"\n\t\t\t\tdata-dojo-attach-point=\"titleNode\" role=\"presentation\"\n\t\t\t><div class=\"dijitReset dijitArrowButtonInner\" role=\"presentation\"></div\n\t\t\t><div class=\"dijitReset dijitArrowButtonChar\" role=\"presentation\">&#9660;</div\n\t\t></td\n\t></tr></tbody\n></table>\n"}});
  5532. define("dijit/form/Select", [
  5533. "dojo/_base/array", // array.forEach
  5534. "dojo/_base/declare", // declare
  5535. "dojo/dom-attr", // domAttr.set
  5536. "dojo/dom-class", // domClass.add domClass.remove domClass.toggle
  5537. "dojo/dom-construct", // domConstruct.create
  5538. "dojo/dom-geometry", // domGeometry.setMarginBox
  5539. "dojo/_base/event", // event.stop
  5540. "dojo/i18n", // i18n.getLocalization
  5541. "dojo/_base/lang", // lang.hitch
  5542. "./_FormSelectWidget",
  5543. "../_HasDropDown",
  5544. "../Menu",
  5545. "../MenuItem",
  5546. "../MenuSeparator",
  5547. "../Tooltip",
  5548. "dojo/text!./templates/Select.html",
  5549. "dojo/i18n!./nls/validate"
  5550. ], function(array, declare, domAttr, domClass, domConstruct, domGeometry, event, i18n, lang,
  5551. _FormSelectWidget, _HasDropDown, Menu, MenuItem, MenuSeparator, Tooltip, template){
  5552. /*=====
  5553. var _FormSelectWidget = dijit.form._FormSelectWidget;
  5554. var _HasDropDown = dijit._HasDropDown;
  5555. var _FormSelectWidget = dijit._FormSelectWidget;
  5556. var Menu = dijit.Menu;
  5557. var MenuItem = dijit.MenuItem;
  5558. var MenuSeparator = dijit.MenuSeparator;
  5559. var Tooltip = dijit.Tooltip;
  5560. =====*/
  5561. // module:
  5562. // dijit/form/Select
  5563. // summary:
  5564. // This is a "styleable" select box - it is basically a DropDownButton which
  5565. // can take a <select> as its input.
  5566. var _SelectMenu = declare("dijit.form._SelectMenu", Menu, {
  5567. // summary:
  5568. // An internally-used menu for dropdown that allows us a vertical scrollbar
  5569. buildRendering: function(){
  5570. // summary:
  5571. // Stub in our own changes, so that our domNode is not a table
  5572. // otherwise, we won't respond correctly to heights/overflows
  5573. this.inherited(arguments);
  5574. var o = (this.menuTableNode = this.domNode);
  5575. var n = (this.domNode = domConstruct.create("div", {style: {overflowX: "hidden", overflowY: "scroll"}}));
  5576. if(o.parentNode){
  5577. o.parentNode.replaceChild(n, o);
  5578. }
  5579. domClass.remove(o, "dijitMenuTable");
  5580. n.className = o.className + " dijitSelectMenu";
  5581. o.className = "dijitReset dijitMenuTable";
  5582. o.setAttribute("role", "listbox");
  5583. n.setAttribute("role", "presentation");
  5584. n.appendChild(o);
  5585. },
  5586. postCreate: function(){
  5587. // summary:
  5588. // stop mousemove from selecting text on IE to be consistent with other browsers
  5589. this.inherited(arguments);
  5590. this.connect(this.domNode, "onmousemove", event.stop);
  5591. },
  5592. resize: function(/*Object*/ mb){
  5593. // summary:
  5594. // Overridden so that we are able to handle resizing our
  5595. // internal widget. Note that this is not a "full" resize
  5596. // implementation - it only works correctly if you pass it a
  5597. // marginBox.
  5598. //
  5599. // mb: Object
  5600. // The margin box to set this dropdown to.
  5601. if(mb){
  5602. domGeometry.setMarginBox(this.domNode, mb);
  5603. if("w" in mb){
  5604. // We've explicitly set the wrapper <div>'s width, so set <table> width to match.
  5605. // 100% is safer than a pixel value because there may be a scroll bar with
  5606. // browser/OS specific width.
  5607. this.menuTableNode.style.width = "100%";
  5608. }
  5609. }
  5610. }
  5611. });
  5612. var Select = declare("dijit.form.Select", [_FormSelectWidget, _HasDropDown], {
  5613. // summary:
  5614. // This is a "styleable" select box - it is basically a DropDownButton which
  5615. // can take a <select> as its input.
  5616. baseClass: "dijitSelect",
  5617. templateString: template,
  5618. // required: Boolean
  5619. // Can be true or false, default is false.
  5620. required: false,
  5621. // state: [readonly] String
  5622. // "Incomplete" if this select is required but unset (i.e. blank value), "" otherwise
  5623. state: "",
  5624. // message: String
  5625. // Currently displayed error/prompt message
  5626. message: "",
  5627. // tooltipPosition: String[]
  5628. // See description of dijit.Tooltip.defaultPosition for details on this parameter.
  5629. tooltipPosition: [],
  5630. // emptyLabel: string
  5631. // What to display in an "empty" dropdown
  5632. emptyLabel: "&#160;", // &nbsp;
  5633. // _isLoaded: Boolean
  5634. // Whether or not we have been loaded
  5635. _isLoaded: false,
  5636. // _childrenLoaded: Boolean
  5637. // Whether or not our children have been loaded
  5638. _childrenLoaded: false,
  5639. _fillContent: function(){
  5640. // summary:
  5641. // Set the value to be the first, or the selected index
  5642. this.inherited(arguments);
  5643. // set value from selected option
  5644. if(this.options.length && !this.value && this.srcNodeRef){
  5645. var si = this.srcNodeRef.selectedIndex || 0; // || 0 needed for when srcNodeRef is not a SELECT
  5646. this.value = this.options[si >= 0 ? si : 0].value;
  5647. }
  5648. // Create the dropDown widget
  5649. this.dropDown = new _SelectMenu({id: this.id + "_menu"});
  5650. domClass.add(this.dropDown.domNode, this.baseClass + "Menu");
  5651. },
  5652. _getMenuItemForOption: function(/*dijit.form.__SelectOption*/ option){
  5653. // summary:
  5654. // For the given option, return the menu item that should be
  5655. // used to display it. This can be overridden as needed
  5656. if(!option.value && !option.label){
  5657. // We are a separator (no label set for it)
  5658. return new MenuSeparator();
  5659. }else{
  5660. // Just a regular menu option
  5661. var click = lang.hitch(this, "_setValueAttr", option);
  5662. var item = new MenuItem({
  5663. option: option,
  5664. label: option.label || this.emptyLabel,
  5665. onClick: click,
  5666. disabled: option.disabled || false
  5667. });
  5668. item.focusNode.setAttribute("role", "listitem");
  5669. return item;
  5670. }
  5671. },
  5672. _addOptionItem: function(/*dijit.form.__SelectOption*/ option){
  5673. // summary:
  5674. // For the given option, add an option to our dropdown.
  5675. // If the option doesn't have a value, then a separator is added
  5676. // in that place.
  5677. if(this.dropDown){
  5678. this.dropDown.addChild(this._getMenuItemForOption(option));
  5679. }
  5680. },
  5681. _getChildren: function(){
  5682. if(!this.dropDown){
  5683. return [];
  5684. }
  5685. return this.dropDown.getChildren();
  5686. },
  5687. _loadChildren: function(/*Boolean*/ loadMenuItems){
  5688. // summary:
  5689. // Resets the menu and the length attribute of the button - and
  5690. // ensures that the label is appropriately set.
  5691. // loadMenuItems: Boolean
  5692. // actually loads the child menu items - we only do this when we are
  5693. // populating for showing the dropdown.
  5694. if(loadMenuItems === true){
  5695. // this.inherited destroys this.dropDown's child widgets (MenuItems).
  5696. // Avoid this.dropDown (Menu widget) having a pointer to a destroyed widget (which will cause
  5697. // issues later in _setSelected). (see #10296)
  5698. if(this.dropDown){
  5699. delete this.dropDown.focusedChild;
  5700. }
  5701. if(this.options.length){
  5702. this.inherited(arguments);
  5703. }else{
  5704. // Drop down menu is blank but add one blank entry just so something appears on the screen
  5705. // to let users know that they are no choices (mimicing native select behavior)
  5706. array.forEach(this._getChildren(), function(child){ child.destroyRecursive(); });
  5707. var item = new MenuItem({label: "&#160;"});
  5708. this.dropDown.addChild(item);
  5709. }
  5710. }else{
  5711. this._updateSelection();
  5712. }
  5713. this._isLoaded = false;
  5714. this._childrenLoaded = true;
  5715. if(!this._loadingStore){
  5716. // Don't call this if we are loading - since we will handle it later
  5717. this._setValueAttr(this.value);
  5718. }
  5719. },
  5720. _setValueAttr: function(value){
  5721. this.inherited(arguments);
  5722. domAttr.set(this.valueNode, "value", this.get("value"));
  5723. this.validate(this.focused); // to update this.state
  5724. },
  5725. _setDisabledAttr: function(/*Boolean*/ value){
  5726. this.inherited(arguments);
  5727. this.validate(this.focused); // to update this.state
  5728. },
  5729. _setRequiredAttr: function(/*Boolean*/ value){
  5730. this._set("required", value);
  5731. this.focusNode.setAttribute("aria-required", value);
  5732. this.validate(this.focused); // to update this.state
  5733. },
  5734. _setDisplay: function(/*String*/ newDisplay){
  5735. // summary:
  5736. // sets the display for the given value (or values)
  5737. var lbl = newDisplay || this.emptyLabel;
  5738. this.containerNode.innerHTML = '<span class="dijitReset dijitInline ' + this.baseClass + 'Label">' + lbl + '</span>';
  5739. this.focusNode.setAttribute("aria-valuetext", lbl);
  5740. },
  5741. validate: function(/*Boolean*/ isFocused){
  5742. // summary:
  5743. // Called by oninit, onblur, and onkeypress, and whenever required/disabled state changes
  5744. // description:
  5745. // Show missing or invalid messages if appropriate, and highlight textbox field.
  5746. // Used when a select is initially set to no value and the user is required to
  5747. // set the value.
  5748. var isValid = this.disabled || this.isValid(isFocused);
  5749. this._set("state", isValid ? "" : "Incomplete");
  5750. this.focusNode.setAttribute("aria-invalid", isValid ? "false" : "true");
  5751. var message = isValid ? "" : this._missingMsg;
  5752. if(message && this.focused && this._hasBeenBlurred){
  5753. Tooltip.show(message, this.domNode, this.tooltipPosition, !this.isLeftToRight());
  5754. }else{
  5755. Tooltip.hide(this.domNode);
  5756. }
  5757. this._set("message", message);
  5758. return isValid;
  5759. },
  5760. isValid: function(/*Boolean*/ /*===== isFocused =====*/){
  5761. // summary:
  5762. // Whether or not this is a valid value. The only way a Select
  5763. // can be invalid is when it's required but nothing is selected.
  5764. return (!this.required || this.value === 0 || !(/^\s*$/.test(this.value || ""))); // handle value is null or undefined
  5765. },
  5766. reset: function(){
  5767. // summary:
  5768. // Overridden so that the state will be cleared.
  5769. this.inherited(arguments);
  5770. Tooltip.hide(this.domNode);
  5771. this.validate(this.focused); // to update this.state
  5772. },
  5773. postMixInProperties: function(){
  5774. // summary:
  5775. // set the missing message
  5776. this.inherited(arguments);
  5777. this._missingMsg = i18n.getLocalization("dijit.form", "validate",
  5778. this.lang).missingMessage;
  5779. },
  5780. postCreate: function(){
  5781. // summary:
  5782. // stop mousemove from selecting text on IE to be consistent with other browsers
  5783. this.inherited(arguments);
  5784. this.connect(this.domNode, "onmousemove", event.stop);
  5785. },
  5786. _setStyleAttr: function(/*String||Object*/ value){
  5787. this.inherited(arguments);
  5788. domClass.toggle(this.domNode, this.baseClass + "FixedWidth", !!this.domNode.style.width);
  5789. },
  5790. isLoaded: function(){
  5791. return this._isLoaded;
  5792. },
  5793. loadDropDown: function(/*Function*/ loadCallback){
  5794. // summary:
  5795. // populates the menu
  5796. this._loadChildren(true);
  5797. this._isLoaded = true;
  5798. loadCallback();
  5799. },
  5800. closeDropDown: function(){
  5801. // overriding _HasDropDown.closeDropDown()
  5802. this.inherited(arguments);
  5803. if(this.dropDown && this.dropDown.menuTableNode){
  5804. // Erase possible width: 100% setting from _SelectMenu.resize().
  5805. // Leaving it would interfere with the next openDropDown() call, which
  5806. // queries the natural size of the drop down.
  5807. this.dropDown.menuTableNode.style.width = "";
  5808. }
  5809. },
  5810. uninitialize: function(preserveDom){
  5811. if(this.dropDown && !this.dropDown._destroyed){
  5812. this.dropDown.destroyRecursive(preserveDom);
  5813. delete this.dropDown;
  5814. }
  5815. this.inherited(arguments);
  5816. },
  5817. _onFocus: function(){
  5818. this.validate(true); // show tooltip if second focus of required tooltip, but no selection
  5819. this.inherited(arguments);
  5820. },
  5821. _onBlur: function(){
  5822. Tooltip.hide(this.domNode);
  5823. this.inherited(arguments);
  5824. }
  5825. });
  5826. Select._Menu = _SelectMenu; // for monkey patching
  5827. return Select;
  5828. });
  5829. },
  5830. 'dojo/store/util/QueryResults':function(){
  5831. define("dojo/store/util/QueryResults", ["../../_base/array", "../../_base/lang", "../../_base/Deferred"
  5832. ], function(array, lang, Deferred) {
  5833. // module:
  5834. // dojo/store/util/QueryResults
  5835. // summary:
  5836. // The module defines a query results wrapper
  5837. var util = lang.getObject("dojo.store.util", true);
  5838. util.QueryResults = function(results){
  5839. // summary:
  5840. // A function that wraps the results of a store query with additional
  5841. // methods.
  5842. //
  5843. // description:
  5844. // QueryResults is a basic wrapper that allows for array-like iteration
  5845. // over any kind of returned data from a query. While the simplest store
  5846. // will return a plain array of data, other stores may return deferreds or
  5847. // promises; this wrapper makes sure that *all* results can be treated
  5848. // the same.
  5849. //
  5850. // Additional methods include `forEach`, `filter` and `map`.
  5851. //
  5852. // returns: Object
  5853. // An array-like object that can be used for iterating over.
  5854. //
  5855. // example:
  5856. // Query a store and iterate over the results.
  5857. //
  5858. // | store.query({ prime: true }).forEach(function(item){
  5859. // | // do something
  5860. // | });
  5861. if(!results){
  5862. return results;
  5863. }
  5864. // if it is a promise it may be frozen
  5865. if(results.then){
  5866. results = lang.delegate(results);
  5867. }
  5868. function addIterativeMethod(method){
  5869. if(!results[method]){
  5870. results[method] = function(){
  5871. var args = arguments;
  5872. return Deferred.when(results, function(results){
  5873. Array.prototype.unshift.call(args, results);
  5874. return util.QueryResults(array[method].apply(array, args));
  5875. });
  5876. };
  5877. }
  5878. }
  5879. addIterativeMethod("forEach");
  5880. addIterativeMethod("filter");
  5881. addIterativeMethod("map");
  5882. if(!results.total){
  5883. results.total = Deferred.when(results, function(results){
  5884. return results.length;
  5885. });
  5886. }
  5887. return results;
  5888. };
  5889. return util.QueryResults;
  5890. });
  5891. },
  5892. 'dijit/form/_ListBase':function(){
  5893. define("dijit/form/_ListBase", [
  5894. "dojo/_base/declare", // declare
  5895. "dojo/window" // winUtils.scrollIntoView
  5896. ], function(declare, winUtils){
  5897. // module:
  5898. // dijit/form/_ListBase
  5899. // summary:
  5900. // Focus-less menu to handle UI events consistently
  5901. return declare( "dijit.form._ListBase", null, {
  5902. // summary:
  5903. // Focus-less menu to handle UI events consistently
  5904. // Abstract methods that must be defined externally:
  5905. // onSelect: item is active (mousedown but not yet mouseup, or keyboard arrow selected but no Enter)
  5906. // onDeselect: cancels onSelect
  5907. // tags:
  5908. // private
  5909. // selected: DOMnode
  5910. // currently selected node
  5911. selected: null,
  5912. _getTarget: function(/*Event*/ evt){
  5913. var tgt = evt.target;
  5914. var container = this.containerNode;
  5915. if(tgt == container || tgt == this.domNode){ return null; }
  5916. while(tgt && tgt.parentNode != container){
  5917. // recurse to the top
  5918. tgt = tgt.parentNode;
  5919. }
  5920. return tgt;
  5921. },
  5922. selectFirstNode: function(){
  5923. // summary:
  5924. // Select the first displayed item in the list.
  5925. var first = this.containerNode.firstChild;
  5926. while(first && first.style.display == "none"){
  5927. first = first.nextSibling;
  5928. }
  5929. this._setSelectedAttr(first, true);
  5930. },
  5931. selectLastNode: function(){
  5932. // summary:
  5933. // Select the last displayed item in the list
  5934. var last = this.containerNode.lastChild;
  5935. while(last && last.style.display == "none"){
  5936. last = last.previousSibling;
  5937. }
  5938. this._setSelectedAttr(last, true);
  5939. },
  5940. selectNextNode: function(){
  5941. // summary:
  5942. // Select the item just below the current selection.
  5943. // If nothing selected, select first node.
  5944. var selectedNode = this._getSelectedAttr();
  5945. if(!selectedNode){
  5946. this.selectFirstNode();
  5947. }else{
  5948. var next = selectedNode.nextSibling;
  5949. while(next && next.style.display == "none"){
  5950. next = next.nextSibling;
  5951. }
  5952. if(!next){
  5953. this.selectFirstNode();
  5954. }else{
  5955. this._setSelectedAttr(next, true);
  5956. }
  5957. }
  5958. },
  5959. selectPreviousNode: function(){
  5960. // summary:
  5961. // Select the item just above the current selection.
  5962. // If nothing selected, select last node (if
  5963. // you select Previous and try to keep scrolling up the list).
  5964. var selectedNode = this._getSelectedAttr();
  5965. if(!selectedNode){
  5966. this.selectLastNode();
  5967. }else{
  5968. var prev = selectedNode.previousSibling;
  5969. while(prev && prev.style.display == "none"){
  5970. prev = prev.previousSibling;
  5971. }
  5972. if(!prev){
  5973. this.selectLastNode();
  5974. }else{
  5975. this._setSelectedAttr(prev, true);
  5976. }
  5977. }
  5978. },
  5979. _setSelectedAttr: function(/*DomNode*/ node, /*Boolean*/ scroll){
  5980. // summary:
  5981. // Does the actual select.
  5982. // node:
  5983. // The option to select
  5984. // scroll:
  5985. // If necessary, scroll node into view. Set to false for mouse/touch to
  5986. // avoid jumping problems on mobile/RTL, see https://bugs.dojotoolkit.org/ticket/17739.
  5987. if(this.selected != node){
  5988. var selectedNode = this._getSelectedAttr();
  5989. if(selectedNode){
  5990. this.onDeselect(selectedNode);
  5991. this.selected = null;
  5992. }
  5993. if(node && node.parentNode == this.containerNode){
  5994. this.selected = node;
  5995. if(scroll){
  5996. winUtils.scrollIntoView(node);
  5997. }
  5998. this.onSelect(node);
  5999. }
  6000. }else if(node){
  6001. this.onSelect(node);
  6002. }
  6003. },
  6004. _getSelectedAttr: function(){
  6005. // summary:
  6006. // Returns the selected node.
  6007. var v = this.selected;
  6008. return (v && v.parentNode == this.containerNode) ? v : (this.selected = null);
  6009. }
  6010. });
  6011. });
  6012. },
  6013. 'dijit/form/_ComboBoxMenu':function(){
  6014. define("dijit/form/_ComboBoxMenu", [
  6015. "dojo/_base/declare", // declare
  6016. "dojo/dom-class", // domClass.add domClass.remove
  6017. "dojo/dom-construct", // domConstruct.create
  6018. "dojo/dom-style", // domStyle.get
  6019. "dojo/keys", // keys.DOWN_ARROW keys.PAGE_DOWN keys.PAGE_UP keys.UP_ARROW
  6020. "../_WidgetBase",
  6021. "../_TemplatedMixin",
  6022. "./_ComboBoxMenuMixin",
  6023. "./_ListMouseMixin"
  6024. ], function(declare, domClass, domConstruct, domStyle, keys,
  6025. _WidgetBase, _TemplatedMixin, _ComboBoxMenuMixin, _ListMouseMixin){
  6026. /*=====
  6027. var _WidgetBase = dijit._WidgetBase;
  6028. var _TemplatedMixin = dijit._TemplatedMixin;
  6029. var _ComboBoxMenuMixin = dijit.form._ComboBoxMenuMixin;
  6030. var _ListMouseMixin = dijit.form._ListMouseMixin;
  6031. =====*/
  6032. // module:
  6033. // dijit/form/_ComboBoxMenu
  6034. // summary:
  6035. // Focus-less menu for internal use in `dijit.form.ComboBox`
  6036. return declare("dijit.form._ComboBoxMenu",[_WidgetBase, _TemplatedMixin, _ListMouseMixin, _ComboBoxMenuMixin], {
  6037. // summary:
  6038. // Focus-less menu for internal use in `dijit.form.ComboBox`
  6039. // Abstract methods that must be defined externally:
  6040. // onChange: item was explicitly chosen (mousedown somewhere on the menu and mouseup somewhere on the menu)
  6041. // onPage: next(1) or previous(-1) button pressed
  6042. // tags:
  6043. // private
  6044. templateString: "<div class='dijitReset dijitMenu' data-dojo-attach-point='containerNode' style='overflow: auto; overflow-x: hidden;'>"
  6045. +"<div class='dijitMenuItem dijitMenuPreviousButton' data-dojo-attach-point='previousButton' role='option'></div>"
  6046. +"<div class='dijitMenuItem dijitMenuNextButton' data-dojo-attach-point='nextButton' role='option'></div>"
  6047. +"</div>",
  6048. baseClass: "dijitComboBoxMenu",
  6049. postCreate: function(){
  6050. this.inherited(arguments);
  6051. if(!this.isLeftToRight()){
  6052. domClass.add(this.previousButton, "dijitMenuItemRtl");
  6053. domClass.add(this.nextButton, "dijitMenuItemRtl");
  6054. }
  6055. },
  6056. _createMenuItem: function(){
  6057. return domConstruct.create("div", {
  6058. "class": "dijitReset dijitMenuItem" +(this.isLeftToRight() ? "" : " dijitMenuItemRtl"),
  6059. role: "option"
  6060. });
  6061. },
  6062. onHover: function(/*DomNode*/ node){
  6063. // summary:
  6064. // Add hover CSS
  6065. domClass.add(node, "dijitMenuItemHover");
  6066. },
  6067. onUnhover: function(/*DomNode*/ node){
  6068. // summary:
  6069. // Remove hover CSS
  6070. domClass.remove(node, "dijitMenuItemHover");
  6071. },
  6072. onSelect: function(/*DomNode*/ node){
  6073. // summary:
  6074. // Add selected CSS
  6075. domClass.add(node, "dijitMenuItemSelected");
  6076. },
  6077. onDeselect: function(/*DomNode*/ node){
  6078. // summary:
  6079. // Remove selected CSS
  6080. domClass.remove(node, "dijitMenuItemSelected");
  6081. },
  6082. _page: function(/*Boolean*/ up){
  6083. // summary:
  6084. // Handles page-up and page-down keypresses
  6085. var scrollamount = 0;
  6086. var oldscroll = this.domNode.scrollTop;
  6087. var height = domStyle.get(this.domNode, "height");
  6088. // if no item is highlighted, highlight the first option
  6089. if(!this.getHighlightedOption()){
  6090. this.selectNextNode();
  6091. }
  6092. while(scrollamount<height){
  6093. var highlighted_option = this.getHighlightedOption();
  6094. if(up){
  6095. // stop at option 1
  6096. if(!highlighted_option.previousSibling ||
  6097. highlighted_option.previousSibling.style.display == "none"){
  6098. break;
  6099. }
  6100. this.selectPreviousNode();
  6101. }else{
  6102. // stop at last option
  6103. if(!highlighted_option.nextSibling ||
  6104. highlighted_option.nextSibling.style.display == "none"){
  6105. break;
  6106. }
  6107. this.selectNextNode();
  6108. }
  6109. // going backwards
  6110. var newscroll = this.domNode.scrollTop;
  6111. scrollamount += (newscroll-oldscroll)*(up ? -1:1);
  6112. oldscroll = newscroll;
  6113. }
  6114. },
  6115. handleKey: function(evt){
  6116. // summary:
  6117. // Handle keystroke event forwarded from ComboBox, returning false if it's
  6118. // a keystroke I recognize and process, true otherwise.
  6119. switch(evt.keyCode){
  6120. case keys.DOWN_ARROW:
  6121. this.selectNextNode();
  6122. return false;
  6123. case keys.PAGE_DOWN:
  6124. this._page(false);
  6125. return false;
  6126. case keys.UP_ARROW:
  6127. this.selectPreviousNode();
  6128. return false;
  6129. case keys.PAGE_UP:
  6130. this._page(true);
  6131. return false;
  6132. default:
  6133. return true;
  6134. }
  6135. }
  6136. });
  6137. });
  6138. },
  6139. 'dijit/Dialog':function(){
  6140. require({cache:{
  6141. 'url:dijit/templates/Dialog.html':"<div class=\"dijitDialog\" role=\"dialog\" aria-labelledby=\"${id}_title\">\n\t<div data-dojo-attach-point=\"titleBar\" class=\"dijitDialogTitleBar\">\n\t<span data-dojo-attach-point=\"titleNode\" class=\"dijitDialogTitle\" id=\"${id}_title\"></span>\n\t<span data-dojo-attach-point=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" data-dojo-attach-event=\"ondijitclick: onCancel\" title=\"${buttonCancel}\" role=\"button\" tabIndex=\"0\">\n\t\t<span data-dojo-attach-point=\"closeText\" class=\"closeText\" title=\"${buttonCancel}\">x</span>\n\t</span>\n\t</div>\n\t\t<div data-dojo-attach-point=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n</div>\n"}});
  6142. define("dijit/Dialog", [
  6143. "require",
  6144. "dojo/_base/array", // array.forEach array.indexOf array.map
  6145. "dojo/_base/connect", // connect._keypress
  6146. "dojo/_base/declare", // declare
  6147. "dojo/_base/Deferred", // Deferred
  6148. "dojo/dom", // dom.isDescendant
  6149. "dojo/dom-class", // domClass.add domClass.contains
  6150. "dojo/dom-geometry", // domGeometry.position
  6151. "dojo/dom-style", // domStyle.set
  6152. "dojo/_base/event", // event.stop
  6153. "dojo/_base/fx", // fx.fadeIn fx.fadeOut
  6154. "dojo/i18n", // i18n.getLocalization
  6155. "dojo/_base/kernel", // kernel.isAsync
  6156. "dojo/keys",
  6157. "dojo/_base/lang", // lang.mixin lang.hitch
  6158. "dojo/on",
  6159. "dojo/ready",
  6160. "dojo/_base/sniff", // has("ie") has("opera")
  6161. "dojo/_base/window", // win.body
  6162. "dojo/window", // winUtils.getBox
  6163. "dojo/dnd/Moveable", // Moveable
  6164. "dojo/dnd/TimedMoveable", // TimedMoveable
  6165. "./focus",
  6166. "./_base/manager", // manager.defaultDuration
  6167. "./_Widget",
  6168. "./_TemplatedMixin",
  6169. "./_CssStateMixin",
  6170. "./form/_FormMixin",
  6171. "./_DialogMixin",
  6172. "./DialogUnderlay",
  6173. "./layout/ContentPane",
  6174. "dojo/text!./templates/Dialog.html",
  6175. ".", // for back-compat, exporting dijit._underlay (remove in 2.0)
  6176. "dojo/i18n!./nls/common"
  6177. ], function(require, array, connect, declare, Deferred,
  6178. dom, domClass, domGeometry, domStyle, event, fx, i18n, kernel, keys, lang, on, ready, has, win, winUtils,
  6179. Moveable, TimedMoveable, focus, manager, _Widget, _TemplatedMixin, _CssStateMixin, _FormMixin, _DialogMixin,
  6180. DialogUnderlay, ContentPane, template, dijit){
  6181. /*=====
  6182. var _Widget = dijit._Widget;
  6183. var _TemplatedMixin = dijit._TemplatedMixin;
  6184. var _CssStateMixin = dijit._CssStateMixin;
  6185. var _FormMixin = dijit.form._FormMixin;
  6186. var _DialogMixin = dijit._DialogMixin;
  6187. =====*/
  6188. // module:
  6189. // dijit/Dialog
  6190. // summary:
  6191. // A modal dialog Widget
  6192. /*=====
  6193. dijit._underlay = function(kwArgs){
  6194. // summary:
  6195. // A shared instance of a `dijit.DialogUnderlay`
  6196. //
  6197. // description:
  6198. // A shared instance of a `dijit.DialogUnderlay` created and
  6199. // used by `dijit.Dialog`, though never created until some Dialog
  6200. // or subclass thereof is shown.
  6201. };
  6202. =====*/
  6203. var _DialogBase = declare("dijit._DialogBase", [_TemplatedMixin, _FormMixin, _DialogMixin, _CssStateMixin], {
  6204. // summary:
  6205. // A modal dialog Widget
  6206. //
  6207. // description:
  6208. // Pops up a modal dialog window, blocking access to the screen
  6209. // and also graying out the screen Dialog is extended from
  6210. // ContentPane so it supports all the same parameters (href, etc.)
  6211. //
  6212. // example:
  6213. // | <div data-dojo-type="dijit.Dialog" data-dojo-props="href: 'test.html'"></div>
  6214. //
  6215. // example:
  6216. // | var foo = new dijit.Dialog({ title: "test dialog", content: "test content" };
  6217. // | dojo.body().appendChild(foo.domNode);
  6218. // | foo.startup();
  6219. templateString: template,
  6220. baseClass: "dijitDialog",
  6221. cssStateNodes: {
  6222. closeButtonNode: "dijitDialogCloseIcon"
  6223. },
  6224. // Map widget attributes to DOMNode attributes.
  6225. _setTitleAttr: [
  6226. { node: "titleNode", type: "innerHTML" },
  6227. { node: "titleBar", type: "attribute" }
  6228. ],
  6229. // open: [readonly] Boolean
  6230. // True if Dialog is currently displayed on screen.
  6231. open: false,
  6232. // duration: Integer
  6233. // The time in milliseconds it takes the dialog to fade in and out
  6234. duration: manager.defaultDuration,
  6235. // refocus: Boolean
  6236. // A Toggle to modify the default focus behavior of a Dialog, which
  6237. // is to re-focus the element which had focus before being opened.
  6238. // False will disable refocusing. Default: true
  6239. refocus: true,
  6240. // autofocus: Boolean
  6241. // A Toggle to modify the default focus behavior of a Dialog, which
  6242. // is to focus on the first dialog element after opening the dialog.
  6243. // False will disable autofocusing. Default: true
  6244. autofocus: true,
  6245. // _firstFocusItem: [private readonly] DomNode
  6246. // The pointer to the first focusable node in the dialog.
  6247. // Set by `dijit._DialogMixin._getFocusItems`.
  6248. _firstFocusItem: null,
  6249. // _lastFocusItem: [private readonly] DomNode
  6250. // The pointer to which node has focus prior to our dialog.
  6251. // Set by `dijit._DialogMixin._getFocusItems`.
  6252. _lastFocusItem: null,
  6253. // doLayout: [protected] Boolean
  6254. // Don't change this parameter from the default value.
  6255. // This ContentPane parameter doesn't make sense for Dialog, since Dialog
  6256. // is never a child of a layout container, nor can you specify the size of
  6257. // Dialog in order to control the size of an inner widget.
  6258. doLayout: false,
  6259. // draggable: Boolean
  6260. // Toggles the moveable aspect of the Dialog. If true, Dialog
  6261. // can be dragged by it's title. If false it will remain centered
  6262. // in the viewport.
  6263. draggable: true,
  6264. //aria-describedby: String
  6265. // Allows the user to add an aria-describedby attribute onto the dialog. The value should
  6266. // be the id of the container element of text that describes the dialog purpose (usually
  6267. // the first text in the dialog).
  6268. // <div data-dojo-type="dijit.Dialog" aria-describedby="intro" .....>
  6269. // <div id="intro">Introductory text</div>
  6270. // <div>rest of dialog contents</div>
  6271. // </div>
  6272. "aria-describedby":"",
  6273. postMixInProperties: function(){
  6274. var _nlsResources = i18n.getLocalization("dijit", "common");
  6275. lang.mixin(this, _nlsResources);
  6276. this.inherited(arguments);
  6277. },
  6278. postCreate: function(){
  6279. domStyle.set(this.domNode, {
  6280. display: "none",
  6281. position:"absolute"
  6282. });
  6283. win.body().appendChild(this.domNode);
  6284. this.inherited(arguments);
  6285. this.connect(this, "onExecute", "hide");
  6286. this.connect(this, "onCancel", "hide");
  6287. this._modalconnects = [];
  6288. },
  6289. onLoad: function(){
  6290. // summary:
  6291. // Called when data has been loaded from an href.
  6292. // Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
  6293. // but should *not* be overridden.
  6294. // tags:
  6295. // callback
  6296. // when href is specified we need to reposition the dialog after the data is loaded
  6297. // and find the focusable elements
  6298. this._position();
  6299. if(this.autofocus && DialogLevelManager.isTop(this)){
  6300. this._getFocusItems(this.domNode);
  6301. focus.focus(this._firstFocusItem);
  6302. }
  6303. this.inherited(arguments);
  6304. },
  6305. _endDrag: function(){
  6306. // summary:
  6307. // Called after dragging the Dialog. Saves the position of the dialog in the viewport,
  6308. // and also adjust position to be fully within the viewport, so user doesn't lose access to handle
  6309. var nodePosition = domGeometry.position(this.domNode),
  6310. viewport = winUtils.getBox();
  6311. nodePosition.y = Math.min(Math.max(nodePosition.y, 0), (viewport.h - nodePosition.h));
  6312. nodePosition.x = Math.min(Math.max(nodePosition.x, 0), (viewport.w - nodePosition.w));
  6313. this._relativePosition = nodePosition;
  6314. this._position();
  6315. },
  6316. _setup: function(){
  6317. // summary:
  6318. // Stuff we need to do before showing the Dialog for the first
  6319. // time (but we defer it until right beforehand, for
  6320. // performance reasons).
  6321. // tags:
  6322. // private
  6323. var node = this.domNode;
  6324. if(this.titleBar && this.draggable){
  6325. this._moveable = new ((has("ie") == 6) ? TimedMoveable // prevent overload, see #5285
  6326. : Moveable)(node, { handle: this.titleBar });
  6327. this.connect(this._moveable, "onMoveStop", "_endDrag");
  6328. }else{
  6329. domClass.add(node,"dijitDialogFixed");
  6330. }
  6331. this.underlayAttrs = {
  6332. dialogId: this.id,
  6333. "class": array.map(this["class"].split(/\s/), function(s){ return s+"_underlay"; }).join(" ")
  6334. };
  6335. },
  6336. _size: function(){
  6337. // summary:
  6338. // If necessary, shrink dialog contents so dialog fits in viewport
  6339. // tags:
  6340. // private
  6341. this._checkIfSingleChild();
  6342. // If we resized the dialog contents earlier, reset them back to original size, so
  6343. // that if the user later increases the viewport size, the dialog can display w/out a scrollbar.
  6344. // Need to do this before the domGeometry.position(this.domNode) call below.
  6345. if(this._singleChild){
  6346. if(this._singleChildOriginalStyle){
  6347. this._singleChild.domNode.style.cssText = this._singleChildOriginalStyle;
  6348. }
  6349. delete this._singleChildOriginalStyle;
  6350. }else{
  6351. domStyle.set(this.containerNode, {
  6352. width:"auto",
  6353. height:"auto"
  6354. });
  6355. }
  6356. var bb = domGeometry.position(this.domNode);
  6357. var viewport = winUtils.getBox();
  6358. if(bb.w >= viewport.w || bb.h >= viewport.h){
  6359. // Reduce size of dialog contents so that dialog fits in viewport
  6360. var w = Math.min(bb.w, Math.floor(viewport.w * 0.75)),
  6361. h = Math.min(bb.h, Math.floor(viewport.h * 0.75));
  6362. if(this._singleChild && this._singleChild.resize){
  6363. this._singleChildOriginalStyle = this._singleChild.domNode.style.cssText;
  6364. this._singleChild.resize({w: w, h: h});
  6365. }else{
  6366. domStyle.set(this.containerNode, {
  6367. width: w + "px",
  6368. height: h + "px",
  6369. overflow: "auto",
  6370. position: "relative" // workaround IE bug moving scrollbar or dragging dialog
  6371. });
  6372. }
  6373. }else{
  6374. if(this._singleChild && this._singleChild.resize){
  6375. this._singleChild.resize();
  6376. }
  6377. }
  6378. },
  6379. _position: function(){
  6380. // summary:
  6381. // Position modal dialog in the viewport. If no relative offset
  6382. // in the viewport has been determined (by dragging, for instance),
  6383. // center the node. Otherwise, use the Dialog's stored relative offset,
  6384. // and position the node to top: left: values based on the viewport.
  6385. if(!domClass.contains(win.body(), "dojoMove")){ // don't do anything if called during auto-scroll
  6386. var node = this.domNode,
  6387. viewport = winUtils.getBox(),
  6388. p = this._relativePosition,
  6389. bb = p ? null : domGeometry.position(node),
  6390. l = Math.floor(viewport.l + (p ? p.x : (viewport.w - bb.w) / 2)),
  6391. t = Math.floor(viewport.t + (p ? p.y : (viewport.h - bb.h) / 2))
  6392. ;
  6393. domStyle.set(node,{
  6394. left: l + "px",
  6395. top: t + "px"
  6396. });
  6397. }
  6398. },
  6399. _onKey: function(/*Event*/ evt){
  6400. // summary:
  6401. // Handles the keyboard events for accessibility reasons
  6402. // tags:
  6403. // private
  6404. if(evt.charOrCode){
  6405. var node = evt.target;
  6406. if(evt.charOrCode === keys.TAB){
  6407. this._getFocusItems(this.domNode);
  6408. }
  6409. var singleFocusItem = (this._firstFocusItem == this._lastFocusItem);
  6410. // see if we are shift-tabbing from first focusable item on dialog
  6411. if(node == this._firstFocusItem && evt.shiftKey && evt.charOrCode === keys.TAB){
  6412. if(!singleFocusItem){
  6413. focus.focus(this._lastFocusItem); // send focus to last item in dialog
  6414. }
  6415. event.stop(evt);
  6416. }else if(node == this._lastFocusItem && evt.charOrCode === keys.TAB && !evt.shiftKey){
  6417. if(!singleFocusItem){
  6418. focus.focus(this._firstFocusItem); // send focus to first item in dialog
  6419. }
  6420. event.stop(evt);
  6421. }else{
  6422. // see if the key is for the dialog
  6423. while(node){
  6424. if(node == this.domNode || domClass.contains(node, "dijitPopup")){
  6425. if(evt.charOrCode == keys.ESCAPE){
  6426. this.onCancel();
  6427. }else{
  6428. return; // just let it go
  6429. }
  6430. }
  6431. node = node.parentNode;
  6432. }
  6433. // this key is for the disabled document window
  6434. if(evt.charOrCode !== keys.TAB){ // allow tabbing into the dialog for a11y
  6435. event.stop(evt);
  6436. // opera won't tab to a div
  6437. }else if(!has("opera")){
  6438. try{
  6439. this._firstFocusItem.focus();
  6440. }catch(e){ /*squelch*/ }
  6441. }
  6442. }
  6443. }
  6444. },
  6445. show: function(){
  6446. // summary:
  6447. // Display the dialog
  6448. // returns: dojo.Deferred
  6449. // Deferred object that resolves when the display animation is complete
  6450. if(this.open){ return; }
  6451. if(!this._started){
  6452. this.startup();
  6453. }
  6454. // first time we show the dialog, there's some initialization stuff to do
  6455. if(!this._alreadyInitialized){
  6456. this._setup();
  6457. this._alreadyInitialized=true;
  6458. }
  6459. if(this._fadeOutDeferred){
  6460. // There's a hide() operation in progress, so cancel it, but still call DialogLevelManager.hide()
  6461. // as though the hide() completed, in preparation for the DialogLevelManager.show() call below.
  6462. this._fadeOutDeferred.cancel();
  6463. DialogLevelManager.hide(this);
  6464. }
  6465. if(!has("touch")){
  6466. // If the user scrolls the display or resizes the viewport then reposition the Dialog. But don't do it
  6467. // for touch devices, because it will counteract when a keyboard pops up and then the browser
  6468. // auto-scrolls the focused node into view.
  6469. this._modalconnects.push(on(window, "scroll", lang.hitch(this, "layout")));
  6470. this._modalconnects.push(on(window, "resize", lang.hitch(this, function(){
  6471. // IE gives spurious resize events and can actually get stuck
  6472. // in an infinite loop if we don't ignore them
  6473. var viewport = winUtils.getBox();
  6474. if(!this._oldViewport ||
  6475. viewport.h != this._oldViewport.h ||
  6476. viewport.w != this._oldViewport.w){
  6477. this.layout();
  6478. this._oldViewport = viewport;
  6479. }
  6480. })));
  6481. }
  6482. this._modalconnects.push(on(this.domNode, connect._keypress, lang.hitch(this, "_onKey")));
  6483. domStyle.set(this.domNode, {
  6484. opacity:0,
  6485. display:""
  6486. });
  6487. this._set("open", true);
  6488. this._onShow(); // lazy load trigger
  6489. this._size();
  6490. this._position();
  6491. // fade-in Animation object, setup below
  6492. var fadeIn;
  6493. this._fadeInDeferred = new Deferred(lang.hitch(this, function(){
  6494. fadeIn.stop();
  6495. delete this._fadeInDeferred;
  6496. }));
  6497. fadeIn = fx.fadeIn({
  6498. node: this.domNode,
  6499. duration: this.duration,
  6500. beforeBegin: lang.hitch(this, function(){
  6501. DialogLevelManager.show(this, this.underlayAttrs);
  6502. }),
  6503. onEnd: lang.hitch(this, function(){
  6504. if(this.autofocus && DialogLevelManager.isTop(this)){
  6505. // find focusable items each time dialog is shown since if dialog contains a widget the
  6506. // first focusable items can change
  6507. this._getFocusItems(this.domNode);
  6508. focus.focus(this._firstFocusItem);
  6509. }
  6510. this._fadeInDeferred.callback(true);
  6511. delete this._fadeInDeferred;
  6512. })
  6513. }).play();
  6514. return this._fadeInDeferred;
  6515. },
  6516. hide: function(){
  6517. // summary:
  6518. // Hide the dialog
  6519. // returns: dojo.Deferred
  6520. // Deferred object that resolves when the hide animation is complete
  6521. // If we haven't been initialized yet then we aren't showing and we can just return.
  6522. // Likewise if we are already hidden, or are currently fading out.
  6523. if(!this._alreadyInitialized || !this.open){
  6524. return;
  6525. }
  6526. if(this._fadeInDeferred){
  6527. this._fadeInDeferred.cancel();
  6528. }
  6529. // fade-in Animation object, setup below
  6530. var fadeOut;
  6531. this._fadeOutDeferred = new Deferred(lang.hitch(this, function(){
  6532. fadeOut.stop();
  6533. delete this._fadeOutDeferred;
  6534. }));
  6535. // fire onHide when the promise resolves.
  6536. this._fadeOutDeferred.then(lang.hitch(this, 'onHide'));
  6537. fadeOut = fx.fadeOut({
  6538. node: this.domNode,
  6539. duration: this.duration,
  6540. onEnd: lang.hitch(this, function(){
  6541. this.domNode.style.display = "none";
  6542. DialogLevelManager.hide(this);
  6543. this._fadeOutDeferred.callback(true);
  6544. delete this._fadeOutDeferred;
  6545. })
  6546. }).play();
  6547. if(this._scrollConnected){
  6548. this._scrollConnected = false;
  6549. }
  6550. var h;
  6551. while(h = this._modalconnects.pop()){
  6552. h.remove();
  6553. }
  6554. if(this._relativePosition){
  6555. delete this._relativePosition;
  6556. }
  6557. this._set("open", false);
  6558. return this._fadeOutDeferred;
  6559. },
  6560. layout: function(){
  6561. // summary:
  6562. // Position the Dialog and the underlay
  6563. // tags:
  6564. // private
  6565. if(this.domNode.style.display != "none"){
  6566. if(dijit._underlay){ // avoid race condition during show()
  6567. dijit._underlay.layout();
  6568. }
  6569. this._position();
  6570. }
  6571. },
  6572. destroy: function(){
  6573. if(this._fadeInDeferred){
  6574. this._fadeInDeferred.cancel();
  6575. }
  6576. if(this._fadeOutDeferred){
  6577. this._fadeOutDeferred.cancel();
  6578. }
  6579. if(this._moveable){
  6580. this._moveable.destroy();
  6581. }
  6582. var h;
  6583. while(h = this._modalconnects.pop()){
  6584. h.remove();
  6585. }
  6586. DialogLevelManager.hide(this);
  6587. this.inherited(arguments);
  6588. }
  6589. });
  6590. var Dialog = declare("dijit.Dialog", [ContentPane, _DialogBase], {});
  6591. Dialog._DialogBase = _DialogBase; // for monkey patching
  6592. var DialogLevelManager = Dialog._DialogLevelManager = {
  6593. // summary:
  6594. // Controls the various active "levels" on the page, starting with the
  6595. // stuff initially visible on the page (at z-index 0), and then having an entry for
  6596. // each Dialog shown.
  6597. _beginZIndex: 950,
  6598. show: function(/*dijit._Widget*/ dialog, /*Object*/ underlayAttrs){
  6599. // summary:
  6600. // Call right before fade-in animation for new dialog.
  6601. // Saves current focus, displays/adjusts underlay for new dialog,
  6602. // and sets the z-index of the dialog itself.
  6603. //
  6604. // New dialog will be displayed on top of all currently displayed dialogs.
  6605. //
  6606. // Caller is responsible for setting focus in new dialog after the fade-in
  6607. // animation completes.
  6608. // Save current focus
  6609. ds[ds.length-1].focus = focus.curNode;
  6610. // Display the underlay, or if already displayed then adjust for this new dialog
  6611. var underlay = dijit._underlay;
  6612. if(!underlay || underlay._destroyed){
  6613. underlay = dijit._underlay = new DialogUnderlay(underlayAttrs);
  6614. }else{
  6615. underlay.set(dialog.underlayAttrs);
  6616. }
  6617. // Set z-index a bit above previous dialog
  6618. var zIndex = ds[ds.length-1].dialog ? ds[ds.length-1].zIndex + 2 : Dialog._DialogLevelManager._beginZIndex;
  6619. if(ds.length == 1){ // first dialog
  6620. underlay.show();
  6621. }
  6622. domStyle.set(dijit._underlay.domNode, 'zIndex', zIndex - 1);
  6623. // Dialog
  6624. domStyle.set(dialog.domNode, 'zIndex', zIndex);
  6625. ds.push({dialog: dialog, underlayAttrs: underlayAttrs, zIndex: zIndex});
  6626. },
  6627. hide: function(/*dijit._Widget*/ dialog){
  6628. // summary:
  6629. // Called when the specified dialog is hidden/destroyed, after the fade-out
  6630. // animation ends, in order to reset page focus, fix the underlay, etc.
  6631. // If the specified dialog isn't open then does nothing.
  6632. //
  6633. // Caller is responsible for either setting display:none on the dialog domNode,
  6634. // or calling dijit.popup.hide(), or removing it from the page DOM.
  6635. if(ds[ds.length-1].dialog == dialog){
  6636. // Removing the top (or only) dialog in the stack, return focus
  6637. // to previous dialog
  6638. ds.pop();
  6639. var pd = ds[ds.length-1]; // the new active dialog (or the base page itself)
  6640. // Adjust underlay
  6641. if(ds.length == 1){
  6642. // Returning to original page.
  6643. // Hide the underlay, unless the underlay widget has already been destroyed
  6644. // because we are being called during page unload (when all widgets are destroyed)
  6645. if(!dijit._underlay._destroyed){
  6646. dijit._underlay.hide();
  6647. }
  6648. }else{
  6649. // Popping back to previous dialog, adjust underlay
  6650. domStyle.set(dijit._underlay.domNode, 'zIndex', pd.zIndex - 1);
  6651. dijit._underlay.set(pd.underlayAttrs);
  6652. }
  6653. // Adjust focus
  6654. if(dialog.refocus){
  6655. // If we are returning control to a previous dialog but for some reason
  6656. // that dialog didn't have a focused field, set focus to first focusable item.
  6657. // This situation could happen if two dialogs appeared at nearly the same time,
  6658. // since a dialog doesn't set it's focus until the fade-in is finished.
  6659. var focus = pd.focus;
  6660. if(pd.dialog && (!focus || !dom.isDescendant(focus, pd.dialog.domNode))){
  6661. pd.dialog._getFocusItems(pd.dialog.domNode);
  6662. focus = pd.dialog._firstFocusItem;
  6663. }
  6664. if(focus){
  6665. // Refocus the button that spawned the Dialog. This will fail in corner cases including
  6666. // page unload on IE, because the dijit/form/Button that launched the Dialog may get destroyed
  6667. // before this code runs. (#15058)
  6668. try{
  6669. focus.focus();
  6670. }catch(e){}
  6671. }
  6672. }
  6673. }else{
  6674. // Removing a dialog out of order (#9944, #10705).
  6675. // Don't need to mess with underlay or z-index or anything.
  6676. var idx = array.indexOf(array.map(ds, function(elem){return elem.dialog}), dialog);
  6677. if(idx != -1){
  6678. ds.splice(idx, 1);
  6679. }
  6680. }
  6681. },
  6682. isTop: function(/*dijit._Widget*/ dialog){
  6683. // summary:
  6684. // Returns true if specified Dialog is the top in the task
  6685. return ds[ds.length-1].dialog == dialog;
  6686. }
  6687. };
  6688. // Stack representing the various active "levels" on the page, starting with the
  6689. // stuff initially visible on the page (at z-index 0), and then having an entry for
  6690. // each Dialog shown.
  6691. // Each element in stack has form {
  6692. // dialog: dialogWidget,
  6693. // focus: returnFromGetFocus(),
  6694. // underlayAttrs: attributes to set on underlay (when this widget is active)
  6695. // }
  6696. var ds = Dialog._dialogStack = [
  6697. {dialog: null, focus: null, underlayAttrs: null} // entry for stuff at z-index: 0
  6698. ];
  6699. // Back compat w/1.6, remove for 2.0
  6700. if(!kernel.isAsync){
  6701. ready(0, function(){
  6702. var requires = ["dijit/TooltipDialog"];
  6703. require(requires); // use indirection so modules not rolled into a build
  6704. });
  6705. }
  6706. return Dialog;
  6707. });
  6708. },
  6709. 'url:dojox/widget/ColorPicker/ColorPicker.html':"<table class=\"dojoxColorPicker\" dojoAttachEvent=\"onkeypress: _handleKey\" cellpadding=\"0\" cellspacing=\"0\">\n\t<tr>\n\t\t<td valign=\"top\" class=\"dojoxColorPickerRightPad\">\n\t\t\t<div class=\"dojoxColorPickerBox\">\n\t\t\t\t<!-- Forcing ABS in style attr due to dojo DND issue with not picking it up form the class. -->\n\t\t\t\t<img role=\"status\" title=\"${saturationPickerTitle}\" alt=\"${saturationPickerTitle}\" class=\"dojoxColorPickerPoint\" src=\"${_pickerPointer}\" tabIndex=\"0\" dojoAttachPoint=\"cursorNode\" style=\"position: absolute; top: 0px; left: 0px;\">\n\t\t\t\t<img role=\"presentation\" alt=\"\" dojoAttachPoint=\"colorUnderlay\" dojoAttachEvent=\"onclick: _setPoint, onmousedown: _stopDrag\" class=\"dojoxColorPickerUnderlay\" src=\"${_underlay}\" ondragstart=\"return false\">\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign=\"top\" class=\"dojoxColorPickerRightPad\">\n\t\t\t<div class=\"dojoxHuePicker\">\n\t\t\t\t<!-- Forcing ABS in style attr due to dojo DND issue with not picking it up form the class. -->\n\t\t\t\t<img role=\"status\" dojoAttachPoint=\"hueCursorNode\" tabIndex=\"0\" class=\"dojoxHuePickerPoint\" title=\"${huePickerTitle}\" alt=\"${huePickerTitle}\" src=\"${_huePickerPointer}\" style=\"position: absolute; top: 0px; left: 0px;\">\n\t\t\t\t<div class=\"dojoxHuePickerUnderlay\" dojoAttachPoint=\"hueNode\">\n\t\t\t\t <img role=\"presentation\" alt=\"\" dojoAttachEvent=\"onclick: _setHuePoint, onmousedown: _stopDrag\" src=\"${_hueUnderlay}\">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign=\"top\">\n\t\t\t<table cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign=\"top\" class=\"dojoxColorPickerPreviewContainer\">\n\t\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td valign=\"top\" class=\"dojoxColorPickerRightPad\">\n\t\t\t\t\t\t\t\t\t<div dojoAttachPoint=\"previewNode\" class=\"dojoxColorPickerPreview\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\t\t<div dojoAttachPoint=\"safePreviewNode\" class=\"dojoxColorPickerWebSafePreview\"></div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign=\"bottom\">\n\t\t\t\t\t\t<table class=\"dojoxColorPickerOptional\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<div class=\"dijitInline dojoxColorPickerRgb\" dojoAttachPoint=\"rgbNode\">\n\t\t\t\t\t\t\t\t\t\t<table cellpadding=\"1\" cellspacing=\"1\">\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_r\">${redLabel}</label></td><td><input id=\"${_uId}_r\" dojoAttachPoint=\"Rval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"></td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_g\">${greenLabel}</label></td><td><input id=\"${_uId}_g\" dojoAttachPoint=\"Gval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"></td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_b\">${blueLabel}</label></td><td><input id=\"${_uId}_b\" dojoAttachPoint=\"Bval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"></td></tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<div class=\"dijitInline dojoxColorPickerHsv\" dojoAttachPoint=\"hsvNode\">\n\t\t\t\t\t\t\t\t\t\t<table cellpadding=\"1\" cellspacing=\"1\">\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_h\">${hueLabel}</label></td><td><input id=\"${_uId}_h\" dojoAttachPoint=\"Hval\"size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"> ${degLabel}</td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_s\">${saturationLabel}</label></td><td><input id=\"${_uId}_s\" dojoAttachPoint=\"Sval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"> ${percentSign}</td></tr>\n\t\t\t\t\t\t\t\t\t\t<tr><td><label for=\"${_uId}_v\">${valueLabel}</label></td><td><input id=\"${_uId}_v\" dojoAttachPoint=\"Vval\" size=\"1\" dojoAttachEvent=\"onchange: _colorInputChange\"> ${percentSign}</td></tr>\n\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t\t\t<div class=\"dojoxColorPickerHex\" dojoAttachPoint=\"hexNode\" aria-live=\"polite\">\t\n\t\t\t\t\t\t\t\t\t\t<label for=\"${_uId}_hex\">&nbsp;${hexLabel}&nbsp;</label><input id=\"${_uId}_hex\" dojoAttachPoint=\"hexCode, focusNode, valueNode\" size=\"6\" class=\"dojoxColorPickerHexCode\" dojoAttachEvent=\"onchange: _colorInputChange\">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n</table>\n\n",
  6710. 'url:dijit/form/templates/Select.html':"<table class=\"dijit dijitReset dijitInline dijitLeft\"\n\tdata-dojo-attach-point=\"_buttonNode,tableNode,focusNode\" cellspacing='0' cellpadding='0'\n\trole=\"combobox\" aria-haspopup=\"true\"\n\t><tbody role=\"presentation\"><tr role=\"presentation\"\n\t\t><td class=\"dijitReset dijitStretch dijitButtonContents dijitButtonNode\" role=\"presentation\"\n\t\t\t><span class=\"dijitReset dijitInline dijitButtonText\" data-dojo-attach-point=\"containerNode,_popupStateNode\"></span\n\t\t\t><input type=\"hidden\" ${!nameAttrSetting} data-dojo-attach-point=\"valueNode\" value=\"${value}\" aria-hidden=\"true\"\n\t\t/></td><td class=\"dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton\"\n\t\t\t\tdata-dojo-attach-point=\"titleNode\" role=\"presentation\"\n\t\t\t><div class=\"dijitReset dijitArrowButtonInner\" role=\"presentation\"></div\n\t\t\t><div class=\"dijitReset dijitArrowButtonChar\" role=\"presentation\">&#9660;</div\n\t\t></td\n\t></tr></tbody\n></table>\n",
  6711. '*now':function(r){r(['dojo/i18n!*preload*dojo/nls/buxDialogs*["ar","az","bg","ca","cs","da","de","de-de","el","en","en-ca","en-gb","en-us","es","es-es","fi","fi-fi","fr","fr-ca","fr-fr","he","he-il","hr","hu","it","it-it","ja","ja-jp","kk","ko","ko-kr","nl","nl-nl","nb","no","pl","pt","pt-br","pt-pt","ro","ru","sk","sl","sv","th","tr","zh","zh-tw","zh-cn","ROOT"]']);}
  6712. }});
  6713. define("dojo/buxDialogs", [], 1);