jqgrid.js 509 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099
  1. (function (b) {
  2. b.jgrid = b.jgrid || {};
  3. b.extend(b.jgrid, {
  4. version: "4.6.0",
  5. htmlDecode: function (b) {
  6. return b && ("&nbsp;" === b || "&#160;" === b || 1 === b.length && 160 === b.charCodeAt(0)) ? "" : b ? String(b).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&") : b
  7. },
  8. htmlEncode: function (b) {
  9. return b ? String(b).replace(/&/g, "&amp;").replace(/\"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : b
  10. },
  11. format: function (e) {
  12. var f = b.makeArray(arguments).slice(1);
  13. null == e && (e = "");
  14. return e.replace(/\{(\d+)\}/g,
  15. function (b, d) {
  16. return f[d]
  17. })
  18. },
  19. msie: "Microsoft Internet Explorer" === navigator.appName,
  20. msiever: function () {
  21. var b = -1;
  22. null != /MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent) && (b = parseFloat(RegExp.$1));
  23. return b
  24. },
  25. getCellIndex: function (e) {
  26. e = b(e);
  27. if (e.is("tr")) return -1;
  28. e = (e.is("td") || e.is("th") ? e : e.closest("td,th"))[0];
  29. return b.jgrid.msie ? b.inArray(e, e.parentNode.cells) : e.cellIndex
  30. },
  31. stripHtml: function (b) {
  32. b = String(b);
  33. var f = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
  34. return b ? (b = b.replace(f, "")) && "&nbsp;" !== b && "&#160;" !== b ? b.replace(/\"/g, "'") : "" : b
  35. },
  36. stripPref: function (e, f) {
  37. var c = b.type(e);
  38. if ("string" === c || "number" === c) e = String(e),
  39. f = "" !== e ? String(f).replace(String(e), "") : f;
  40. return f
  41. },
  42. parse: function (e) {
  43. "while(1);" === e.substr(0, 9) && (e = e.substr(9));
  44. "/*" === e.substr(0, 2) && (e = e.substr(2, e.length - 4));
  45. e || (e = "{}");
  46. return !0 === b.jgrid.useJSON && "object" === typeof JSON && "function" === typeof JSON.parse ? JSON.parse(e) : eval("(" + e + ")")
  47. },
  48. parseDate: function (e, f, c, d) {
  49. var a = /^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,
  50. l = "string" === typeof f ? f.match(a) : null,
  51. a = function (a, b) {
  52. a = String(a);
  53. for (b = parseInt(b, 10) || 2; a.length < b;) a = "0" + a;
  54. return a
  55. },
  56. g = {
  57. m: 1,
  58. d: 1,
  59. y: 1970,
  60. h: 0,
  61. i: 0,
  62. s: 0,
  63. u: 0
  64. },
  65. h = 0,
  66. k,
  67. n,
  68. h = function (a, b) {
  69. 0 === a ? 12 === b && (b = 0) : 12 !== b && (b += 12);
  70. return b
  71. };
  72. void 0 === d && (d = b.jgrid.formatter.date);
  73. void 0 === d.parseRe && (d.parseRe = /[#%\\\/:_;.,\t\s-]/);
  74. d.masks.hasOwnProperty(e) && (e = d.masks[e]);
  75. if (f && null != f) if (isNaN(f - 0) || "u" !== String(e).toLowerCase()) if (f.constructor === Date) h = f;
  76. else if (null !== l) {
  77. if (h = new Date(parseInt(l[1], 10)), l[3]) {
  78. var m = 60 * Number(l[5]) + Number(l[6]),
  79. m = m * ("-" === l[4] ? 1 : -1),
  80. m = m - h.getTimezoneOffset();
  81. h.setTime(Number(Number(h) + 6E4 * m))
  82. }
  83. } else {
  84. m = 0;
  85. "ISO8601Long" === d.srcformat && "Z" === f.charAt(f.length - 1) && (m -= (new Date).getTimezoneOffset());
  86. f = String(f).replace(/\T/g, "#").replace(/\t/, "%").split(d.parseRe);
  87. e = e.replace(/\T/g, "#").replace(/\t/, "%").split(d.parseRe);
  88. k = 0;
  89. for (n = e.length; k < n; k++) "M" === e[k] && (l = b.inArray(f[k], d.monthNames), -1 !== l && 12 > l && (f[k] = l + 1, g.m = f[k])),
  90. "F" === e[k] && (l = b.inArray(f[k], d.monthNames, 12), -1 !== l && 11 < l && (f[k] = l + 1 - 12, g.m = f[k])),
  91. "a" === e[k] && (l = b.inArray(f[k], d.AmPm), -1 !== l && 2 > l && f[k] === d.AmPm[l] && (f[k] = l, g.h = h(f[k], g.h))),
  92. "A" === e[k] && (l = b.inArray(f[k], d.AmPm), -1 !== l && 1 < l && f[k] === d.AmPm[l] && (f[k] = l - 2, g.h = h(f[k], g.h))),
  93. "g" === e[k] && (g.h = parseInt(f[k], 10)),
  94. void 0 !== f[k] && (g[e[k].toLowerCase()] = parseInt(f[k], 10));
  95. g.f && (g.m = g.f);
  96. if (0 === g.m && 0 === g.y && 0 === g.d) return "&#160;";
  97. g.m = parseInt(g.m, 10) - 1;
  98. h = g.y;
  99. 70 <= h && 99 >= h ? g.y = 1900 + g.y : 0 <= h && 69 >= h && (g.y = 2E3 + g.y);
  100. h = new Date(g.y, g.m, g.d, g.h, g.i, g.s, g.u);
  101. 0 < m && h.setTime(Number(Number(h) + 6E4 * m))
  102. } else h = new Date(1E3 * parseFloat(f));
  103. else h = new Date(g.y, g.m, g.d, g.h, g.i, g.s, g.u);
  104. if (void 0 === c) return h;
  105. d.masks.hasOwnProperty(c) ? c = d.masks[c] : c || (c = "Y-m-d");
  106. e = h.getHours();
  107. f = h.getMinutes();
  108. g = h.getDate();
  109. m = h.getMonth() + 1;
  110. l = h.getTimezoneOffset();
  111. k = h.getSeconds();
  112. n = h.getMilliseconds();
  113. var r = h.getDay(),
  114. p = h.getFullYear(),
  115. q = (r + 6) % 7 + 1,
  116. x = (new Date(p, m - 1, g) - new Date(p, 0, 1)) / 864E5,
  117. G = {
  118. d: a(g),
  119. D: d.dayNames[r],
  120. j: g,
  121. l: d.dayNames[r + 7],
  122. N: q,
  123. S: d.S(g),
  124. w: r,
  125. z: x,
  126. W: 5 > q ? Math.floor((x + q - 1) / 7) + 1 : Math.floor((x + q - 1) / 7) || (4 > ((new Date(p - 1, 0, 1)).getDay() + 6) % 7 ? 53 : 52),
  127. F: d.monthNames[m - 1 + 12],
  128. m: a(m),
  129. M: d.monthNames[m - 1],
  130. n: m,
  131. t: "?",
  132. L: "?",
  133. o: "?",
  134. Y: p,
  135. y: String(p).substring(2),
  136. a: 12 > e ? d.AmPm[0] : d.AmPm[1],
  137. A: 12 > e ? d.AmPm[2] : d.AmPm[3],
  138. B: "?",
  139. g: e % 12 || 12,
  140. G: e,
  141. h: a(e % 12 || 12),
  142. H: a(e),
  143. i: a(f),
  144. s: a(k),
  145. u: n,
  146. e: "?",
  147. I: "?",
  148. O: (0 < l ? "-" : "+") + a(100 * Math.floor(Math.abs(l) / 60) + Math.abs(l) % 60, 4),
  149. P: "?",
  150. T: (String(h).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g) || [""]).pop().replace(/[^-+\dA-Z]/g, ""),
  151. Z: "?",
  152. c: "?",
  153. r: "?",
  154. U: Math.floor(h / 1E3)
  155. };
  156. return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
  157. function (a) {
  158. return G.hasOwnProperty(a) ? G[a] : a.substring(1)
  159. })
  160. },
  161. jqID: function (b) {
  162. return String(b).replace(/[!"#$%&'()*+,.\/:; <=>?@\[\\\]\^`{|}~]/g, "\\$&")
  163. },
  164. guid: 1,
  165. uidPref: "jqg",
  166. randId: function (e) {
  167. return (e || b.jgrid.uidPref) + b.jgrid.guid++
  168. },
  169. getAccessor: function (b, f) {
  170. var c, d, a = [],
  171. l;
  172. if ("function" === typeof f) return f(b);
  173. c = b[f];
  174. if (void 0 === c) try {
  175. if ("string" === typeof f && (a = f.split(".")), l = a.length) for (c = b; c && l--;) d = a.shift(),
  176. c = c[d]
  177. } catch (g) { }
  178. return c
  179. },
  180. getXmlData: function (e, f, c) {
  181. var d = "string" === typeof f ? f.match(/^(.*)\[(\w+)\]$/) : null;
  182. if ("function" === typeof f) return f(e);
  183. if (d && d[2]) return d[1] ? b(d[1], e).attr(d[2]) : b(e).attr(d[2]);
  184. e = b(f, e);
  185. return c ? e : 0 < e.length ? b(e).text() : void 0
  186. },
  187. cellWidth: function () {
  188. var e = b("<div class='ui-jqgrid' style='left:10000px'><table class='ui-jqgrid-btable' style='width:5px;'><tr class='jqgrow'><td style='width:5px;display:block;'></td></tr></table></div>"),
  189. f = e.appendTo("body").find("td").width();
  190. e.remove();
  191. return 0.1 < Math.abs(f - 5)
  192. },
  193. cell_width: !0,
  194. ajaxOptions: {},
  195. from: function (e) {
  196. return new
  197. function (e, c) {
  198. "string" === typeof e && (e = b.data(e));
  199. var d = this,
  200. a = e,
  201. l = !0,
  202. g = !1,
  203. h = c,
  204. k = /[\$,%]/g,
  205. n = null,
  206. m = null,
  207. r = 0,
  208. p = !1,
  209. q = "",
  210. x = [],
  211. G = !0;
  212. if ("object" === typeof e && e.push) 0 < e.length && (G = "object" !== typeof e[0] ? !1 : !0);
  213. else throw "data provides is not an array";
  214. this._hasData = function () {
  215. return null === a ? !1 : 0 === a.length ? !1 : !0
  216. };
  217. this._getStr = function (a) {
  218. var b = [];
  219. g && b.push("jQuery.trim(");
  220. b.push("String(" + a + ")");
  221. g && b.push(")");
  222. l || b.push(".toLowerCase()");
  223. return b.join("")
  224. };
  225. this._strComp = function (a) {
  226. return "string" === typeof a ? ".toString()" : ""
  227. };
  228. this._group = function (a, b) {
  229. return {
  230. field: a.toString(),
  231. unique: b,
  232. items: []
  233. }
  234. };
  235. this._toStr = function (a) {
  236. g && (a = b.trim(a));
  237. a = a.toString().replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
  238. return l ? a : a.toLowerCase()
  239. };
  240. this._funcLoop = function (d) {
  241. var l = [];
  242. b.each(a,
  243. function (a, b) {
  244. l.push(d(b))
  245. });
  246. return l
  247. };
  248. this._append = function (a) {
  249. var b;
  250. h = null === h ? "" : h + ("" === q ? " && " : q);
  251. for (b = 0; b < r; b++) h += "(";
  252. p && (h += "!");
  253. h += "(" + a + ")";
  254. p = !1;
  255. q = "";
  256. r = 0
  257. };
  258. this._setCommand = function (a, b) {
  259. n = a;
  260. m = b
  261. };
  262. this._resetNegate = function () {
  263. p = !1
  264. };
  265. this._repeatCommand = function (a, b) {
  266. return null === n ? d : null !== a && null !== b ? n(a, b) : null !== m && G ? n(m, a) : n(a)
  267. };
  268. this._equals = function (a, b) {
  269. return 0 === d._compare(a, b, 1)
  270. };
  271. this._compare = function (a, b, d) {
  272. var e = Object.prototype.toString;
  273. void 0 === d && (d = 1);
  274. void 0 === a && (a = null);
  275. void 0 === b && (b = null);
  276. if (null === a && null === b) return 0;
  277. if (null === a && null !== b) return 1;
  278. if (null !== a && null === b) return -1;
  279. if ("[object Date]" === e.call(a) && "[object Date]" === e.call(b)) return a < b ? -d : a > b ? d : 0;
  280. l || "number" === typeof a || "number" === typeof b || (a = String(a), b = String(b));
  281. return a < b ? -d : a > b ? d : 0
  282. };
  283. this._performSort = function () {
  284. 0 !== x.length && (a = d._doSort(a, 0))
  285. };
  286. this._doSort = function (a, b) {
  287. var l = x[b].by,
  288. e = x[b].dir,
  289. g = x[b].type,
  290. c = x[b].datefmt,
  291. f = x[b].sfunc;
  292. if (b === x.length - 1) return d._getOrder(a, l, e, g, c, f);
  293. b++;
  294. l = d._getGroup(a, l, e, g, c);
  295. e = [];
  296. for (g = 0; g < l.length; g++) for (f = d._doSort(l[g].items, b), c = 0; c < f.length; c++) e.push(f[c]);
  297. return e
  298. };
  299. this._getOrder = function (a, e, g, c, f, h) {
  300. var m = [],
  301. n = [],
  302. r = "a" === g ? 1 : -1,
  303. p,
  304. x;
  305. void 0 === c && (c = "text");
  306. x = "float" === c || "number" === c || "currency" === c || "numeric" === c ?
  307. function (a) {
  308. a = parseFloat(String(a).replace(k, ""));
  309. return isNaN(a) ? 0 : a
  310. } : "int" === c || "integer" === c ?
  311. function (a) {
  312. return a ? parseFloat(String(a).replace(k, "")) : 0
  313. } : "date" === c || "datetime" === c ?
  314. function (a) {
  315. return b.jgrid.parseDate(f, a).getTime()
  316. } : b.isFunction(c) ? c : function (a) {
  317. a = a ? b.trim(String(a)) : "";
  318. return l ? a : a.toLowerCase()
  319. };
  320. b.each(a,
  321. function (a, d) {
  322. p = "" !== e ? b.jgrid.getAccessor(d, e) : d;
  323. void 0 === p && (p = "");
  324. p = x(p, d);
  325. n.push({
  326. vSort: p,
  327. index: a
  328. })
  329. });
  330. b.isFunction(h) ? n.sort(function (a, b) {
  331. a = a.vSort;
  332. b = b.vSort;
  333. return h.call(this, a, b, r)
  334. }) : n.sort(function (a, b) {
  335. a = a.vSort;
  336. b = b.vSort;
  337. return d._compare(a, b, r)
  338. });
  339. c = 0;
  340. for (var q = a.length; c < q;) g = n[c].index,
  341. m.push(a[g]),
  342. c++;
  343. return m
  344. };
  345. this._getGroup = function (a, c, e, l, g) {
  346. var f = [],
  347. h = null,
  348. k = null,
  349. m;
  350. b.each(d._getOrder(a, c, e, l, g),
  351. function (a, e) {
  352. m = b.jgrid.getAccessor(e, c);
  353. null == m && (m = "");
  354. d._equals(k, m) || (k = m, null !== h && f.push(h), h = d._group(c, m));
  355. h.items.push(e)
  356. });
  357. null !== h && f.push(h);
  358. return f
  359. };
  360. this.ignoreCase = function () {
  361. l = !1;
  362. return d
  363. };
  364. this.useCase = function () {
  365. l = !0;
  366. return d
  367. };
  368. this.trim = function () {
  369. g = !0;
  370. return d
  371. };
  372. this.noTrim = function () {
  373. g = !1;
  374. return d
  375. };
  376. this.execute = function () {
  377. var c = h,
  378. e = [];
  379. if (null === c) return d;
  380. b.each(a,
  381. function () {
  382. eval(c) && e.push(this)
  383. });
  384. a = e;
  385. return d
  386. };
  387. this.data = function () {
  388. return a
  389. };
  390. this.select = function (c) {
  391. d._performSort();
  392. if (!d._hasData()) return [];
  393. d.execute();
  394. if (b.isFunction(c)) {
  395. var e = [];
  396. b.each(a,
  397. function (a, b) {
  398. e.push(c(b))
  399. });
  400. return e
  401. }
  402. return a
  403. };
  404. this.hasMatch = function () {
  405. if (!d._hasData()) return !1;
  406. d.execute();
  407. return 0 < a.length
  408. };
  409. this.andNot = function (a, b, c) {
  410. p = !p;
  411. return d.and(a, b, c)
  412. };
  413. this.orNot = function (a, b, c) {
  414. p = !p;
  415. return d.or(a, b, c)
  416. };
  417. this.not = function (a, b, c) {
  418. return d.andNot(a, b, c)
  419. };
  420. this.and = function (a, b, c) {
  421. q = " && ";
  422. return void 0 === a ? d : d._repeatCommand(a, b, c)
  423. };
  424. this.or = function (a, b, c) {
  425. q = " || ";
  426. return void 0 === a ? d : d._repeatCommand(a, b, c)
  427. };
  428. this.orBegin = function () {
  429. r++;
  430. return d
  431. };
  432. this.orEnd = function () {
  433. null !== h && (h += ")");
  434. return d
  435. };
  436. this.isNot = function (a) {
  437. p = !p;
  438. return d.is(a)
  439. };
  440. this.is = function (a) {
  441. d._append("this." + a);
  442. d._resetNegate();
  443. return d
  444. };
  445. this._compareValues = function (a, c, e, l, g) {
  446. var f;
  447. f = G ? "jQuery.jgrid.getAccessor(this,'" + c + "')" : "this";
  448. void 0 === e && (e = null);
  449. var h = e,
  450. m = void 0 === g.stype ? "text" : g.stype;
  451. if (null !== e) switch (m) {
  452. case "int":
  453. case "integer":
  454. h = isNaN(Number(h)) || "" === h ? "0" : h;
  455. f = "parseInt(" + f + ",10)";
  456. h = "parseInt(" + h + ",10)";
  457. break;
  458. case "float":
  459. case "number":
  460. case "numeric":
  461. h = String(h).replace(k, "");
  462. h = isNaN(Number(h)) || "" === h ? "0" : h;
  463. f = "parseFloat(" + f + ")";
  464. h = "parseFloat(" + h + ")";
  465. break;
  466. case "date":
  467. case "datetime":
  468. h = String(b.jgrid.parseDate(g.newfmt || "Y-m-d", h).getTime());
  469. f = 'jQuery.jgrid.parseDate("' + g.srcfmt + '",' + f + ").getTime()";
  470. break;
  471. default:
  472. f = d._getStr(f),
  473. h = d._getStr('"' + d._toStr(h) + '"')
  474. }
  475. d._append(f + " " + l + " " + h);
  476. d._setCommand(a, c);
  477. d._resetNegate();
  478. return d
  479. };
  480. this.equals = function (a, b, c) {
  481. return d._compareValues(d.equals, a, b, "==", c)
  482. };
  483. this.notEquals = function (a, b, c) {
  484. return d._compareValues(d.equals, a, b, "!==", c)
  485. };
  486. this.isNull = function (a, b, c) {
  487. return d._compareValues(d.equals, a, null, "===", c)
  488. };
  489. this.greater = function (a, b, c) {
  490. return d._compareValues(d.greater, a, b, ">", c)
  491. };
  492. this.less = function (a, b, c) {
  493. return d._compareValues(d.less, a, b, "<", c)
  494. };
  495. this.greaterOrEquals = function (a, b, c) {
  496. return d._compareValues(d.greaterOrEquals, a, b, ">=", c)
  497. };
  498. this.lessOrEquals = function (a, b, c) {
  499. return d._compareValues(d.lessOrEquals, a, b, "<=", c)
  500. };
  501. this.startsWith = function (a, c) {
  502. var e = null == c ? a : c,
  503. e = g ? b.trim(e.toString()).length : e.toString().length;
  504. G ? d._append(d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + ".substr(0," + e + ") == " + d._getStr('"' + d._toStr(c) + '"')) : (null != c && (e = g ? b.trim(c.toString()).length : c.toString().length), d._append(d._getStr("this") + ".substr(0," + e + ") == " + d._getStr('"' + d._toStr(a) + '"')));
  505. d._setCommand(d.startsWith, a);
  506. d._resetNegate();
  507. return d
  508. };
  509. this.endsWith = function (a, c) {
  510. var e = null == c ? a : c,
  511. e = g ? b.trim(e.toString()).length : e.toString().length;
  512. G ? d._append(d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + ".substr(" + d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + ".length-" + e + "," + e + ') == "' + d._toStr(c) + '"') : d._append(d._getStr("this") + ".substr(" + d._getStr("this") + '.length-"' + d._toStr(a) + '".length,"' + d._toStr(a) + '".length) == "' + d._toStr(a) + '"');
  513. d._setCommand(d.endsWith, a);
  514. d._resetNegate();
  515. return d
  516. };
  517. this.contains = function (a, b) {
  518. G ? d._append(d._getStr("jQuery.jgrid.getAccessor(this,'" + a + "')") + '.indexOf("' + d._toStr(b) + '",0) > -1') : d._append(d._getStr("this") + '.indexOf("' + d._toStr(a) + '",0) > -1');
  519. d._setCommand(d.contains, a);
  520. d._resetNegate();
  521. return d
  522. };
  523. this.groupBy = function (b, c, e, l) {
  524. return d._hasData() ? d._getGroup(a, b, c, e, l) : null
  525. };
  526. this.orderBy = function (a, c, e, l, g) {
  527. c = null == c ? "a" : b.trim(c.toString().toLowerCase());
  528. null == e && (e = "text");
  529. null == l && (l = "Y-m-d");
  530. null == g && (g = !1);
  531. if ("desc" === c || "descending" === c) c = "d";
  532. if ("asc" === c || "ascending" === c) c = "a";
  533. x.push({
  534. by: a,
  535. dir: c,
  536. type: e,
  537. datefmt: l,
  538. sfunc: g
  539. });
  540. return d
  541. };
  542. return d
  543. }(e, null)
  544. },
  545. getMethod: function (e) {
  546. return this.getAccessor(b.fn.jqGrid, e)
  547. },
  548. extend: function (e) {
  549. b.extend(b.fn.jqGrid, e);
  550. this.no_legacy_api || b.fn.extend(e)
  551. }
  552. });
  553. b.fn.jqGrid = function (e) {
  554. if ("string" === typeof e) {
  555. var f = b.jgrid.getMethod(e);
  556. if (!f) throw "jqGrid - No such method: " + e;
  557. var c = b.makeArray(arguments).slice(1);
  558. return f.apply(this, c)
  559. }
  560. return this.each(function () {
  561. if (!this.grid) {
  562. var d = b.extend(!0, {
  563. unwritten: true,
  564. costtime: '000.1',
  565. url: "",
  566. height: 150,
  567. page: 1,
  568. rowNum: 20,
  569. rowTotal: null,
  570. records: 0,
  571. pager: "",
  572. pgbuttons: !0,
  573. pginput: !0,
  574. colModel: [],
  575. rowList: [],
  576. colNames: [],
  577. sortorder: "asc",
  578. sortname: "",
  579. datatype: "xml",
  580. mtype: "GET",
  581. altRows: !1,
  582. selarrrow: [],
  583. savedRow: [],
  584. shrinkToFit: !0,
  585. xmlReader: {},
  586. jsonReader: {},
  587. subGrid: !1,
  588. subGridModel: [],
  589. reccount: 0,
  590. lastpage: 0,
  591. lastsort: 0,
  592. selrow: null,
  593. beforeSelectRow: null,
  594. onSelectRow: null,
  595. onSortCol: null,
  596. ondblClickRow: null,
  597. onRightClickRow: null,
  598. onPaging: null,
  599. onSelectAll: null,
  600. onInitGrid: null,
  601. loadComplete: null,
  602. gridComplete: null,
  603. loadError: null,
  604. loadBeforeSend: null,
  605. afterInsertRow: null,
  606. beforeRequest: null,
  607. beforeProcessing: null,
  608. onHeaderClick: null,
  609. viewrecords: !1,
  610. loadonce: !1,
  611. multiselect: !1,
  612. multikey: !1,
  613. editurl: null,
  614. search: !1,
  615. caption: "",
  616. hidegrid: !0,
  617. hiddengrid: !1,
  618. postData: {},
  619. userData: {},
  620. treeGrid: !1,
  621. treeGridModel: "nested",
  622. treeReader: {},
  623. treeANode: -1,
  624. ExpandColumn: null,
  625. tree_root_level: 0,
  626. prmNames: {
  627. page: "page",
  628. rows: "rows",
  629. sort: "sidx",
  630. order: "sord",
  631. search: "_search",
  632. nd: "nd",
  633. id: "id",
  634. oper: "oper",
  635. editoper: "edit",
  636. addoper: "add",
  637. deloper: "del",
  638. subgridid: "id",
  639. npage: null,
  640. totalrows: "totalrows"
  641. },
  642. forceFit: !1,
  643. gridstate: "visible",
  644. cellEdit: !1,
  645. cellsubmit: "remote",
  646. nv: 0,
  647. loadui: "enable",
  648. toolbar: [!1, ""],
  649. scroll: !1,
  650. multiboxonly: !1,
  651. deselectAfterSort: !0,
  652. scrollrows: !1,
  653. autowidth: !1,
  654. scrollOffset: 18,
  655. cellLayout: 5,
  656. subGridWidth: 20,
  657. multiselectWidth: 20,
  658. gridview: !1,
  659. rownumWidth: 30,
  660. rownumbers: !1,
  661. pagerpos: "center",
  662. recordpos: "right",
  663. footerrow: !1,
  664. userDataOnFooter: !1,
  665. hoverrows: !0,
  666. altclass: "ui-priority-secondary",
  667. viewsortcols: [!1, "vertical", !0],
  668. resizeclass: "",
  669. autoencode: !1,
  670. remapColumns: [],
  671. ajaxGridOptions: {},
  672. direction: "ltr",
  673. toppager: !1,
  674. headertitles: !1,
  675. scrollTimeout: 40,
  676. data: [],
  677. _index: {},
  678. grouping: !1,
  679. groupingView: {
  680. groupField: [],
  681. groupOrder: [],
  682. groupText: [],
  683. groupColumnShow: [],
  684. groupSummary: [],
  685. showSummaryOnHide: !1,
  686. sortitems: [],
  687. sortnames: [],
  688. summary: [],
  689. summaryval: [],
  690. plusicon: "ui-icon-circlesmall-plus",
  691. minusicon: "ui-icon-circlesmall-minus",
  692. displayField: [],
  693. groupSummaryPos: [],
  694. formatDisplayField: [],
  695. _locgr: !1
  696. },
  697. ignoreCase: !1,
  698. cmTemplate: {},
  699. idPrefix: "",
  700. multiSort: !1
  701. },
  702. b.jgrid.defaults, e || {}),
  703. a = this,
  704. c = {
  705. headers: [],
  706. cols: [],
  707. footers: [],
  708. dragStart: function (c, e, g) {
  709. var f = b(this.bDiv).offset().left;
  710. this.resizing = {
  711. idx: c,
  712. startX: e.clientX,
  713. sOL: e.clientX - f
  714. };
  715. this.hDiv.style.cursor = "col-resize";
  716. this.curGbox = b("#rs_m" + b.jgrid.jqID(d.id), "#gbox_" + b.jgrid.jqID(d.id));
  717. this.curGbox.css({
  718. display: "block",
  719. left: e.clientX - f,
  720. top: g[1],
  721. height: g[2]
  722. });
  723. b(a).triggerHandler("jqGridResizeStart", [e, c]);
  724. b.isFunction(d.resizeStart) && d.resizeStart.call(a, e, c);
  725. document.onselectstart = function () {
  726. return !1
  727. }
  728. },
  729. dragMove: function (a) {
  730. if (this.resizing) {
  731. var b = a.clientX - this.resizing.startX;
  732. a = this.headers[this.resizing.idx];
  733. var c = "ltr" === d.direction ? a.width + b : a.width - b,
  734. e;
  735. 33 < c && (this.curGbox.css({
  736. left: this.resizing.sOL + b
  737. }), !0 === d.forceFit ? (e = this.headers[this.resizing.idx + d.nv], b = "ltr" === d.direction ? e.width - b : e.width + b, 33 < b && (a.newWidth = c, e.newWidth = b)) : (this.newWidth = "ltr" === d.direction ? d.tblwidth + b : d.tblwidth - b, a.newWidth = c))
  738. }
  739. },
  740. dragEnd: function () {
  741. this.hDiv.style.cursor = "default";
  742. if (this.resizing) {
  743. var c = this.resizing.idx,
  744. e = this.headers[c].newWidth || this.headers[c].width,
  745. e = parseInt(e, 10);
  746. this.resizing = !1;
  747. b("#rs_m" + b.jgrid.jqID(d.id)).css("display", "none");
  748. d.colModel[c].width = e;
  749. this.headers[c].width = e;
  750. this.headers[c].el.style.width = e + "px";
  751. this.cols[c].style.width = e + "px";
  752. 0 < this.footers.length && (this.footers[c].style.width = e + "px"); !0 === d.forceFit ? (e = this.headers[c + d.nv].newWidth || this.headers[c + d.nv].width, this.headers[c + d.nv].width = e, this.headers[c + d.nv].el.style.width = e + "px", this.cols[c + d.nv].style.width = e + "px", 0 < this.footers.length && (this.footers[c + d.nv].style.width = e + "px"), d.colModel[c + d.nv].width = e) : (d.tblwidth = this.newWidth || d.tblwidth, b("table:first", this.bDiv).css("width", d.tblwidth + "px"), b("table:first", this.hDiv).css("width", d.tblwidth + "px"), this.hDiv.scrollLeft = this.bDiv.scrollLeft, d.footerrow && (b("table:first", this.sDiv).css("width", d.tblwidth + "px"), this.sDiv.scrollLeft = this.bDiv.scrollLeft));
  753. b(a).triggerHandler("jqGridResizeStop", [e, c]);
  754. b.isFunction(d.resizeStop) && d.resizeStop.call(a, e, c)
  755. }
  756. this.curGbox = null;
  757. document.onselectstart = function () {
  758. return !0
  759. }
  760. },
  761. populateVisible: function () {
  762. c.timer && clearTimeout(c.timer);
  763. c.timer = null;
  764. var a = b(c.bDiv).height();
  765. if (a) {
  766. var e = b("table:first", c.bDiv),
  767. g,
  768. f;
  769. if (e[0].rows.length) try {
  770. f = (g = e[0].rows[1]) ? b(g).outerHeight() || c.prevRowHeight : c.prevRowHeight
  771. } catch (pa) {
  772. f = c.prevRowHeight
  773. }
  774. if (f) {
  775. c.prevRowHeight = f;
  776. var h = d.rowNum;
  777. g = c.scrollTop = c.bDiv.scrollTop;
  778. var k = Math.round(e.position().top) - g,
  779. m = k + e.height();
  780. f *= h;
  781. var E, n, C;
  782. m < a && 0 >= k && (void 0 === d.lastpage || parseInt((m + g + f - 1) / f, 10) <= d.lastpage) && (n = parseInt((a - m + f - 1) / f, 10), 0 <= m || 2 > n || !0 === d.scroll ? (E = Math.round((m + g) / f) + 1, k = -1) : k = 1);
  783. 0 < k && (E = parseInt(g / f, 10) + 1, n = parseInt((g + a) / f, 10) + 2 - E, C = !0); !n || d.lastpage && (E > d.lastpage || 1 === d.lastpage || E === d.page && E === d.lastpage) || (c.hDiv.loading ? c.timer = setTimeout(c.populateVisible, d.scrollTimeout) : (d.page = E, C && (c.selectionPreserver(e[0]), c.emptyRows.call(e[0], !1, !1)), c.populate(n)))
  784. }
  785. }
  786. },
  787. scrollGrid: function (a) {
  788. if (d.scroll) {
  789. var b = c.bDiv.scrollTop;
  790. void 0 === c.scrollTop && (c.scrollTop = 0);
  791. b !== c.scrollTop && (c.scrollTop = b, c.timer && clearTimeout(c.timer), c.timer = setTimeout(c.populateVisible, d.scrollTimeout))
  792. }
  793. c.hDiv.scrollLeft = c.bDiv.scrollLeft;
  794. d.footerrow && (c.sDiv.scrollLeft = c.bDiv.scrollLeft);
  795. a && a.stopPropagation()
  796. },
  797. selectionPreserver: function (a) {
  798. var c = a.p,
  799. d = c.selrow,
  800. e = c.selarrrow ? b.makeArray(c.selarrrow) : null,
  801. f = a.grid.bDiv.scrollLeft,
  802. g = function () {
  803. var h;
  804. c.selrow = null;
  805. c.selarrrow = [];
  806. if (c.multiselect && e && 0 < e.length) for (h = 0; h < e.length; h++) e[h] !== d && b(a).jqGrid("setSelection", e[h], !1, null);
  807. d && b(a).jqGrid("setSelection", d, !1, null);
  808. a.grid.bDiv.scrollLeft = f;
  809. b(a).unbind(".selectionPreserver", g)
  810. };
  811. b(a).bind("jqGridGridComplete.selectionPreserver", g)
  812. }
  813. };
  814. if ("TABLE" !== this.tagName.toUpperCase()) alert("Element is not a table");
  815. else if (void 0 !== document.documentMode && 5 >= document.documentMode) alert("Grid can not be used in this ('quirks') mode!");
  816. else {
  817. b(this).empty().attr("tabindex", "0");
  818. this.p = d;
  819. this.p.useProp = !!b.fn.prop;
  820. var g, f;
  821. if (0 === this.p.colNames.length) for (g = 0; g < this.p.colModel.length; g++) this.p.colNames[g] = this.p.colModel[g].label || this.p.colModel[g].name;
  822. if (this.p.colNames.length !== this.p.colModel.length) alert(b.jgrid.errors.model);
  823. else {
  824. var k = b("<div class='ui-jqgrid-view'></div>"),
  825. n = b.jgrid.msie;
  826. a.p.direction = b.trim(a.p.direction.toLowerCase()); -1 === b.inArray(a.p.direction, ["ltr", "rtl"]) && (a.p.direction = "ltr");
  827. f = a.p.direction;
  828. b(k).insertBefore(this);
  829. b(this).removeClass("scroll").appendTo(k);
  830. var m = b("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");
  831. b(m).attr({
  832. id: "gbox_" + this.id,
  833. dir: f
  834. }).insertBefore(k);
  835. b(k).attr("id", "gview_" + this.id).appendTo(m);
  836. b("<div class='ui-widget-overlay jqgrid-overlay' id='lui_" + this.id + "'></div>").insertBefore(k);
  837. b("<div class='loading ui-state-default ui-state-active' id='load_" + this.id + "'>" + this.p.loadtext + "</div>").insertBefore(k);
  838. b(this).attr({
  839. cellspacing: "0",
  840. cellpadding: "0",
  841. border: "0",
  842. role: "grid",
  843. "aria-multiselectable": !!this.p.multiselect,
  844. "aria-labelledby": "gbox_" + this.id
  845. });
  846. var r = function (a, b) {
  847. a = parseInt(a, 10);
  848. return isNaN(a) ? b || 0 : a
  849. },
  850. p = function (d, e, f, g, i, h) {
  851. var k = a.p.colModel[d],
  852. m = k.align,
  853. E = 'style="',
  854. n = k.classes,
  855. C = k.name,
  856. A = [];
  857. m && (E += "text-align:" + m + ";"); !0 === k.hidden && (E += "display:none;");
  858. if (0 === e) E += "width: " + c.headers[d].width + "px;";
  859. else if (k.cellattr && b.isFunction(k.cellattr) && (d = k.cellattr.call(a, i, f, g, k, h)) && "string" === typeof d) if (d = d.replace(/style/i, "style").replace(/title/i, "title"), -1 < d.indexOf("title") && (k.title = !1), -1 < d.indexOf("class") && (n = void 0), A = d.replace("-style", "-sti").split(/style/), 2 === A.length) {
  860. A[1] = b.trim(A[1].replace("-sti", "-style").replace("=", ""));
  861. if (0 === A[1].indexOf("'") || 0 === A[1].indexOf('"')) A[1] = A[1].substring(1);
  862. E += A[1].replace(/'/gi, '"')
  863. } else E += '"';
  864. A.length || (A[0] = "", E += '"');
  865. E += (void 0 !== n ? ' class="' + n + '"' : "") + (k.title && f ? ' title="' + b.jgrid.stripHtml(f) + '"' : "");
  866. E += ' aria-describedby="' + a.p.id + "_" + C + '"';
  867. return E + A[0]
  868. },
  869. q = function (c) {
  870. return null == c || "" === c ? "&#160;" : a.p.autoencode ? b.jgrid.htmlEncode(c) : String(c)
  871. },
  872. x = function (c, d, e, f, g) {
  873. var h = a.p.colModel[e];
  874. void 0 !== h.formatter ? (c = "" !== String(a.p.idPrefix) ? b.jgrid.stripPref(a.p.idPrefix, c) : c, c = {
  875. rowId: c,
  876. colModel: h,
  877. gid: a.p.id,
  878. pos: e
  879. },
  880. d = b.isFunction(h.formatter) ? h.formatter.call(a, d, c, f, g) : b.fmatter ? b.fn.fmatter.call(a, h.formatter, d, c, f, g) : q(d)) : d = q(d);
  881. return d
  882. },
  883. G = function (a, b, c, d, e, f) {
  884. b = x(a, b, c, e, "add");
  885. return '<td role="gridcell" ' + p(c, d, b, e, a, f) + ">" + b + "</td>"
  886. },
  887. U = function (b, c, d, e) {
  888. e = '<input role="checkbox" type="checkbox" id="jqg_' + a.p.id + "_" + b + '" class="cbox" name="jqg_' + a.p.id + "_" + b + '"' + (e ? 'checked="checked"' : "") + "/>";
  889. return '<td role="gridcell" ' + p(c, d, "", null, b, !0) + ">" + e + "</td>"
  890. },
  891. M = function (a, b, c, d) {
  892. c = (parseInt(c, 10) - 1) * parseInt(d, 10) + 1 + b;
  893. return '<td role="gridcell" class="ui-state-default jqgrid-rownum" ' + p(a, b, c, null, b, !0) + ">" + c + "</td>"
  894. },
  895. ea = function (b) {
  896. var c, d = [],
  897. e = 0,
  898. f;
  899. for (f = 0; f < a.p.colModel.length; f++) c = a.p.colModel[f],
  900. "cb" !== c.name && "subgrid" !== c.name && "rn" !== c.name && (d[e] = "local" === b ? c.name : "xml" === b || "xmlstring" === b ? c.xmlmap || c.name : c.jsonmap || c.name, !1 !== a.p.keyIndex && !0 === c.key && (a.p.keyName = d[e]), e++);
  901. return d
  902. },
  903. W = function (c) {
  904. var d = a.p.remapColumns;
  905. d && d.length || (d = b.map(a.p.colModel,
  906. function (a, b) {
  907. return b
  908. }));
  909. c && (d = b.map(d,
  910. function (a) {
  911. return a < c ? null : a - c
  912. }));
  913. return d
  914. },
  915. X = function (a, c) {
  916. var d;
  917. this.p.deepempty ? b(this.rows).slice(1).remove() : (d = 0 < this.rows.length ? this.rows[0] : null, b(this.firstChild).empty().append(d));
  918. a && this.p.scroll && (b(this.grid.bDiv.firstChild).css({
  919. height: "auto"
  920. }), b(this.grid.bDiv.firstChild.firstChild).css({
  921. height: 0,
  922. display: "none"
  923. }), 0 !== this.grid.bDiv.scrollTop && (this.grid.bDiv.scrollTop = 0)); !0 === c && this.p.treeGrid && (this.p.data = [], this.p._index = {})
  924. },
  925. O = function () {
  926. var c = a.p.data.length,
  927. d, e, f;
  928. d = !0 === a.p.rownumbers ? 1 : 0;
  929. e = !0 === a.p.multiselect ? 1 : 0;
  930. f = !0 === a.p.subGrid ? 1 : 0;
  931. d = !1 === a.p.keyIndex || !0 === a.p.loadonce ? a.p.localReader.id : a.p.colModel[a.p.keyIndex + e + f + d].name;
  932. for (e = 0; e < c; e++) f = b.jgrid.getAccessor(a.p.data[e], d),
  933. void 0 === f && (f = String(e + 1)),
  934. a.p._index[f] = e
  935. },
  936. $ = function (c, d, e, f, g, h) {
  937. var l = "-1",
  938. k = "",
  939. m;
  940. d = d ? "display:none;" : "";
  941. e = "ui-widget-content jqgrow ui-row-" + a.p.direction + (e ? " " + e : "") + (h ? " ui-state-highlight" : "");
  942. h = b(a).triggerHandler("jqGridRowAttr", [f, g, c]);
  943. "object" !== typeof h && (h = b.isFunction(a.p.rowattr) ? a.p.rowattr.call(a, f, g, c) : {});
  944. if (!b.isEmptyObject(h)) {
  945. h.hasOwnProperty("id") && (c = h.id, delete h.id);
  946. h.hasOwnProperty("tabindex") && (l = h.tabindex, delete h.tabindex);
  947. h.hasOwnProperty("style") && (d += h.style, delete h.style);
  948. h.hasOwnProperty("class") && (e += " " + h["class"], delete h["class"]);
  949. try {
  950. delete h.role
  951. } catch (n) { }
  952. for (m in h) h.hasOwnProperty(m) && (k += " " + m + "=" + h[m])
  953. }
  954. return '<tr role="row" id="' + c + '" tabindex="' + l + '" class="' + e + '"' + ("" === d ? "" : ' style="' + d + '"') + k + ">"
  955. },
  956. K = function (c, d, e, f, g) {
  957. var h = new Date,
  958. l = "local" !== a.p.datatype && a.p.loadonce || "xmlstring" === a.p.datatype,
  959. k = a.p.xmlReader,
  960. m = "local" === a.p.datatype ? "local" : "xml";
  961. l && (a.p.data = [], a.p._index = {},
  962. a.p.localReader.id = "_id_");
  963. a.p.reccount = 0;
  964. if (b.isXMLDoc(c)) {
  965. -1 !== a.p.treeANode || a.p.scroll ? e = 1 < e ? e : 1 : (X.call(a, !1, !0), e = 1);
  966. var n = b(a),
  967. C,
  968. A,
  969. R = 0,
  970. p,
  971. u = !0 === a.p.multiselect ? 1 : 0,
  972. z = 0,
  973. x,
  974. q = !0 === a.p.rownumbers ? 1 : 0,
  975. t,
  976. Z = [],
  977. aa,
  978. v = {},
  979. w,
  980. H,
  981. s = [],
  982. L = !0 === a.p.altRows ? a.p.altclass : "",
  983. ia; !0 === a.p.subGrid && (z = 1, x = b.jgrid.getMethod("addSubGridCell"));
  984. k.repeatitems || (Z = ea(m));
  985. t = !1 === a.p.keyIndex ? b.isFunction(k.id) ? k.id.call(a, c) : k.id : a.p.keyIndex;
  986. 0 < Z.length && !isNaN(t) && (t = a.p.keyName);
  987. m = -1 === String(t).indexOf("[") ? Z.length ?
  988. function (a, c) {
  989. return b(t, a).text() || c
  990. } : function (a, c) {
  991. return b(k.cell, a).eq(t).text() || c
  992. } : function (a, b) {
  993. return a.getAttribute(t.replace(/[\[\]]/g, "")) || b
  994. };
  995. a.p.userData = {};
  996. a.p.page = r(b.jgrid.getXmlData(c, k.page), a.p.page);
  997. a.p.lastpage = r(b.jgrid.getXmlData(c, k.total), 1);
  998. a.p.records = r(b.jgrid.getXmlData(c, k.records));
  999. b.isFunction(k.userdata) ? a.p.userData = k.userdata.call(a, c) || {} : b.jgrid.getXmlData(c, k.userdata, !0).each(function () {
  1000. a.p.userData[this.getAttribute("name")] = b(this).text()
  1001. });
  1002. c = b.jgrid.getXmlData(c, k.root, !0); (c = b.jgrid.getXmlData(c, k.row, !0)) || (c = []);
  1003. var S = c.length,
  1004. I = 0,
  1005. y = [],
  1006. D = parseInt(a.p.rowNum, 10),
  1007. B = a.p.scroll ? b.jgrid.randId() : 1;
  1008. 0 < S && 0 >= a.p.page && (a.p.page = 1);
  1009. if (c && S) {
  1010. g && (D *= g + 1);
  1011. g = b.isFunction(a.p.afterInsertRow);
  1012. var F = !1,
  1013. J;
  1014. a.p.grouping && (F = !0 === a.p.groupingView.groupCollapse, J = b.jgrid.getMethod("groupingPrepare"));
  1015. for (; I < S;) {
  1016. w = c[I];
  1017. H = m(w, B + I);
  1018. H = a.p.idPrefix + H;
  1019. C = 0 === e ? 0 : e + 1;
  1020. ia = 1 === (C + I) % 2 ? L : "";
  1021. var K = s.length;
  1022. s.push("");
  1023. q && s.push(M(0, I, a.p.page, a.p.rowNum));
  1024. u && s.push(U(H, q, I, !1));
  1025. z && s.push(x.call(n, u + q, I + e));
  1026. if (k.repeatitems) {
  1027. aa || (aa = W(u + z + q));
  1028. var N = b.jgrid.getXmlData(w, k.cell, !0);
  1029. b.each(aa,
  1030. function (b) {
  1031. var c = N[this];
  1032. if (!c) return !1;
  1033. p = c.textContent || c.text;
  1034. v[a.p.colModel[b + u + z + q].name] = p;
  1035. s.push(G(H, p, b + u + z + q, I + e, w, v))
  1036. })
  1037. } else for (C = 0; C < Z.length; C++) p = b.jgrid.getXmlData(w, Z[C]),
  1038. v[a.p.colModel[C + u + z + q].name] = p,
  1039. s.push(G(H, p, C + u + z + q, I + e, w, v));
  1040. s[K] = $(H, F, ia, v, w, !1);
  1041. s.push("</tr>");
  1042. a.p.grouping && (y.push(s), a.p.groupingView._locgr || J.call(n, v, I), s = []);
  1043. if (l || !0 === a.p.treeGrid) v._id_ = b.jgrid.stripPref(a.p.idPrefix, H),
  1044. a.p.data.push(v),
  1045. a.p._index[v._id_] = a.p.data.length - 1; !1 === a.p.gridview && (b("tbody:first", d).append(s.join("")), n.triggerHandler("jqGridAfterInsertRow", [H, v, w]), g && a.p.afterInsertRow.call(a, H, v, w), s = []);
  1046. v = {};
  1047. R++;
  1048. I++;
  1049. if (R === D) break
  1050. }
  1051. } !0 === a.p.gridview && (A = -1 < a.p.treeANode ? a.p.treeANode : 0, a.p.grouping ? (l || n.jqGrid("groupingRender", y, a.p.colModel.length, a.p.page, D), y = null) : !0 === a.p.treeGrid && 0 < A ? b(a.rows[A]).after(s.join("")) : b("tbody:first", d).append(s.join("")));
  1052. if (!0 === a.p.subGrid) try {
  1053. n.jqGrid("addSubGrid", u + q)
  1054. } catch (Q) { }
  1055. a.p.totaltime = new Date - h;
  1056. 0 < R && 0 === a.p.records && (a.p.records = S);
  1057. s = null;
  1058. if (!0 === a.p.treeGrid) try {
  1059. n.jqGrid("setTreeNode", A + 1, R + A + 1)
  1060. } catch (O) { }
  1061. a.p.treeGrid || a.p.scroll || (a.grid.bDiv.scrollTop = 0);
  1062. a.p.reccount = R;
  1063. a.p.treeANode = -1;
  1064. a.p.userDataOnFooter && n.jqGrid("footerData", "set", a.p.userData, !0);
  1065. l && (a.p.records = S, a.p.lastpage = Math.ceil(S / D));
  1066. f || a.updatepager(!1, !0);
  1067. if (l) {
  1068. for (; R < S;) {
  1069. w = c[R];
  1070. H = m(w, R + B);
  1071. H = a.p.idPrefix + H;
  1072. if (k.repeatitems) {
  1073. aa || (aa = W(u + z + q));
  1074. var P = b.jgrid.getXmlData(w, k.cell, !0);
  1075. b.each(aa,
  1076. function (b) {
  1077. var c = P[this];
  1078. if (!c) return !1;
  1079. p = c.textContent || c.text;
  1080. v[a.p.colModel[b + u + z + q].name] = p
  1081. })
  1082. } else for (C = 0; C < Z.length; C++) p = b.jgrid.getXmlData(w, Z[C]),
  1083. v[a.p.colModel[C + u + z + q].name] = p;
  1084. v._id_ = b.jgrid.stripPref(a.p.idPrefix, H);
  1085. a.p.grouping && J.call(n, v, R);
  1086. a.p.data.push(v);
  1087. a.p._index[v._id_] = a.p.data.length - 1;
  1088. v = {};
  1089. R++
  1090. }
  1091. a.p.grouping && (a.p.groupingView._locgr = !0, n.jqGrid("groupingRender", y, a.p.colModel.length, a.p.page, D), y = null)
  1092. }
  1093. }
  1094. },
  1095. Y = function (c, d, e, f, g) {
  1096. var h = new Date;
  1097. if (c) {
  1098. -1 !== a.p.treeANode || a.p.scroll ? e = 1 < e ? e : 1 : (X.call(a, !1, !0), e = 1);
  1099. var k, l = "local" !== a.p.datatype && a.p.loadonce || "jsonstring" === a.p.datatype;
  1100. l && (a.p.data = [], a.p._index = {},
  1101. a.p.localReader.id = "_id_");
  1102. a.p.reccount = 0;
  1103. "local" === a.p.datatype ? (d = a.p.localReader, k = "local") : (d = a.p.jsonReader, k = "json");
  1104. var m = b(a),
  1105. n = 0,
  1106. C,
  1107. A,
  1108. p,
  1109. q = [],
  1110. u = a.p.multiselect ? 1 : 0,
  1111. z = !0 === a.p.subGrid ? 1 : 0,
  1112. x,
  1113. t = !0 === a.p.rownumbers ? 1 : 0,
  1114. D = W(u + z + t);
  1115. k = ea(k);
  1116. var y, B, v, w = {},
  1117. H, s, L = [],
  1118. ia = !0 === a.p.altRows ? a.p.altclass : "",
  1119. S;
  1120. a.p.page = r(b.jgrid.getAccessor(c, d.page), a.p.page);
  1121. a.p.lastpage = r(b.jgrid.getAccessor(c, d.total), 1);
  1122. a.p.records = r(b.jgrid.getAccessor(c, d.records));
  1123. a.p.userData = b.jgrid.getAccessor(c, d.userdata) || {};
  1124. z && (x = b.jgrid.getMethod("addSubGridCell"));
  1125. v = !1 === a.p.keyIndex ? b.isFunction(d.id) ? d.id.call(a, c) : d.id : a.p.keyIndex;
  1126. d.repeatitems || (q = k, 0 < q.length && !isNaN(v) && (v = a.p.keyName));
  1127. B = b.jgrid.getAccessor(c, d.root);
  1128. null == B && b.isArray(c) && (B = c);
  1129. B || (B = []);
  1130. c = B.length;
  1131. A = 0;
  1132. 0 < c && 0 >= a.p.page && (a.p.page = 1);
  1133. var I = parseInt(a.p.rowNum, 10),
  1134. F = a.p.scroll ? b.jgrid.randId() : 1,
  1135. J = !1,
  1136. K;
  1137. g && (I *= g + 1);
  1138. "local" !== a.p.datatype || a.p.deselectAfterSort || (J = !0);
  1139. var N = b.isFunction(a.p.afterInsertRow),
  1140. P = [],
  1141. Q = !1,
  1142. O;
  1143. a.p.grouping && (Q = !0 === a.p.groupingView.groupCollapse, O = b.jgrid.getMethod("groupingPrepare"));
  1144. for (; A < c;) {
  1145. g = B[A];
  1146. s = b.jgrid.getAccessor(g, v);
  1147. void 0 === s && ("number" === typeof v && null != a.p.colModel[v + u + z + t] && (s = b.jgrid.getAccessor(g, a.p.colModel[v + u + z + t].name)), void 0 === s && (s = F + A, 0 === q.length && d.cell && (C = b.jgrid.getAccessor(g, d.cell) || g, s = null != C && void 0 !== C[v] ? C[v] : s)));
  1148. s = a.p.idPrefix + s;
  1149. C = 1 === e ? 0 : e;
  1150. S = 1 === (C + A) % 2 ? ia : "";
  1151. J && (K = a.p.multiselect ? -1 !== b.inArray(s, a.p.selarrrow) : s === a.p.selrow);
  1152. var T = L.length;
  1153. L.push("");
  1154. t && L.push(M(0, A, a.p.page, a.p.rowNum));
  1155. u && L.push(U(s, t, A, K));
  1156. z && L.push(x.call(m, u + t, A + e));
  1157. y = k;
  1158. d.repeatitems && (d.cell && (g = b.jgrid.getAccessor(g, d.cell) || g), b.isArray(g) && (y = D));
  1159. for (p = 0; p < y.length; p++) C = b.jgrid.getAccessor(g, y[p]),
  1160. w[a.p.colModel[p + u + z + t].name] = C,
  1161. L.push(G(s, C, p + u + z + t, A + e, g, w));
  1162. L[T] = $(s, Q, S, w, g, K);
  1163. L.push("</tr>");
  1164. a.p.grouping && (P.push(L), a.p.groupingView._locgr || O.call(m, w, A), L = []);
  1165. if (l || !0 === a.p.treeGrid) w._id_ = b.jgrid.stripPref(a.p.idPrefix, s),
  1166. a.p.data.push(w),
  1167. a.p._index[w._id_] = a.p.data.length - 1; !1 === a.p.gridview && (b("#" + b.jgrid.jqID(a.p.id) + " tbody:first").append(L.join("")), m.triggerHandler("jqGridAfterInsertRow", [s, w, g]), N && a.p.afterInsertRow.call(a, s, w, g), L = []);
  1168. w = {};
  1169. n++;
  1170. A++;
  1171. if (n === I) break
  1172. } !0 === a.p.gridview && (H = -1 < a.p.treeANode ? a.p.treeANode : 0, a.p.grouping ? l || (m.jqGrid("groupingRender", P, a.p.colModel.length, a.p.page, I), P = null) : !0 === a.p.treeGrid && 0 < H ? b(a.rows[H]).after(L.join("")) : b("#" + b.jgrid.jqID(a.p.id) + " tbody:first").append(L.join("")));
  1173. if (!0 === a.p.subGrid) try {
  1174. m.jqGrid("addSubGrid", u + t)
  1175. } catch (V) { }
  1176. a.p.totaltime = new Date - h;
  1177. 0 < n && 0 === a.p.records && (a.p.records = c);
  1178. if (!0 === a.p.treeGrid) try {
  1179. m.jqGrid("setTreeNode", H + 1, n + H + 1)
  1180. } catch (Y) { }
  1181. a.p.treeGrid || a.p.scroll || (a.grid.bDiv.scrollTop = 0);
  1182. a.p.reccount = n;
  1183. a.p.treeANode = -1;
  1184. a.p.userDataOnFooter && m.jqGrid("footerData", "set", a.p.userData, !0);
  1185. l && (a.p.records = c, a.p.lastpage = Math.ceil(c / I));
  1186. f || a.updatepager(!1, !0);
  1187. if (l) {
  1188. for (; n < c && B[n];) {
  1189. g = B[n];
  1190. s = b.jgrid.getAccessor(g, v);
  1191. void 0 === s && ("number" === typeof v && null != a.p.colModel[v + u + z + t] && (s = b.jgrid.getAccessor(g, a.p.colModel[v + u + z + t].name)), void 0 === s && (s = F + n, 0 === q.length && d.cell && (e = b.jgrid.getAccessor(g, d.cell) || g, s = null != e && void 0 !== e[v] ? e[v] : s)));
  1192. if (g) {
  1193. s = a.p.idPrefix + s;
  1194. y = k;
  1195. d.repeatitems && (d.cell && (g = b.jgrid.getAccessor(g, d.cell) || g), b.isArray(g) && (y = D));
  1196. for (p = 0; p < y.length; p++) w[a.p.colModel[p + u + z + t].name] = b.jgrid.getAccessor(g, y[p]);
  1197. w._id_ = b.jgrid.stripPref(a.p.idPrefix, s);
  1198. a.p.grouping && O.call(m, w, n);
  1199. a.p.data.push(w);
  1200. a.p._index[w._id_] = a.p.data.length - 1;
  1201. w = {}
  1202. }
  1203. n++
  1204. }
  1205. a.p.grouping && (a.p.groupingView._locgr = !0, m.jqGrid("groupingRender", P, a.p.colModel.length, a.p.page, I))
  1206. }
  1207. }
  1208. },
  1209. oa = function () {
  1210. function c(a) {
  1211. var b = 0,
  1212. d, e, g, h, k;
  1213. if (null != a.groups) {
  1214. (e = a.groups.length && "OR" === a.groupOp.toString().toUpperCase()) && u.orBegin();
  1215. for (d = 0; d < a.groups.length; d++) {
  1216. 0 < b && e && u.or();
  1217. try {
  1218. c(a.groups[d])
  1219. } catch (l) {
  1220. alert(l)
  1221. }
  1222. b++
  1223. }
  1224. e && u.orEnd()
  1225. }
  1226. if (null != a.rules) try {
  1227. (g = a.rules.length && "OR" === a.groupOp.toString().toUpperCase()) && u.orBegin();
  1228. for (d = 0; d < a.rules.length; d++) k = a.rules[d],
  1229. h = a.groupOp.toString().toUpperCase(),
  1230. q[k.op] && k.field && (0 < b && h && "OR" === h && (u = u.or()), u = q[k.op](u, h)(k.field, k.data, f[k.field])),
  1231. b++;
  1232. g && u.orEnd()
  1233. } catch (m) {
  1234. alert(m)
  1235. }
  1236. }
  1237. var d = a.p.multiSort ? [] : "",
  1238. e = [],
  1239. g = !1,
  1240. f = {},
  1241. h = [],
  1242. k = [],
  1243. l,
  1244. m,
  1245. n;
  1246. if (b.isArray(a.p.data)) {
  1247. var p = a.p.grouping ? a.p.groupingView : !1,
  1248. A,
  1249. r;
  1250. b.each(a.p.colModel,
  1251. function () {
  1252. m = this.sorttype || "text";
  1253. "date" === m || "datetime" === m ? (this.formatter && "string" === typeof this.formatter && "date" === this.formatter ? (l = this.formatoptions && this.formatoptions.srcformat ? this.formatoptions.srcformat : b.jgrid.formatter.date.srcformat, n = this.formatoptions && this.formatoptions.newformat ? this.formatoptions.newformat : b.jgrid.formatter.date.newformat) : l = n = this.datefmt || "Y-m-d", f[this.name] = {
  1254. stype: m,
  1255. srcfmt: l,
  1256. newfmt: n,
  1257. sfunc: this.sortfunc || null
  1258. }) : f[this.name] = {
  1259. stype: m,
  1260. srcfmt: "",
  1261. newfmt: "",
  1262. sfunc: this.sortfunc || null
  1263. };
  1264. if (a.p.grouping) for (r = 0, A = p.groupField.length; r < A; r++) if (this.name === p.groupField[r]) {
  1265. var c = this.name;
  1266. this.index && (c = this.index);
  1267. h[r] = f[c];
  1268. k[r] = c
  1269. }
  1270. a.p.multiSort ? this.lso && (d.push(this.name), c = this.lso.split("-"), e.push(c[c.length - 1])) : g || this.index !== a.p.sortname && this.name !== a.p.sortname || (d = this.name, g = !0)
  1271. });
  1272. if (a.p.treeGrid) b(a).jqGrid("SortTree", d, a.p.sortorder, f[d].stype || "text", f[d].srcfmt || "");
  1273. else {
  1274. var q = {
  1275. eq: function (a) {
  1276. return a.equals
  1277. },
  1278. ne: function (a) {
  1279. return a.notEquals
  1280. },
  1281. lt: function (a) {
  1282. return a.less
  1283. },
  1284. le: function (a) {
  1285. return a.lessOrEquals
  1286. },
  1287. gt: function (a) {
  1288. return a.greater
  1289. },
  1290. ge: function (a) {
  1291. return a.greaterOrEquals
  1292. },
  1293. cn: function (a) {
  1294. return a.contains
  1295. },
  1296. nc: function (a, b) {
  1297. return "OR" === b ? a.orNot().contains : a.andNot().contains
  1298. },
  1299. bw: function (a) {
  1300. return a.startsWith
  1301. },
  1302. bn: function (a, b) {
  1303. return "OR" === b ? a.orNot().startsWith : a.andNot().startsWith
  1304. },
  1305. en: function (a, b) {
  1306. return "OR" === b ? a.orNot().endsWith : a.andNot().endsWith
  1307. },
  1308. ew: function (a) {
  1309. return a.endsWith
  1310. },
  1311. ni: function (a, b) {
  1312. return "OR" === b ? a.orNot().equals : a.andNot().equals
  1313. },
  1314. "in": function (a) {
  1315. return a.equals
  1316. },
  1317. nu: function (a) {
  1318. return a.isNull
  1319. },
  1320. nn: function (a, b) {
  1321. return "OR" === b ? a.orNot().isNull : a.andNot().isNull
  1322. }
  1323. },
  1324. u = b.jgrid.from(a.p.data);
  1325. a.p.ignoreCase && (u = u.ignoreCase());
  1326. if (!0 === a.p.search) {
  1327. var z = a.p.postData.filters;
  1328. if (z) "string" === typeof z && (z = b.jgrid.parse(z)),
  1329. c(z);
  1330. else try {
  1331. u = q[a.p.postData.searchOper](u)(a.p.postData.searchField, a.p.postData.searchString, f[a.p.postData.searchField])
  1332. } catch (t) { }
  1333. }
  1334. if (a.p.grouping) for (r = 0; r < A; r++) u.orderBy(k[r], p.groupOrder[r], h[r].stype, h[r].srcfmt);
  1335. a.p.multiSort ? b.each(d,
  1336. function (a) {
  1337. u.orderBy(this, e[a], f[this].stype, f[this].srcfmt, f[this].sfunc)
  1338. }) : d && a.p.sortorder && g && ("DESC" === a.p.sortorder.toUpperCase() ? u.orderBy(a.p.sortname, "d", f[d].stype, f[d].srcfmt, f[d].sfunc) : u.orderBy(a.p.sortname, "a", f[d].stype, f[d].srcfmt, f[d].sfunc));
  1339. var z = u.select(),
  1340. x = parseInt(a.p.rowNum, 10),
  1341. y = z.length,
  1342. B = parseInt(a.p.page, 10),
  1343. D = Math.ceil(y / x),
  1344. v = {};
  1345. if ((a.p.search || a.p.resetsearch) && a.p.grouping && a.p.groupingView._locgr) {
  1346. a.p.groupingView.groups = [];
  1347. var w, G = b.jgrid.getMethod("groupingPrepare"),
  1348. s,
  1349. F;
  1350. if (a.p.footerrow && a.p.userDataOnFooter) {
  1351. for (s in a.p.userData) a.p.userData.hasOwnProperty(s) && (a.p.userData[s] = 0);
  1352. F = !0
  1353. }
  1354. for (w = 0; w < y; w++) {
  1355. if (F) for (s in a.p.userData) a.p.userData[s] += parseFloat(z[w][s] || 0);
  1356. G.call(b(a), z[w], w, x)
  1357. }
  1358. }
  1359. z = z.slice((B - 1) * x, B * x);
  1360. f = u = null;
  1361. v[a.p.localReader.total] = D;
  1362. v[a.p.localReader.page] = B;
  1363. v[a.p.localReader.records] = y;
  1364. v[a.p.localReader.root] = z;
  1365. v[a.p.localReader.userdata] = a.p.userData;
  1366. z = null;
  1367. return v
  1368. }
  1369. }
  1370. },
  1371. P = function () {
  1372. a.grid.hDiv.loading = !0;
  1373. if (!a.p.hiddengrid) switch (a.p.loadui) {
  1374. case "enable":
  1375. window.setTimeout(function () {
  1376. loading(true);
  1377. },
  1378. 0);
  1379. b("#load_" + b.jgrid.jqID(a.p.id)).next().find('.ui-jqgrid-bdiv').find("span").remove();
  1380. break;
  1381. case "block":
  1382. b("#lui_" + b.jgrid.jqID(a.p.id)).show(),
  1383. b("#load_" + b.jgrid.jqID(a.p.id)).show()
  1384. }
  1385. },
  1386. T = function () {
  1387. a.grid.hDiv.loading = !1;
  1388. switch (a.p.loadui) {
  1389. case "enable":
  1390. window.setTimeout(function () {
  1391. loading(false);
  1392. },
  1393. 100);
  1394. if (a.p.unwritten) {
  1395. var c = b.jgrid.jqID(a.p.id);
  1396. b("#load_" + c).next().find('.ui-jqgrid-bdiv').find(".unwritten").remove();
  1397. var d = b("#load_" + c).next().find('.ui-jqgrid-bdiv').find('table tr').length;
  1398. if (d == 1) {
  1399. b("#load_" + c).next().find('.ui-jqgrid-bdiv').append('<div class="unwritten" style="color:red;padding:4px;border-bottom:#ccc 1px solid;">没有找到您要的相关数据!</div>')
  1400. }
  1401. }
  1402. break;
  1403. case "block":
  1404. b("#lui_" + b.jgrid.jqID(a.p.id)).hide(),
  1405. b("#load_" + b.jgrid.jqID(a.p.id)).hide()
  1406. }
  1407. },
  1408. Q = function (c) {
  1409. if (!a.grid.hDiv.loading) {
  1410. var d = a.p.scroll && !1 === c,
  1411. e = {},
  1412. g, f = a.p.prmNames;
  1413. 0 >= a.p.page && (a.p.page = Math.min(1, a.p.lastpage));
  1414. null !== f.search && (e[f.search] = a.p.search);
  1415. null !== f.nd && (e[f.nd] = (new Date).getTime());
  1416. null !== f.rows && (e[f.rows] = a.p.rowNum);
  1417. null !== f.page && (e[f.page] = a.p.page);
  1418. null !== f.sort && (e[f.sort] = a.p.sortname);
  1419. null !== f.order && (e[f.order] = a.p.sortorder);
  1420. null !== a.p.rowTotal && null !== f.totalrows && (e[f.totalrows] = a.p.rowTotal);
  1421. var h = b.isFunction(a.p.loadComplete),
  1422. k = h ? a.p.loadComplete : null,
  1423. l = 0;
  1424. c = c || 1;
  1425. 1 < c ? null !== f.npage ? (e[f.npage] = c, l = c - 1, c = 1) : k = function (b) {
  1426. a.p.page++;
  1427. a.grid.hDiv.loading = !1;
  1428. h && a.p.loadComplete.call(a, b);
  1429. Q(c - 1)
  1430. } : null !== f.npage && delete a.p.postData[f.npage];
  1431. if (a.p.grouping) {
  1432. b(a).jqGrid("groupingSetup");
  1433. var m = a.p.groupingView,
  1434. n, p = "";
  1435. for (n = 0; n < m.groupField.length; n++) {
  1436. var r = m.groupField[n];
  1437. b.each(a.p.colModel,
  1438. function (a, b) {
  1439. b.name === r && b.index && (r = b.index)
  1440. });
  1441. p += r + " " + m.groupOrder[n] + ", "
  1442. }
  1443. e[f.sort] = p + e[f.sort]
  1444. }
  1445. b.extend(a.p.postData, e);
  1446. var q = a.p.scroll ? a.rows.length - 1 : 1,
  1447. e = b(a).triggerHandler("jqGridBeforeRequest");
  1448. if (!1 !== e && "stop" !== e) if (b.isFunction(a.p.datatype)) a.p.datatype.call(a, a.p.postData, "load_" + a.p.id, q, c, l);
  1449. else {
  1450. if (b.isFunction(a.p.beforeRequest) && (e = a.p.beforeRequest.call(a), void 0 === e && (e = !0), !1 === e)) return;
  1451. g = a.p.datatype.toLowerCase();
  1452. switch (g) {
  1453. case "json":
  1454. case "jsonp":
  1455. case "xml":
  1456. case "script":
  1457. b.ajax(b.extend({
  1458. url:
  1459. a.p.url,
  1460. type: a.p.mtype,
  1461. dataType: g,
  1462. data: b.isFunction(a.p.serializeGridData) ? a.p.serializeGridData.call(a, a.p.postData) : a.p.postData,
  1463. success: function (e, f, h) {
  1464. if (e != null && e.costtime != null) {
  1465. a.p.costtime = e.costtime
  1466. }
  1467. if (b.isFunction(a.p.beforeProcessing) && !1 === a.p.beforeProcessing.call(a, e, f, h)) T();
  1468. else {
  1469. "xml" === g ? K(e, a.grid.bDiv, q, 1 < c, l) : Y(e, a.grid.bDiv, q, 1 < c, l);
  1470. b(a).triggerHandler("jqGridLoadComplete", [e]);
  1471. k && k.call(a, e);
  1472. b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
  1473. d && a.grid.populateVisible();
  1474. if (a.p.loadonce || a.p.treeGrid) a.p.datatype = "local";
  1475. 1 === c && T()
  1476. }
  1477. },
  1478. error: function (d, e, f) {
  1479. b.isFunction(a.p.loadError) && a.p.loadError.call(a, d, e, f);
  1480. 1 === c && T()
  1481. },
  1482. beforeSend: function (c, d) {
  1483. var e = !0;
  1484. b.isFunction(a.p.loadBeforeSend) && (e = a.p.loadBeforeSend.call(a, c, d));
  1485. void 0 === e && (e = !0);
  1486. if (!1 === e) return !1;
  1487. P()
  1488. }
  1489. },
  1490. b.jgrid.ajaxOptions, a.p.ajaxGridOptions));
  1491. break;
  1492. case "xmlstring":
  1493. P();
  1494. e = "string" !== typeof a.p.datastr ? a.p.datastr : b.parseXML(a.p.datastr);
  1495. K(e, a.grid.bDiv);
  1496. b(a).triggerHandler("jqGridLoadComplete", [e]);
  1497. h && a.p.loadComplete.call(a, e);
  1498. b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
  1499. a.p.datatype = "local";
  1500. a.p.datastr = null;
  1501. T();
  1502. break;
  1503. case "jsonstring":
  1504. P();
  1505. e = "string" === typeof a.p.datastr ? b.jgrid.parse(a.p.datastr) : a.p.datastr;
  1506. Y(e, a.grid.bDiv);
  1507. b(a).triggerHandler("jqGridLoadComplete", [e]);
  1508. h && a.p.loadComplete.call(a, e);
  1509. b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
  1510. a.p.datatype = "local";
  1511. a.p.datastr = null;
  1512. T();
  1513. break;
  1514. case "local":
  1515. case "clientside":
  1516. P(),
  1517. a.p.datatype = "local",
  1518. e = oa(),
  1519. Y(e, a.grid.bDiv, q, 1 < c, l),
  1520. b(a).triggerHandler("jqGridLoadComplete", [e]),
  1521. k && k.call(a, e),
  1522. b(a).triggerHandler("jqGridAfterLoadComplete", [e]),
  1523. d && a.grid.populateVisible(),
  1524. T()
  1525. }
  1526. }
  1527. }
  1528. },
  1529. ha = function (c) {
  1530. b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv)[a.p.useProp ? "prop" : "attr"]("checked", c);
  1531. if (a.p.frozenColumns && a.p.id + "_frozen") b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.fhDiv)[a.p.useProp ? "prop" : "attr"]("checked", c)
  1532. },
  1533. qa = function (c, e) {
  1534. var d = "",
  1535. g = "<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
  1536. k = "",
  1537. l, m, n, p, q = function (c) {
  1538. var e;
  1539. b.isFunction(a.p.onPaging) && (e = a.p.onPaging.call(a, c));
  1540. if ("stop" === e) return !1;
  1541. a.p.selrow = null;
  1542. a.p.multiselect && (a.p.selarrrow = [], ha(!1));
  1543. a.p.savedRow = [];
  1544. return !0
  1545. };
  1546. c = c.substr(1);
  1547. e += "_" + c;
  1548. l = "pg_" + c;
  1549. m = c + "_left";
  1550. n = c + "_center";
  1551. p = c + "_right";
  1552. b("#" + b.jgrid.jqID(c)).append("<div id='" + l + "' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='" + n + "' align='left' style='white-space:pre;'></td><td id='" + p + "' align='right'></td><td id='" + m + "' align='left' style='display:none'></td></tr></tbody></table></div>").attr("dir", "ltr");
  1553. if (0 < a.p.rowList.length) {
  1554. k = "<td dir='" + f + "'>";
  1555. k += "<select class='ui-pg-selbox' role='listbox'>";
  1556. for (m = 0; m < a.p.rowList.length; m++) k += '<option role="option" value="' + a.p.rowList[m] + '"' + (a.p.rowNum === a.p.rowList[m] ? ' selected="selected"' : "") + ">" + a.p.rowList[m] + "</option>";
  1557. k += "</select></td>"
  1558. }
  1559. "rtl" === f && (g += k); !0 === a.p.pginput && (d = "<td dir='" + f + "'>" + b.jgrid.format(a.p.pgtext || "", "<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>", "<span id='sp_1_" + b.jgrid.jqID(c) + "'></span>") + "</td>"); !0 === a.p.pgbuttons ? (m = ["first" + e, "prev" + e, "next" + e, "last" + e], "rtl" === f && m.reverse(), g += "<td id='" + m[0] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon-seek-first'><i class=\"fa fa-fast-backward\"></i></span></td>", g += "<td id='" + m[1] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon-seek-prev'><i class=\"fa fa-backward\"></i></span></td>", g = g + ("" !== d ? "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>" + d + "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>" : "") + ("<td id='" + m[2] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon-seek-next'><i class=\"fa fa-forward\"></i></span></td>"), g += "<td id='" + m[3] + "' class='ui-pg-button ui-corner-all'><span class='ui-icon-seek-end'><i class=\"fa fa-fast-forward\"></i></span></td>") : "" !== d && (g += d);
  1560. "ltr" === f && (g += k);
  1561. g += "</tr></tbody></table>"; !0 === a.p.viewrecords && b("td#" + c + "_" + a.p.recordpos, "#" + l).append("<div dir='" + f + "' style='text-align:left' class='ui-paging-info'></div>");
  1562. b("td#" + c + "_" + a.p.pagerpos, "#" + l).append(g);
  1563. k = b(".ui-jqgrid").css("font-size") || "11px";
  1564. b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + k + ";visibility:hidden;' ></div>");
  1565. g = b(g).clone().appendTo("#testpg").width();
  1566. b("#testpg").remove();
  1567. 0 < g && ("" !== d && (g += 50), b("td#" + c + "_" + a.p.pagerpos, "#" + l).width(g - 25));
  1568. a.p._nvtd = [];
  1569. a.p._nvtd[0] = g ? Math.floor((a.p.width - g) / 2) : Math.floor(a.p.width / 3);
  1570. a.p._nvtd[1] = 0;
  1571. g = null;
  1572. b(".ui-pg-selbox", "#" + l).bind("change",
  1573. function () {
  1574. if (!q("records")) return !1;
  1575. a.p.page = Math.round(a.p.rowNum * (a.p.page - 1) / this.value - 0.5) + 1;
  1576. a.p.rowNum = this.value;
  1577. a.p.pager && b(".ui-pg-selbox", a.p.pager).val(this.value);
  1578. a.p.toppager && b(".ui-pg-selbox", a.p.toppager).val(this.value);
  1579. Q();
  1580. return !1
  1581. }); !0 === a.p.pgbuttons && (b(".ui-pg-button", "#" + l).hover(function () {
  1582. b(this).hasClass("ui-state-disabled") ? this.style.cursor = "default" : (b(this).addClass("ui-state-hover"), this.style.cursor = "pointer")
  1583. },
  1584. function () {
  1585. b(this).hasClass("ui-state-disabled") || (b(this).removeClass("ui-state-hover"), this.style.cursor = "default")
  1586. }), b("#first" + b.jgrid.jqID(e) + ", #prev" + b.jgrid.jqID(e) + ", #next" + b.jgrid.jqID(e) + ", #last" + b.jgrid.jqID(e)).click(function () {
  1587. if (b(this).hasClass("ui-state-disabled")) return !1;
  1588. var c = r(a.p.page, 1),
  1589. d = r(a.p.lastpage, 1),
  1590. g = !1,
  1591. f = !0,
  1592. h = !0,
  1593. k = !0,
  1594. l = !0;
  1595. 0 === d || 1 === d ? l = k = h = f = !1 : 1 < d && 1 <= c ? 1 === c ? h = f = !1 : c === d && (l = k = !1) : 1 < d && 0 === c && (l = k = !1, c = d - 1);
  1596. if (!q(this.id)) return !1;
  1597. this.id === "first" + e && f && (a.p.page = 1, g = !0);
  1598. this.id === "prev" + e && h && (a.p.page = c - 1, g = !0);
  1599. this.id === "next" + e && k && (a.p.page = c + 1, g = !0);
  1600. this.id === "last" + e && l && (a.p.page = d, g = !0);
  1601. g && Q();
  1602. return !1
  1603. })); !0 === a.p.pginput && b("input.ui-pg-input", "#" + l).keypress(function (c) {
  1604. if (13 === (c.charCode || c.keyCode || 0)) {
  1605. if (!q("user")) return !1;
  1606. b(this).val(r(b(this).val(), 1));
  1607. a.p.page = 0 < b(this).val() ? b(this).val() : a.p.page;
  1608. Q();
  1609. return !1
  1610. }
  1611. return this
  1612. })
  1613. },
  1614. wa = function (c, e) {
  1615. var d, g = "",
  1616. f = a.p.colModel,
  1617. h = !1,
  1618. k;
  1619. k = a.p.frozenColumns ? e : a.grid.headers[c].el;
  1620. var l = "";
  1621. b("span.ui-grid-ico-sort", k).addClass("ui-state-disabled");
  1622. b(k).attr("aria-selected", "false");
  1623. if (f[c].lso) if ("asc" === f[c].lso) f[c].lso += "-desc",
  1624. l = "desc";
  1625. else if ("desc" === f[c].lso) f[c].lso += "-asc",
  1626. l = "asc";
  1627. else {
  1628. if ("asc-desc" === f[c].lso || "desc-asc" === f[c].lso) f[c].lso = ""
  1629. } else f[c].lso = l = f[c].firstsortorder || "asc";
  1630. l ? (b("span.s-ico", k).show(), b("span.ui-icon-" + l, k).removeClass("ui-state-disabled"), b(k).attr("aria-selected", "true")) : a.p.viewsortcols[0] || b("span.s-ico", k).hide();
  1631. a.p.sortorder = "";
  1632. b.each(f,
  1633. function (b) {
  1634. this.lso && (0 < b && h && (g += ", "), d = this.lso.split("-"), g += f[b].index || f[b].name, g += " " + d[d.length - 1], h = !0, a.p.sortorder = d[d.length - 1])
  1635. });
  1636. k = g.lastIndexOf(a.p.sortorder);
  1637. g = g.substring(0, k);
  1638. a.p.sortname = g
  1639. },
  1640. ra = function (c, d, e, g, f) {
  1641. if (a.p.colModel[d].sortable && !(0 < a.p.savedRow.length)) {
  1642. e || (a.p.lastsort === d ? "asc" === a.p.sortorder ? a.p.sortorder = "desc" : "desc" === a.p.sortorder && (a.p.sortorder = "asc") : a.p.sortorder = a.p.colModel[d].firstsortorder || "asc", a.p.page = 1);
  1643. if (a.p.multiSort) wa(d, f);
  1644. else {
  1645. if (g) {
  1646. if (a.p.lastsort === d && a.p.sortorder === g && !e) return;
  1647. a.p.sortorder = g
  1648. }
  1649. e = a.grid.headers[a.p.lastsort].el;
  1650. f = a.p.frozenColumns ? f : a.grid.headers[d].el;
  1651. b("span.ui-grid-ico-sort", e).addClass("ui-state-disabled");
  1652. b(e).attr("aria-selected", "false");
  1653. a.p.frozenColumns && (a.grid.fhDiv.find("span.ui-grid-ico-sort").addClass("ui-state-disabled"), a.grid.fhDiv.find("th").attr("aria-selected", "false"));
  1654. b("span.ui-icon-" + a.p.sortorder, f).removeClass("ui-state-disabled");
  1655. b(f).attr("aria-selected", "true");
  1656. a.p.viewsortcols[0] || a.p.lastsort === d || (a.p.frozenColumns && a.grid.fhDiv.find("span.s-ico").hide(), b("span.s-ico", e).hide(), b("span.s-ico", f).show());
  1657. c = c.substring(5 + a.p.id.length + 1);
  1658. a.p.sortname = a.p.colModel[d].index || c
  1659. }
  1660. "stop" === b(a).triggerHandler("jqGridSortCol", [a.p.sortname, d, a.p.sortorder]) ? a.p.lastsort = d : b.isFunction(a.p.onSortCol) && "stop" === a.p.onSortCol.call(a, a.p.sortname, d, a.p.sortorder) ? a.p.lastsort = d : ("local" === a.p.datatype ? a.p.deselectAfterSort && b(a).jqGrid("resetSelection") : (a.p.selrow = null, a.p.multiselect && ha(!1), a.p.selarrrow = [], a.p.savedRow = []), a.p.scroll && (f = a.grid.bDiv.scrollLeft, X.call(a, !0, !1), a.grid.hDiv.scrollLeft = f), a.p.subGrid && "local" === a.p.datatype && b("td.sgexpanded", "#" + b.jgrid.jqID(a.p.id)).each(function () {
  1661. b(this).trigger("click")
  1662. }), Q(), a.p.lastsort = d, a.p.sortname !== c && d && (a.p.lastsort = d))
  1663. }
  1664. },
  1665. xa = function (c) {
  1666. c = b(a.grid.headers[c].el);
  1667. c = [c.position().left + c.outerWidth()];
  1668. "rtl" === a.p.direction && (c[0] = a.p.width - c[0]);
  1669. c[0] -= a.grid.bDiv.scrollLeft;
  1670. c.push(b(a.grid.hDiv).position().top);
  1671. c.push(b(a.grid.bDiv).offset().top - b(a.grid.hDiv).offset().top + b(a.grid.bDiv).height());
  1672. return c
  1673. },
  1674. sa = function (c) {
  1675. var d, e = a.grid.headers,
  1676. g = b.jgrid.getCellIndex(c);
  1677. for (d = 0; d < e.length; d++) if (c === e[d].el) {
  1678. g = d;
  1679. break
  1680. }
  1681. return g
  1682. };
  1683. this.p.id = this.id; -1 === b.inArray(a.p.multikey, ["shiftKey", "altKey", "ctrlKey"]) && (a.p.multikey = !1);
  1684. a.p.keyIndex = !1;
  1685. a.p.keyName = !1;
  1686. for (g = 0; g < a.p.colModel.length; g++) a.p.colModel[g] = b.extend(!0, {},
  1687. a.p.cmTemplate, a.p.colModel[g].template || {},
  1688. a.p.colModel[g]),
  1689. !1 === a.p.keyIndex && !0 === a.p.colModel[g].key && (a.p.keyIndex = g);
  1690. a.p.sortorder = a.p.sortorder.toLowerCase();
  1691. b.jgrid.cell_width = b.jgrid.cellWidth(); !0 === a.p.grouping && (a.p.scroll = !1, a.p.rownumbers = !1, a.p.treeGrid = !1, a.p.gridview = !0);
  1692. if (!0 === this.p.treeGrid) {
  1693. try {
  1694. b(this).jqGrid("setTreeGrid")
  1695. } catch (za) { }
  1696. "local" !== a.p.datatype && (a.p.localReader = {
  1697. id: "_id_"
  1698. })
  1699. }
  1700. if (this.p.subGrid) try {
  1701. b(a).jqGrid("setSubGrid")
  1702. } catch (Aa) { }
  1703. this.p.multiselect && (this.p.colNames.unshift("<input role='checkbox' id='cb_" + this.p.id + "' class='cbox' type='checkbox'/>"), this.p.colModel.unshift({
  1704. name: "cb",
  1705. width: b.jgrid.cell_width ? a.p.multiselectWidth + a.p.cellLayout : a.p.multiselectWidth,
  1706. sortable: !1,
  1707. resizable: !1,
  1708. hidedlg: !0,
  1709. search: !1,
  1710. align: "center",
  1711. fixed: !0
  1712. }));
  1713. this.p.rownumbers && (this.p.colNames.unshift(""), this.p.colModel.unshift({
  1714. name: "rn",
  1715. width: a.p.rownumWidth,
  1716. sortable: !1,
  1717. resizable: !1,
  1718. hidedlg: !0,
  1719. search: !1,
  1720. align: "center",
  1721. fixed: !0
  1722. }));
  1723. a.p.xmlReader = b.extend(!0, {
  1724. root: "rows",
  1725. row: "row",
  1726. page: "rows>page",
  1727. total: "rows>total",
  1728. records: "rows>records",
  1729. repeatitems: !0,
  1730. cell: "cell",
  1731. id: "[id]",
  1732. userdata: "userdata",
  1733. subgrid: {
  1734. root: "rows",
  1735. row: "row",
  1736. repeatitems: !0,
  1737. cell: "cell"
  1738. }
  1739. },
  1740. a.p.xmlReader);
  1741. a.p.jsonReader = b.extend(!0, {
  1742. root: "rows",
  1743. page: "page",
  1744. total: "total",
  1745. records: "records",
  1746. repeatitems: !0,
  1747. cell: "cell",
  1748. id: "id",
  1749. userdata: "userdata",
  1750. subgrid: {
  1751. root: "rows",
  1752. repeatitems: !0,
  1753. cell: "cell"
  1754. }
  1755. },
  1756. a.p.jsonReader);
  1757. a.p.localReader = b.extend(!0, {
  1758. root: "rows",
  1759. page: "page",
  1760. total: "total",
  1761. records: "records",
  1762. repeatitems: !1,
  1763. cell: "cell",
  1764. id: "id",
  1765. userdata: "userdata",
  1766. subgrid: {
  1767. root: "rows",
  1768. repeatitems: !0,
  1769. cell: "cell"
  1770. }
  1771. },
  1772. a.p.localReader);
  1773. a.p.scroll && (a.p.pgbuttons = !1, a.p.pginput = !1, a.p.rowList = []);
  1774. a.p.data.length && O();
  1775. var D = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
  1776. ta, F, ja, fa, ka, y, t, ba, ua = ba = "",
  1777. ga = [],
  1778. va = [];
  1779. F = [];
  1780. if (!0 === a.p.shrinkToFit && !0 === a.p.forceFit) for (g = a.p.colModel.length - 1; 0 <= g; g--) if (!a.p.colModel[g].hidden) {
  1781. a.p.colModel[g].resizable = !1;
  1782. break
  1783. }
  1784. "horizontal" === a.p.viewsortcols[1] && (ba = " ui-i-asc", ua = " ui-i-desc");
  1785. ta = n ? "class='ui-th-div-ie'" : "";
  1786. ba = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc" + ba + " ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-" + f + "'></span>" + ("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc" + ua + " ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-" + f + "'></span></span>");
  1787. if (a.p.multiSort) for (ga = a.p.sortname.split(","), g = 0; g < ga.length; g++) F = b.trim(ga[g]).split(" "),
  1788. ga[g] = b.trim(F[0]),
  1789. va[g] = F[1] ? b.trim(F[1]) : a.p.sortorder || "asc";
  1790. var j = 0;
  1791. var o = 0;
  1792. for (g = 0; g < this.p.colNames.length; g++) {
  1793. var bb = a.p.colModel[g].hidden;
  1794. if (a.p.colModel[g].autowidth == true) {
  1795. o = g;
  1796. break
  1797. }
  1798. if (bb == undefined) {
  1799. o = g
  1800. }
  1801. }
  1802. for (g = 0; g < this.p.colNames.length; g++) {
  1803. var bb = a.p.colModel[g].hidden;
  1804. var bc = a.p.colModel[g].width;
  1805. if (bb != undefined) {
  1806. bc = 0
  1807. } else {
  1808. j += bc
  1809. }
  1810. if (g == o) {
  1811. if (b("#gview_" + a.p.id).width() > j) {
  1812. if (a.p.colModel[g].autowidth == true || a.p.colModel[g].autowidth == undefined) {
  1813. bc = bc + b("#gview_" + a.p.id).width() - j - 20
  1814. }
  1815. }
  1816. }
  1817. F = a.p.headertitles ? ' title="' + b.jgrid.stripHtml(a.p.colNames[g]) + '"' : "",
  1818. D += "<th id='" + a.p.id + "_" + a.p.colModel[g].name + "' style='text-align:" + a.p.colModel[g].align + ";' role='columnheader' class='ui-state-default ui-th-column ui-th-" + f + "'" + F + ">",
  1819. F = a.p.colModel[g].index || a.p.colModel[g].name,
  1820. D += "<div id='jqgh_" + a.p.id + "_" + a.p.colModel[g].name + "' " + ta + ">" + a.p.colNames[g],
  1821. a.p.colModel[g].width = bc ? parseInt(bc, 10) : 150,
  1822. "boolean" !== typeof a.p.colModel[g].title && (a.p.colModel[g].title = !0),
  1823. a.p.colModel[g].lso = "",
  1824. F === a.p.sortname && (a.p.lastsort = g),
  1825. a.p.multiSort && (F = b.inArray(F, ga), -1 !== F && (a.p.colModel[g].lso = va[F])),
  1826. D += ba + "</div></th>"
  1827. }
  1828. D += "</tr></thead>";
  1829. ba = null;
  1830. b(this).append(D);
  1831. function widthCount(a, b) {
  1832. return a
  1833. };
  1834. b("thead tr:first th", this).hover(function () { },
  1835. function () {
  1836. b(this).removeClass("ui-state-hover")
  1837. });
  1838. if (this.p.multiselect) {
  1839. var bd = [],
  1840. ca;
  1841. b("#cb_" + b.jgrid.jqID(a.p.id), this).bind("click",
  1842. function () {
  1843. a.p.selarrrow = [];
  1844. var c = !0 === a.p.frozenColumns ? a.p.id + "_frozen" : "";
  1845. this.checked ? (b(a.rows).each(function (d) {
  1846. 0 < d && !b(this).hasClass("ui-subgrid") && !b(this).hasClass("jqgroup") && !b(this).hasClass("ui-state-disabled") && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id))[a.p.useProp ? "prop" : "attr"]("checked", !0), b(this).addClass("ui-state-highlight").attr("aria-selected", "true"), a.p.selarrrow.push(this.id), a.p.selrow = this.id, c && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id), a.grid.fbDiv)[a.p.useProp ? "prop" : "attr"]("checked", !0), b("#" + b.jgrid.jqID(this.id), a.grid.fbDiv).addClass("ui-state-highlight")))
  1847. }), ca = !0, bd = []) : (b(a.rows).each(function (d) {
  1848. 0 < d && !b(this).hasClass("ui-subgrid") && !b(this).hasClass("ui-state-disabled") && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id))[a.p.useProp ? "prop" : "attr"]("checked", !1), b(this).removeClass("ui-state-highlight").attr("aria-selected", "false"), bd.push(this.id), c && (b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(this.id), a.grid.fbDiv)[a.p.useProp ? "prop" : "attr"]("checked", !1), b("#" + b.jgrid.jqID(this.id), a.grid.fbDiv).removeClass("ui-state-highlight")))
  1849. }), a.p.selrow = null, ca = !1);
  1850. b(a).triggerHandler("jqGridSelectAll", [ca ? a.p.selarrrow : bd, ca]);
  1851. b.isFunction(a.p.onSelectAll) && a.p.onSelectAll.call(a, ca ? a.p.selarrrow : bd, ca)
  1852. })
  1853. } !0 === a.p.autowidth && (D = b(m).innerWidth(), a.p.width = 0 < D ? D : "nw"); (function () {
  1854. var d = 0,
  1855. e = b.jgrid.cell_width ? 0 : r(a.p.cellLayout, 0),
  1856. g = 0,
  1857. f,
  1858. h = r(a.p.scrollOffset, 0),
  1859. k,
  1860. m = !1,
  1861. n,
  1862. p = 0,
  1863. q;
  1864. b.each(a.p.colModel,
  1865. function () {
  1866. void 0 === this.hidden && (this.hidden = !1);
  1867. if (a.p.grouping && a.p.autowidth) {
  1868. var c = b.inArray(this.name, a.p.groupingView.groupField);
  1869. 0 <= c && a.p.groupingView.groupColumnShow.length > c && (this.hidden = !a.p.groupingView.groupColumnShow[c])
  1870. }
  1871. this.widthOrg = k = r(this.width, 0); !1 === this.hidden && (d += k + e, this.fixed ? p += k + e : g++)
  1872. });
  1873. isNaN(a.p.width) && (a.p.width = d + (!1 !== a.p.shrinkToFit || isNaN(a.p.height) ? 0 : h));
  1874. c.width = a.p.width;
  1875. a.p.tblwidth = d; !1 === a.p.shrinkToFit && !0 === a.p.forceFit && (a.p.forceFit = !1); !0 === a.p.shrinkToFit && 0 < g && (n = c.width - e * g - p, isNaN(a.p.height) || (n -= h, m = !0), d = 0, b.each(a.p.colModel,
  1876. function (b) {
  1877. !1 !== this.hidden || this.fixed || (this.width = k = Math.round(n * this.width / (a.p.tblwidth - e * g - p)), d += k, f = b)
  1878. }), q = 0, m ? c.width - p - (d + e * g) !== h && (q = c.width - p - (d + e * g) - h) : m || 1 === Math.abs(c.width - p - (d + e * g)) || (q = c.width - p - (d + e * g)), a.p.colModel[f].width += q, a.p.tblwidth = d + q + e * g + p, a.p.tblwidth > a.p.width && (a.p.colModel[f].width -= a.p.tblwidth - parseInt(a.p.width, 10), a.p.tblwidth = a.p.width))
  1879. })();
  1880. b(m).css("width", c.width + "px").append("<div class='ui-jqgrid-resize-mark' id='rs_m" + a.p.id + "'>&#160;</div>");
  1881. b(k).css("width", c.width + "px");
  1882. var D = b("thead:first", a).get(0),
  1883. V = "";
  1884. a.p.footerrow && (V += "<table role='grid' style='width:" + a.p.tblwidth + "px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-" + f + "'>");
  1885. var k = b("tr:first", D),
  1886. be = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
  1887. a.p.disableClick = !1;
  1888. b("th", k).each(function (d) {
  1889. ja = a.p.colModel[d].width;
  1890. void 0 === a.p.colModel[d].resizable && (a.p.colModel[d].resizable = !0);
  1891. a.p.colModel[d].resizable ? (fa = document.createElement("span"), b(fa).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-" + f).css("cursor", "col-resize"), b(this).addClass(a.p.resizeclass)) : fa = "";
  1892. b(this).css("width", ja + "px").prepend(fa);
  1893. fa = null;
  1894. var e = "";
  1895. a.p.colModel[d].hidden && (b(this).css("display", "none"), e = "display:none;");
  1896. be += "<td role='gridcell' style='height:0px;width:" + ja + "px;" + e + "'></td>";
  1897. c.headers[d] = {
  1898. width: ja,
  1899. el: this
  1900. };
  1901. ka = a.p.colModel[d].sortable;
  1902. "boolean" !== typeof ka && (ka = a.p.colModel[d].sortable = !0);
  1903. e = a.p.colModel[d].name;
  1904. "cb" !== e && "subgrid" !== e && "rn" !== e && a.p.viewsortcols[2] && b(">div", this).addClass("ui-jqgrid-sortable");
  1905. ka && (a.p.multiSort ? a.p.viewsortcols[0] ? (b("div span.s-ico", this).show(), a.p.colModel[d].lso && b("div span.ui-icon-" + a.p.colModel[d].lso, this).removeClass("ui-state-disabled")) : a.p.colModel[d].lso && (b("div span.s-ico", this).show(), b("div span.ui-icon-" + a.p.colModel[d].lso, this).removeClass("ui-state-disabled")) : a.p.viewsortcols[0] ? (b("div span.s-ico", this).show(), d === a.p.lastsort && b("div span.ui-icon-" + a.p.sortorder, this).removeClass("ui-state-disabled")) : d === a.p.lastsort && (b("div span.s-ico", this).show(), b("div span.ui-icon-" + a.p.sortorder, this).removeClass("ui-state-disabled")));
  1906. a.p.footerrow && (V += "<td role='gridcell' " + p(d, 0, "", null, "", !1) + ">&#160;</td>")
  1907. }).mousedown(function (d) {
  1908. if (1 === b(d.target).closest("th>span.ui-jqgrid-resize").length) {
  1909. var e = sa(this);
  1910. if (!0 === a.p.forceFit) {
  1911. var g = a.p,
  1912. f = e,
  1913. h;
  1914. for (h = e + 1; h < a.p.colModel.length; h++) if (!0 !== a.p.colModel[h].hidden) {
  1915. f = h;
  1916. break
  1917. }
  1918. g.nv = f - e
  1919. }
  1920. c.dragStart(e, d, xa(e));
  1921. return !1
  1922. }
  1923. }).click(function (c) {
  1924. if (a.p.disableClick) return a.p.disableClick = !1;
  1925. var d = "th>div.ui-jqgrid-sortable",
  1926. e, g;
  1927. a.p.viewsortcols[2] || (d = "th>div>span>span.ui-grid-ico-sort");
  1928. c = b(c.target).closest(d);
  1929. if (1 === c.length) {
  1930. var f;
  1931. if (a.p.frozenColumns) {
  1932. var h = b(this)[0].id.substring(a.p.id.length + 1);
  1933. b(a.p.colModel).each(function (a) {
  1934. if (this.name === h) return f = a,
  1935. !1
  1936. })
  1937. } else f = sa(this);
  1938. a.p.viewsortcols[2] || (e = !0, g = c.attr("sort"));
  1939. null != f && ra(b("div", this)[0].id, f, e, g, this);
  1940. return !1
  1941. }
  1942. });
  1943. if (a.p.sortable && b.fn.sortable) try {
  1944. b(a).jqGrid("sortableColumns", k)
  1945. } catch (Ba) { }
  1946. a.p.footerrow && (V += "</tr></tbody></table>");
  1947. be += "</tr>";
  1948. k = document.createElement("tbody");
  1949. this.appendChild(k);
  1950. b(this).addClass("ui-jqgrid-btable").append(be);
  1951. var be = null,
  1952. k = b("<table class='ui-jqgrid-htable' style='width:" + a.p.tblwidth + "px' role='grid' aria-labelledby='gbox_" + this.id + "' cellspacing='0' cellpadding='0' border='0'></table>").append(D),
  1953. J = a.p.caption && !0 === a.p.hiddengrid ? !0 : !1;
  1954. g = b("<div class='ui-jqgrid-hbox" + ("rtl" === f ? "-rtl" : "") + "'><div class='edit_items' title='编辑显示字段'>...</div></div>");
  1955. D = null;
  1956. c.hDiv = document.createElement("div");
  1957. b(c.hDiv).css({
  1958. width: c.width + "px"
  1959. }).addClass("ui-state-default ui-jqgrid-hdiv").append(g);
  1960. b(g).append(k);
  1961. k = null;
  1962. J && b(c.hDiv).hide();
  1963. a.p.pager && ("string" === typeof a.p.pager ? "#" !== a.p.pager.substr(0, 1) && (a.p.pager = "#" + a.p.pager) : a.p.pager = "#" + b(a.p.pager).attr("id"), b(a.p.pager).css({
  1964. width: c.width + "px"
  1965. }).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom").appendTo(m), J && b(a.p.pager).hide(), qa(a.p.pager, "")); !1 === a.p.cellEdit && !0 === a.p.hoverrows && b(a).bind("mouseover",
  1966. function (a) {
  1967. t = b(a.target).closest("tr.jqgrow");
  1968. "ui-subgrid" !== b(t).attr("class") && b(t).addClass("ui-state-hover")
  1969. }).bind("mouseout",
  1970. function (a) {
  1971. t = b(a.target).closest("tr.jqgrow");
  1972. b(t).removeClass("ui-state-hover")
  1973. });
  1974. var B, N, ma;
  1975. b(a).before(c.hDiv).click(function (c) {
  1976. y = c.target;
  1977. t = b(y, a.rows).closest("tr.jqgrow");
  1978. if (0 === b(t).length || -1 < t[0].className.indexOf("ui-state-disabled") || (b(y, a).closest("table.ui-jqgrid-btable").attr("id") || "").replace("_frozen", "") !== a.id) return this;
  1979. var d = b(y).hasClass("cbox"),
  1980. e = b(a).triggerHandler("jqGridBeforeSelectRow", [t[0].id, c]); (e = !1 === e || "stop" === e ? !1 : !0) && b.isFunction(a.p.beforeSelectRow) && (e = a.p.beforeSelectRow.call(a, t[0].id, c));
  1981. if ("A" !== y.tagName && ("INPUT" !== y.tagName && "TEXTAREA" !== y.tagName && "OPTION" !== y.tagName && "SELECT" !== y.tagName || d) && !0 === e) if (B = t[0].id, N = b.jgrid.getCellIndex(y), ma = b(y).closest("td,th").html(), b(a).triggerHandler("jqGridCellSelect", [B, N, ma, c]), b.isFunction(a.p.onCellSelect) && a.p.onCellSelect.call(a, B, N, ma, c), !0 === a.p.cellEdit) if (a.p.multiselect && d) b(a).jqGrid("setSelection", B, !0, c);
  1982. else {
  1983. B = t[0].rowIndex;
  1984. try {
  1985. b(a).jqGrid("editCell", B, N, !0)
  1986. } catch (g) { }
  1987. } else if (a.p.multikey) c[a.p.multikey] ? b(a).jqGrid("setSelection", B, !0, c) : a.p.multiselect && d && (d = b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + B).is(":checked"), b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + B)[a.p.useProp ? "prop" : "attr"]("checked", d));
  1988. else {
  1989. if (a.p.multiselect && a.p.multiboxonly && !d) {
  1990. var f = a.p.frozenColumns ? a.p.id + "_frozen" : "";
  1991. b(a.p.selarrrow).each(function (c, d) {
  1992. var e = b(a).jqGrid("getGridRowById", d);
  1993. b(e).removeClass("ui-state-highlight");
  1994. b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(d))[a.p.useProp ? "prop" : "attr"]("checked", !1);
  1995. f && (b("#" + b.jgrid.jqID(d), "#" + b.jgrid.jqID(f)).removeClass("ui-state-highlight"), b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(d), "#" + b.jgrid.jqID(f))[a.p.useProp ? "prop" : "attr"]("checked", !1))
  1996. });
  1997. a.p.selarrrow = []
  1998. }
  1999. b(a).jqGrid("setSelection", B, !0, c)
  2000. }
  2001. }).bind("reloadGrid",
  2002. function (c, d) {
  2003. !0 === a.p.treeGrid && (a.p.datatype = a.p.treedatatype);
  2004. d && d.current && a.grid.selectionPreserver(a);
  2005. "local" === a.p.datatype ? (b(a).jqGrid("resetSelection"), a.p.data.length && O()) : a.p.treeGrid || (a.p.selrow = null, a.p.multiselect && (a.p.selarrrow = [], ha(!1)), a.p.savedRow = []);
  2006. a.p.scroll && X.call(a, !0, !1);
  2007. if (d && d.page) {
  2008. var e = d.page;
  2009. e > a.p.lastpage && (e = a.p.lastpage);
  2010. 1 > e && (e = 1);
  2011. a.p.page = e;
  2012. a.grid.bDiv.scrollTop = a.grid.prevRowHeight ? (e - 1) * a.grid.prevRowHeight * a.p.rowNum : 0
  2013. }
  2014. a.grid.prevRowHeight && a.p.scroll ? (delete a.p.lastpage, a.grid.populateVisible()) : a.grid.populate(); !0 === a.p._inlinenav && b(a).jqGrid("showAddEditButtons");
  2015. return !1
  2016. }).dblclick(function (c) {
  2017. y = c.target;
  2018. t = b(y, a.rows).closest("tr.jqgrow");
  2019. 0 !== b(t).length && (B = t[0].rowIndex, N = b.jgrid.getCellIndex(y), b(a).triggerHandler("jqGridDblClickRow", [b(t).attr("id"), B, N, c]), b.isFunction(a.p.ondblClickRow) && a.p.ondblClickRow.call(a, b(t).attr("id"), B, N, c))
  2020. }).bind("contextmenu",
  2021. function (c) { });
  2022. c.bDiv = document.createElement("div");
  2023. n && "auto" === String(a.p.height).toLowerCase() && (a.p.height = "100%");
  2024. b(c.bDiv).append(b('<div style="position:relative;' + (n && 8 > b.jgrid.msiever() ? "height:0.01%;" : "") + '"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({
  2025. height: a.p.height + (isNaN(a.p.height) ? "" : "px"),
  2026. width: c.width + "px"
  2027. }).scroll(c.scrollGrid);
  2028. b("table:first", c.bDiv).css({
  2029. width: a.p.tblwidth + "px"
  2030. });
  2031. b.support.tbody || 2 === b("tbody", this).length && b("tbody:gt(0)", this).remove();
  2032. a.p.multikey && (b.jgrid.msie ? b(c.bDiv).bind("selectstart",
  2033. function () {
  2034. return !1
  2035. }) : b(c.bDiv).bind("mousedown",
  2036. function () {
  2037. return !1
  2038. }));
  2039. J && b(c.bDiv).hide();
  2040. c.cDiv = document.createElement("div");
  2041. var bf = !0 === a.p.hidegrid ? b("<a role='link' class='ui-jqgrid-titlebar-close ui-corner-all HeaderButton' />").hover(function () {
  2042. bf.addClass("ui-state-hover")
  2043. },
  2044. function () {
  2045. bf.removeClass("ui-state-hover")
  2046. }).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl" === f ? "left" : "right", "0px") : "";
  2047. b(c.cDiv).append(bf).append("<span class='ui-jqgrid-title'>" + a.p.caption + "</span>").addClass("ui-jqgrid-titlebar ui-jqgrid-caption" + ("rtl" === f ? "-rtl" : "") + " ui-widget-header ui-corner-top ui-helper-clearfix");
  2048. b(c.cDiv).insertBefore(c.hDiv);
  2049. a.p.toolbar[0] && (c.uDiv = document.createElement("div"), "top" === a.p.toolbar[1] ? b(c.uDiv).insertBefore(c.hDiv) : "bottom" === a.p.toolbar[1] && b(c.uDiv).insertAfter(c.hDiv), "both" === a.p.toolbar[1] ? (c.ubDiv = document.createElement("div"), b(c.uDiv).addClass("ui-userdata ui-state-default").attr("id", "t_" + this.id).insertBefore(c.hDiv), b(c.ubDiv).addClass("ui-userdata ui-state-default").attr("id", "tb_" + this.id).insertAfter(c.hDiv), J && b(c.ubDiv).hide()) : b(c.uDiv).width(c.width).addClass("ui-userdata ui-state-default").attr("id", "t_" + this.id), J && b(c.uDiv).hide());
  2050. a.p.toppager && (a.p.toppager = b.jgrid.jqID(a.p.id) + "_toppager", c.topDiv = b("<div id='" + a.p.toppager + "'></div>")[0], a.p.toppager = "#" + a.p.toppager, b(c.topDiv).addClass("ui-state-default ui-jqgrid-toppager").width(c.width).insertBefore(c.hDiv), qa(a.p.toppager, "_t"));
  2051. a.p.footerrow && (c.sDiv = b("<div class='ui-jqgrid-sdiv'></div>")[0], g = b("<div class='ui-jqgrid-hbox" + ("rtl" === f ? "-rtl" : "") + "'></div>"), b(c.sDiv).append(g).width(c.width).insertAfter(c.hDiv), b(g).append(V), c.footers = b(".ui-jqgrid-ftable", c.sDiv)[0].rows[0].cells, a.p.rownumbers && (c.footers[0].className = "ui-state-default jqgrid-rownum"), J && b(c.sDiv).hide());
  2052. g = null;
  2053. if (a.p.caption) {
  2054. var bg = a.p.datatype; !0 === a.p.hidegrid && (b(".ui-jqgrid-titlebar-close", c.cDiv).click(function (d) {
  2055. var e = b.isFunction(a.p.onHeaderClick),
  2056. g = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
  2057. f,
  2058. h = this; !0 === a.p.toolbar[0] && ("both" === a.p.toolbar[1] && (g += ", #" + b(c.ubDiv).attr("id")), g += ", #" + b(c.uDiv).attr("id"));
  2059. f = b(g, "#gview_" + b.jgrid.jqID(a.p.id)).length;
  2060. "visible" === a.p.gridstate ? b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideUp("fast",
  2061. function () {
  2062. f--;
  2063. 0 === f && (b("span", h).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"), a.p.gridstate = "hidden", b("#gbox_" + b.jgrid.jqID(a.p.id)).hasClass("ui-resizable") && b(".ui-resizable-handle", "#gbox_" + b.jgrid.jqID(a.p.id)).hide(), b(a).triggerHandler("jqGridHeaderClick", [a.p.gridstate, d]), e && (J || a.p.onHeaderClick.call(a, a.p.gridstate, d)))
  2064. }) : "hidden" === a.p.gridstate && b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideDown("fast",
  2065. function () {
  2066. f--;
  2067. 0 === f && (b("span", h).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"), J && (a.p.datatype = bg, Q(), J = !1), a.p.gridstate = "visible", b("#gbox_" + b.jgrid.jqID(a.p.id)).hasClass("ui-resizable") && b(".ui-resizable-handle", "#gbox_" + b.jgrid.jqID(a.p.id)).show(), b(a).triggerHandler("jqGridHeaderClick", [a.p.gridstate, d]), e && (J || a.p.onHeaderClick.call(a, a.p.gridstate, d)))
  2068. });
  2069. return !1
  2070. }), J && (a.p.datatype = "local", b(".ui-jqgrid-titlebar-close", c.cDiv).trigger("click")))
  2071. } else b(c.cDiv).hide();
  2072. b(c.hDiv).after(c.bDiv).mousemove(function (a) {
  2073. if (c.resizing) return c.dragMove(a),
  2074. !1
  2075. });
  2076. b(".ui-jqgrid-labels", c.hDiv).bind("selectstart",
  2077. function () {
  2078. return !1
  2079. });
  2080. b(document).bind("mouseup.jqGrid" + a.p.id,
  2081. function () {
  2082. return c.resizing ? (c.dragEnd(), !1) : !0
  2083. });
  2084. a.formatCol = p;
  2085. a.sortData = ra;
  2086. a.updatepager = function (c, d) {
  2087. var e, g, f, h, k, l, m, n = "",
  2088. p = a.p.pager ? "_" + b.jgrid.jqID(a.p.pager.substr(1)) : "",
  2089. q = a.p.toppager ? "_" + a.p.toppager.substr(1) : "";
  2090. f = parseInt(a.p.page, 10) - 1;
  2091. 0 > f && (f = 0);
  2092. f *= parseInt(a.p.rowNum, 10);
  2093. k = f + a.p.reccount;
  2094. if (a.p.scroll) {
  2095. e = b("tbody:first > tr:gt(0)", a.grid.bDiv);
  2096. f = k - e.length;
  2097. a.p.reccount = e.length;
  2098. if (e = e.outerHeight() || a.grid.prevRowHeight) g = f * e,
  2099. m = parseInt(a.p.records, 10) * e,
  2100. b(">div:first", a.grid.bDiv).css({
  2101. height: m
  2102. }).children("div:first").css({
  2103. height: g,
  2104. display: g ? "" : "none"
  2105. }),
  2106. 0 == a.grid.bDiv.scrollTop && 1 < a.p.page && (a.grid.bDiv.scrollTop = a.p.rowNum * (a.p.page - 1) * e);
  2107. a.grid.bDiv.scrollLeft = a.grid.hDiv.scrollLeft
  2108. }
  2109. n = a.p.pager || "";
  2110. if (n += a.p.toppager ? n ? "," + a.p.toppager : a.p.toppager : "") m = b.jgrid.formatter.integer || {},
  2111. e = r(a.p.page),
  2112. g = r(a.p.lastpage),
  2113. b(".selbox", n)[this.p.useProp ? "prop" : "attr"]("disabled", !1),
  2114. !0 === a.p.pginput && (b(".ui-pg-input", n).val(a.p.page), h = a.p.toppager ? "#sp_1" + p + ",#sp_1" + q : "#sp_1" + p, b(h).html(b.fmatter ? b.fmatter.util.NumberFormat(a.p.lastpage, m) : a.p.lastpage)),
  2115. a.p.viewrecords && (0 === a.p.reccount ? b(".ui-paging-info", n).html(a.p.emptyrecords) : (h = f + 1, l = a.p.records, b.fmatter && (h = b.fmatter.util.NumberFormat(h, m), k = b.fmatter.util.NumberFormat(k, m), l = b.fmatter.util.NumberFormat(l, m)), b(".ui-paging-info", n).html(b.jgrid.format(a.p.recordtext, h.replace(/ /g, ''), k.replace(/ /g, ''), l.replace(/ /g, ''), (Number(a.p.totaltime) + Number(a.p.costtime)))))),
  2116. !0 === a.p.pgbuttons && (0 >= e && (e = g = 0), 1 === e || 0 === e ? (b("#first" + p + ", #prev" + p).addClass("ui-state-disabled").removeClass("ui-state-hover"), a.p.toppager && b("#first_t" + q + ", #prev_t" + q).addClass("ui-state-disabled").removeClass("ui-state-hover")) : (b("#first" + p + ", #prev" + p).removeClass("ui-state-disabled"), a.p.toppager && b("#first_t" + q + ", #prev_t" + q).removeClass("ui-state-disabled")), e === g || 0 === e ? (b("#next" + p + ", #last" + p).addClass("ui-state-disabled").removeClass("ui-state-hover"), a.p.toppager && b("#next_t" + q + ", #last_t" + q).addClass("ui-state-disabled").removeClass("ui-state-hover")) : (b("#next" + p + ", #last" + p).removeClass("ui-state-disabled"), a.p.toppager && b("#next_t" + q + ", #last_t" + q).removeClass("ui-state-disabled"))); !0 === c && !0 === a.p.rownumbers && b(">td.jqgrid-rownum", a.rows).each(function (a) {
  2117. b(this).html(f + 1 + a)
  2118. });
  2119. d && a.p.jqgdnd && b(a).jqGrid("gridDnD", "updateDnD");
  2120. b(a).triggerHandler("jqGridGridComplete");
  2121. b.isFunction(a.p.gridComplete) && a.p.gridComplete.call(a);
  2122. b(a).triggerHandler("jqGridAfterGridComplete")
  2123. };
  2124. a.refreshIndex = O;
  2125. a.setHeadCheckBox = ha;
  2126. a.constructTr = $;
  2127. a.formatter = function (a, b, c, d, e) {
  2128. return x(a, b, c, d, e)
  2129. };
  2130. b.extend(c, {
  2131. populate: Q,
  2132. emptyRows: X,
  2133. beginReq: P,
  2134. endReq: T
  2135. });
  2136. this.grid = c;
  2137. a.addXmlData = function (b) {
  2138. K(b, a.grid.bDiv)
  2139. };
  2140. a.addJSONData = function (b) {
  2141. Y(b, a.grid.bDiv)
  2142. };
  2143. this.grid.cols = this.rows[0].cells;
  2144. b(a).triggerHandler("jqGridInitGrid");
  2145. b.isFunction(a.p.onInitGrid) && a.p.onInitGrid.call(a);
  2146. Q();
  2147. a.p.hiddengrid = !1
  2148. }
  2149. }
  2150. }
  2151. })
  2152. };
  2153. b.jgrid.extend({
  2154. getGridParam: function (b) {
  2155. var f = this[0];
  2156. if (f && f.grid) return b ? void 0 !== f.p[b] ? f.p[b] : null : f.p
  2157. },
  2158. setGridParam: function (e) {
  2159. return this.each(function () {
  2160. this.grid && "object" === typeof e && b.extend(!0, this.p, e)
  2161. })
  2162. },
  2163. getGridRowById: function (e) {
  2164. var f;
  2165. this.each(function () {
  2166. try {
  2167. for (var c = this.rows.length; c--;) if (e.toString() === this.rows[c].id) {
  2168. f = this.rows[c];
  2169. break
  2170. }
  2171. } catch (d) {
  2172. f = b(this.grid.bDiv).find("#" + b.jgrid.jqID(e))
  2173. }
  2174. });
  2175. return f
  2176. },
  2177. getDataIDs: function () {
  2178. var e = [],
  2179. f = 0,
  2180. c,
  2181. d = 0;
  2182. this.each(function () {
  2183. if ((c = this.rows.length) && 0 < c) for (; f < c;) b(this.rows[f]).hasClass("jqgrow") && (e[d] = this.rows[f].id, d++),
  2184. f++
  2185. });
  2186. return e
  2187. },
  2188. setSelection: function (e, f, c) {
  2189. return this.each(function () {
  2190. var d, a, l, g, h, k;
  2191. void 0 !== e && (f = !1 === f ? !1 : !0, !(a = b(this).jqGrid("getGridRowById", e)) || !a.className || -1 < a.className.indexOf("ui-state-disabled") || (!0 === this.p.scrollrows && (l = b(this).jqGrid("getGridRowById", e).rowIndex, 0 <= l && (d = b(this.grid.bDiv)[0].clientHeight, g = b(this.grid.bDiv)[0].scrollTop, h = b(this.rows[l]).position().top, l = this.rows[l].clientHeight, h + l >= d + g ? b(this.grid.bDiv)[0].scrollTop = h - (d + g) + l + g : h < d + g && h < g && (b(this.grid.bDiv)[0].scrollTop = h))), !0 === this.p.frozenColumns && (k = this.p.id + "_frozen"), this.p.multiselect ? (this.setHeadCheckBox(!1), this.p.selrow = a.id, g = b.inArray(this.p.selrow, this.p.selarrrow), -1 === g ? ("ui-subgrid" !== a.className && b(a).addClass("ui-state-highlight").attr("aria-selected", "true"), d = !0, this.p.selarrrow.push(this.p.selrow)) : ("ui-subgrid" !== a.className && b(a).removeClass("ui-state-highlight").attr("aria-selected", "false"), d = !1, this.p.selarrrow.splice(g, 1), h = this.p.selarrrow[0], this.p.selrow = void 0 === h ? null : h), b("#jqg_" + b.jgrid.jqID(this.p.id) + "_" + b.jgrid.jqID(a.id))[this.p.useProp ? "prop" : "attr"]("checked", d), k && (-1 === g ? b("#" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k)).addClass("ui-state-highlight") : b("#" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k)).removeClass("ui-state-highlight"), b("#jqg_" + b.jgrid.jqID(this.p.id) + "_" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k))[this.p.useProp ? "prop" : "attr"]("checked", d)), f && (b(this).triggerHandler("jqGridSelectRow", [a.id, d, c]), this.p.onSelectRow && this.p.onSelectRow.call(this, a.id, d, c))) : "ui-subgrid" !== a.className && (this.p.selrow !== a.id ? (b(b(this).jqGrid("getGridRowById", this.p.selrow)).removeClass("ui-state-highlight").attr({
  2192. "aria-selected": "false",
  2193. tabindex: "-1"
  2194. }), b(a).addClass("ui-state-highlight").attr({
  2195. "aria-selected": "true",
  2196. tabindex: "0"
  2197. }), k && (b("#" + b.jgrid.jqID(this.p.selrow), "#" + b.jgrid.jqID(k)).removeClass("ui-state-highlight"), b("#" + b.jgrid.jqID(e), "#" + b.jgrid.jqID(k)).addClass("ui-state-highlight")), d = !0) : d = !1, this.p.selrow = a.id, f && (b(this).triggerHandler("jqGridSelectRow", [a.id, d, c]), this.p.onSelectRow && this.p.onSelectRow.call(this, a.id, d, c)))))
  2198. })
  2199. },
  2200. resetSelection: function (e) {
  2201. return this.each(function () {
  2202. var f = this,
  2203. c, d; !0 === f.p.frozenColumns && (d = f.p.id + "_frozen");
  2204. if (void 0 !== e) {
  2205. c = e === f.p.selrow ? f.p.selrow : e;
  2206. b("#" + b.jgrid.jqID(f.p.id) + " tbody:first tr#" + b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
  2207. d && b("#" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight");
  2208. if (f.p.multiselect) {
  2209. b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(f.p.id))[f.p.useProp ? "prop" : "attr"]("checked", !1);
  2210. if (d) b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d))[f.p.useProp ? "prop" : "attr"]("checked", !1);
  2211. f.setHeadCheckBox(!1)
  2212. }
  2213. c = null
  2214. } else f.p.multiselect ? (b(f.p.selarrrow).each(function (a, c) {
  2215. b(b(f).jqGrid("getGridRowById", c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
  2216. b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c))[f.p.useProp ? "prop" : "attr"]("checked", !1);
  2217. d && (b("#" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight"), b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d))[f.p.useProp ? "prop" : "attr"]("checked", !1))
  2218. }), f.setHeadCheckBox(!1), f.p.selarrrow = [], f.p.selrow = null) : f.p.selrow && (b("#" + b.jgrid.jqID(f.p.id) + " tbody:first tr#" + b.jgrid.jqID(f.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected", "false"), d && b("#" + b.jgrid.jqID(f.p.selrow), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight"), f.p.selrow = null); !0 === f.p.cellEdit && 0 <= parseInt(f.p.iCol, 10) && 0 <= parseInt(f.p.iRow, 10) && (b("td:eq(" + f.p.iCol + ")", f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"), b(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));
  2219. f.p.savedRow = []
  2220. })
  2221. },
  2222. getRowData: function (e) {
  2223. var f = {},
  2224. c, d = !1,
  2225. a, l = 0;
  2226. this.each(function () {
  2227. var g = this,
  2228. h, k;
  2229. if (void 0 === e) d = !0,
  2230. c = [],
  2231. a = g.rows.length;
  2232. else {
  2233. k = b(g).jqGrid("getGridRowById", e);
  2234. if (!k) return f;
  2235. a = 2
  2236. }
  2237. for (; l < a;) d && (k = g.rows[l]),
  2238. b(k).hasClass("jqgrow") && (b('td[role="gridcell"]', k).each(function (a) {
  2239. h = g.p.colModel[a].name;
  2240. if ("cb" !== h && "subgrid" !== h && "rn" !== h) if (!0 === g.p.treeGrid && h === g.p.ExpandColumn) f[h] = b.jgrid.htmlDecode(b("span:first", this).html());
  2241. else try {
  2242. f[h] = b.unformat.call(g, this, {
  2243. rowId: k.id,
  2244. colModel: g.p.colModel[a]
  2245. },
  2246. a)
  2247. } catch (c) {
  2248. f[h] = b.jgrid.htmlDecode(b(this).html())
  2249. }
  2250. }), d && (c.push(f), f = {})),
  2251. l++
  2252. });
  2253. return c || f
  2254. },
  2255. delRowData: function (e) {
  2256. var f = !1,
  2257. c, d;
  2258. this.each(function () {
  2259. c = b(this).jqGrid("getGridRowById", e);
  2260. if (!c) return !1;
  2261. b(c).remove();
  2262. this.p.records--;
  2263. this.p.reccount--;
  2264. this.updatepager(!0, !1);
  2265. f = !0;
  2266. this.p.multiselect && (d = b.inArray(e, this.p.selarrrow), -1 !== d && this.p.selarrrow.splice(d, 1));
  2267. this.p.selrow = this.p.multiselect && 0 < this.p.selarrrow.length ? this.p.selarrrow[this.p.selarrrow.length - 1] : null;
  2268. if ("local" === this.p.datatype) {
  2269. var a = b.jgrid.stripPref(this.p.idPrefix, e),
  2270. a = this.p._index[a];
  2271. void 0 !== a && (this.p.data.splice(a, 1), this.refreshIndex())
  2272. }
  2273. if (!0 === this.p.altRows && f) {
  2274. var l = this.p.altclass;
  2275. b(this.rows).each(function (a) {
  2276. 1 === a % 2 ? b(this).addClass(l) : b(this).removeClass(l)
  2277. })
  2278. }
  2279. });
  2280. return f
  2281. },
  2282. setRowData: function (e, f, c) {
  2283. var d, a = !0,
  2284. l;
  2285. this.each(function () {
  2286. if (!this.grid) return !1;
  2287. var g = this,
  2288. h, k, n = typeof c,
  2289. m = {};
  2290. k = b(this).jqGrid("getGridRowById", e);
  2291. if (!k) return !1;
  2292. if (f) try {
  2293. if (b(this.p.colModel).each(function (a) {
  2294. d = this.name;
  2295. var c = b.jgrid.getAccessor(f, d);
  2296. void 0 !== c && (m[d] = this.formatter && "string" === typeof this.formatter && "date" === this.formatter ? b.unformat.date.call(g, c, this) : c, h = g.formatter(e, c, a, f, "edit"), l = this.title ? {
  2297. title: b.jgrid.stripHtml(h)
  2298. } : {},
  2299. !0 === g.p.treeGrid && d === g.p.ExpandColumn ? b("td[role='gridcell']:eq(" + a + ") > span:first", k).html(h).attr(l) : b("td[role='gridcell']:eq(" + a + ")", k).html(h).attr(l))
  2300. }), "local" === g.p.datatype) {
  2301. var r = b.jgrid.stripPref(g.p.idPrefix, e),
  2302. p = g.p._index[r],
  2303. q;
  2304. if (g.p.treeGrid) for (q in g.p.treeReader) g.p.treeReader.hasOwnProperty(q) && delete m[g.p.treeReader[q]];
  2305. void 0 !== p && (g.p.data[p] = b.extend(!0, g.p.data[p], m));
  2306. m = null
  2307. }
  2308. } catch (x) {
  2309. a = !1
  2310. }
  2311. a && ("string" === n ? b(k).addClass(c) : null !== c && "object" === n && b(k).css(c), b(g).triggerHandler("jqGridAfterGridComplete"))
  2312. });
  2313. return a
  2314. },
  2315. addRowData: function (e, f, c, d) {
  2316. c || (c = "last");
  2317. var a = !1,
  2318. l, g, h, k, n, m, r, p, q = "",
  2319. x, G, U, M, ea, W;
  2320. f && (b.isArray(f) ? (x = !0, c = "last", G = e) : (f = [f], x = !1), this.each(function () {
  2321. var X = f.length;
  2322. n = !0 === this.p.rownumbers ? 1 : 0;
  2323. h = !0 === this.p.multiselect ? 1 : 0;
  2324. k = !0 === this.p.subGrid ? 1 : 0;
  2325. x || (void 0 !== e ? e = String(e) : (e = b.jgrid.randId(), !1 !== this.p.keyIndex && (G = this.p.colModel[this.p.keyIndex + h + k + n].name, void 0 !== f[0][G] && (e = f[0][G]))));
  2326. U = this.p.altclass;
  2327. for (var O = 0,
  2328. $ = "",
  2329. K = {},
  2330. Y = b.isFunction(this.p.afterInsertRow) ? !0 : !1; O < X;) {
  2331. M = f[O];
  2332. g = [];
  2333. if (x) {
  2334. try {
  2335. e = M[G],
  2336. void 0 === e && (e = b.jgrid.randId())
  2337. } catch (oa) {
  2338. e = b.jgrid.randId()
  2339. }
  2340. $ = !0 === this.p.altRows ? 0 === (this.rows.length - 1) % 2 ? U : "" : ""
  2341. }
  2342. W = e;
  2343. e = this.p.idPrefix + e;
  2344. n && (q = this.formatCol(0, 1, "", null, e, !0), g[g.length] = '<td role="gridcell" class="ui-state-default jqgrid-rownum" ' + q + ">0</td>");
  2345. h && (p = '<input role="checkbox" type="checkbox" id="jqg_' + this.p.id + "_" + e + '" class="cbox"/>', q = this.formatCol(n, 1, "", null, e, !0), g[g.length] = '<td role="gridcell" ' + q + ">" + p + "</td>");
  2346. k && (g[g.length] = b(this).jqGrid("addSubGridCell", h + n, 1));
  2347. for (r = h + k + n; r < this.p.colModel.length; r++) ea = this.p.colModel[r],
  2348. l = ea.name,
  2349. K[l] = M[l],
  2350. p = this.formatter(e, b.jgrid.getAccessor(M, l), r, M),
  2351. q = this.formatCol(r, 1, p, M, e, K),
  2352. g[g.length] = '<td role="gridcell" ' + q + ">" + p + "</td>";
  2353. g.unshift(this.constructTr(e, !1, $, K, M, !1));
  2354. g[g.length] = "</tr>";
  2355. if (0 === this.rows.length) b("table:first", this.grid.bDiv).append(g.join(""));
  2356. else switch (c) {
  2357. case "last":
  2358. b(this.rows[this.rows.length - 1]).after(g.join(""));
  2359. m = this.rows.length - 1;
  2360. break;
  2361. case "first":
  2362. b(this.rows[0]).after(g.join(""));
  2363. m = 1;
  2364. break;
  2365. case "after":
  2366. if (m = b(this).jqGrid("getGridRowById", d)) b(this.rows[m.rowIndex + 1]).hasClass("ui-subgrid") ? b(this.rows[m.rowIndex + 1]).after(g) : b(m).after(g.join("")),
  2367. m = m.rowIndex + 1;
  2368. break;
  2369. case "before":
  2370. if (m = b(this).jqGrid("getGridRowById", d)) b(m).before(g.join("")),
  2371. m = m.rowIndex - 1
  2372. } !0 === this.p.subGrid && b(this).jqGrid("addSubGrid", h + n, m);
  2373. this.p.records++;
  2374. this.p.reccount++;
  2375. b(this).triggerHandler("jqGridAfterInsertRow", [e, M, M]);
  2376. Y && this.p.afterInsertRow.call(this, e, M, M);
  2377. O++;
  2378. "local" === this.p.datatype && (K[this.p.localReader.id] = W, this.p._index[W] = this.p.data.length, this.p.data.push(K), K = {})
  2379. } !0 !== this.p.altRows || x || ("last" === c ? 1 === (this.rows.length - 1) % 2 && b(this.rows[this.rows.length - 1]).addClass(U) : b(this.rows).each(function (a) {
  2380. 1 === a % 2 ? b(this).addClass(U) : b(this).removeClass(U)
  2381. }));
  2382. this.updatepager(!0, !0);
  2383. a = !0
  2384. }));
  2385. return a
  2386. },
  2387. footerData: function (e, f, c) {
  2388. function d(a) {
  2389. for (var b in a) if (a.hasOwnProperty(b)) return !1;
  2390. return !0
  2391. }
  2392. var a, l = !1,
  2393. g = {},
  2394. h;
  2395. void 0 == e && (e = "get");
  2396. "boolean" !== typeof c && (c = !0);
  2397. e = e.toLowerCase();
  2398. this.each(function () {
  2399. var k = this,
  2400. n;
  2401. if (!k.grid || !k.p.footerrow || "set" === e && d(f)) return !1;
  2402. l = !0;
  2403. b(this.p.colModel).each(function (d) {
  2404. a = this.name;
  2405. "set" === e ? void 0 !== f[a] && (n = c ? k.formatter("", f[a], d, f, "edit") : f[a], h = this.title ? {
  2406. title: b.jgrid.stripHtml(n)
  2407. } : {},
  2408. b("tr.footrow td:eq(" + d + ")", k.grid.sDiv).html(n).attr(h), l = !0) : "get" === e && (g[a] = b("tr.footrow td:eq(" + d + ")", k.grid.sDiv).html())
  2409. })
  2410. });
  2411. return "get" === e ? g : l
  2412. },
  2413. showHideCol: function (e, f) {
  2414. return this.each(function () {
  2415. var c = this,
  2416. d = !1,
  2417. a = b.jgrid.cell_width ? 0 : c.p.cellLayout,
  2418. l;
  2419. if (c.grid) {
  2420. "string" === typeof e && (e = [e]);
  2421. f = "none" !== f ? "" : "none";
  2422. var g = "" === f ? !0 : !1,
  2423. h = c.p.groupHeader && ("object" === typeof c.p.groupHeader || b.isFunction(c.p.groupHeader));
  2424. h && b(c).jqGrid("destroyGroupHeader", !1);
  2425. b(this.p.colModel).each(function (h) {
  2426. if (-1 !== b.inArray(this.name, e) && this.hidden === g) {
  2427. if (!0 === c.p.frozenColumns && !0 === this.frozen) return !0;
  2428. b("tr[role=rowheader]", c.grid.hDiv).each(function () {
  2429. b(this.cells[h]).css("display", f)
  2430. });
  2431. b(c.rows).each(function () {
  2432. b(this).hasClass("jqgroup") || b(this.cells[h]).css("display", f)
  2433. });
  2434. c.p.footerrow && b("tr.footrow td:eq(" + h + ")", c.grid.sDiv).css("display", f);
  2435. l = parseInt(this.width, 10);
  2436. c.p.tblwidth = "none" === f ? c.p.tblwidth - (l + a) : c.p.tblwidth + (l + a);
  2437. this.hidden = !g;
  2438. d = !0;
  2439. b(c).triggerHandler("jqGridShowHideCol", [g, this.name, h])
  2440. }
  2441. }); !0 === d && (!0 !== c.p.shrinkToFit || isNaN(c.p.height) || (c.p.tblwidth += parseInt(c.p.scrollOffset, 10)), b(c).jqGrid("setGridWidth", !0 === c.p.shrinkToFit ? c.p.tblwidth : c.p.width));
  2442. h && b(c).jqGrid("setGroupHeaders", c.p.groupHeader)
  2443. }
  2444. })
  2445. },
  2446. hideCol: function (e) {
  2447. return this.each(function () {
  2448. b(this).jqGrid("showHideCol", e, "none")
  2449. })
  2450. },
  2451. showCol: function (e) {
  2452. return this.each(function () {
  2453. b(this).jqGrid("showHideCol", e, "")
  2454. })
  2455. },
  2456. remapColumns: function (e, f, c) {
  2457. function d(a) {
  2458. var c;
  2459. c = a.length ? b.makeArray(a) : b.extend({},
  2460. a);
  2461. b.each(e,
  2462. function (b) {
  2463. a[b] = c[this]
  2464. })
  2465. }
  2466. function a(a, c) {
  2467. b(">tr" + (c || ""), a).each(function () {
  2468. var a = this,
  2469. c = b.makeArray(a.cells);
  2470. b.each(e,
  2471. function () {
  2472. var b = c[this];
  2473. b && a.appendChild(b)
  2474. })
  2475. })
  2476. }
  2477. var l = this.get(0);
  2478. d(l.p.colModel);
  2479. d(l.p.colNames);
  2480. d(l.grid.headers);
  2481. a(b("thead:first", l.grid.hDiv), c && ":not(.ui-jqgrid-labels)");
  2482. f && a(b("#" + b.jgrid.jqID(l.p.id) + " tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
  2483. l.p.footerrow && a(b("tbody:first", l.grid.sDiv));
  2484. l.p.remapColumns && (l.p.remapColumns.length ? d(l.p.remapColumns) : l.p.remapColumns = b.makeArray(e));
  2485. l.p.lastsort = b.inArray(l.p.lastsort, e);
  2486. l.p.treeGrid && (l.p.expColInd = b.inArray(l.p.expColInd, e));
  2487. b(l).triggerHandler("jqGridRemapColumns", [e, f, c])
  2488. },
  2489. setGridWidth: function (e, f) {
  2490. return this.each(function () {
  2491. if (this.grid) {
  2492. var c = this,
  2493. d, a = 0,
  2494. l = b.jgrid.cell_width ? 0 : c.p.cellLayout,
  2495. g,
  2496. h = 0,
  2497. k = !1,
  2498. n = c.p.scrollOffset,
  2499. m,
  2500. r = 0,
  2501. p;
  2502. "boolean" !== typeof f && (f = c.p.shrinkToFit);
  2503. if (!isNaN(e)) {
  2504. e = parseInt(e, 10);
  2505. c.grid.width = c.p.width = e;
  2506. b("#gbox_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
  2507. b("#gview_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
  2508. b(c.grid.bDiv).css("width", e + "px");
  2509. b(c.grid.hDiv).css("width", e + "px");
  2510. c.p.pager && b(c.p.pager).css("width", e + "px");
  2511. c.p.toppager && b(c.p.toppager).css("width", e + "px"); !0 === c.p.toolbar[0] && (b(c.grid.uDiv).css("width", e + "px"), "both" === c.p.toolbar[1] && b(c.grid.ubDiv).css("width", e + "px"));
  2512. c.p.footerrow && b(c.grid.sDiv).css("width", e + "px"); !1 === f && !0 === c.p.forceFit && (c.p.forceFit = !1);
  2513. if (!0 === f) {
  2514. b.each(c.p.colModel,
  2515. function () {
  2516. !1 === this.hidden && (d = this.widthOrg, a += d + l, this.fixed ? r += d + l : h++)
  2517. });
  2518. if (0 === h) return;
  2519. c.p.tblwidth = a;
  2520. m = e - l * h - r; !isNaN(c.p.height) && (b(c.grid.bDiv)[0].clientHeight < b(c.grid.bDiv)[0].scrollHeight || 1 === c.rows.length) && (k = !0, m -= n);
  2521. var a = 0,
  2522. q = 0 < c.grid.cols.length;
  2523. b.each(c.p.colModel,
  2524. function (b) {
  2525. !1 !== this.hidden || this.fixed || (d = this.widthOrg, d = Math.round(m * d / (c.p.tblwidth - l * h - r)), 0 > d || (this.width = d, a += d, c.grid.headers[b].width = d, c.grid.headers[b].el.style.width = d + "px", c.p.footerrow && (c.grid.footers[b].style.width = d + "px"), q && (c.grid.cols[b].style.width = d + "px"), g = b))
  2526. });
  2527. if (!g) return;
  2528. p = 0;
  2529. k ? e - r - (a + l * h) !== n && (p = e - r - (a + l * h) - n) : 1 !== Math.abs(e - r - (a + l * h)) && (p = e - r - (a + l * h));
  2530. c.p.colModel[g].width += p;
  2531. c.p.tblwidth = a + p + l * h + r;
  2532. c.p.tblwidth > e ? (k = c.p.tblwidth - parseInt(e, 10), c.p.tblwidth = e, d = c.p.colModel[g].width -= k) : d = c.p.colModel[g].width;
  2533. c.grid.headers[g].width = d;
  2534. c.grid.headers[g].el.style.width = d + "px";
  2535. q && (c.grid.cols[g].style.width = d + "px");
  2536. c.p.footerrow && (c.grid.footers[g].style.width = d + "px")
  2537. }
  2538. c.p.tblwidth && (b("table:first", c.grid.bDiv).css("width", c.p.tblwidth + "px"), b("table:first", c.grid.hDiv).css("width", c.p.tblwidth + "px"), c.grid.hDiv.scrollLeft = c.grid.bDiv.scrollLeft, c.p.footerrow && b("table:first", c.grid.sDiv).css("width", c.p.tblwidth + "px"))
  2539. }
  2540. }
  2541. })
  2542. },
  2543. setGridHeight: function (e) {
  2544. return this.each(function () {
  2545. if (this.grid) {
  2546. var f = b(this.grid.bDiv);
  2547. f.css({
  2548. height: e + (isNaN(e) ? "" : "px")
  2549. }); !0 === this.p.frozenColumns && b("#" + b.jgrid.jqID(this.p.id) + "_frozen").parent().height(f.height() - 16);
  2550. this.p.height = e;
  2551. this.p.scroll && this.grid.populateVisible()
  2552. }
  2553. })
  2554. },
  2555. setCaption: function (e) {
  2556. return this.each(function () {
  2557. this.p.caption = e;
  2558. b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl", this.grid.cDiv).html(e);
  2559. b(this.grid.cDiv).show()
  2560. })
  2561. },
  2562. setLabel: function (e, f, c, d) {
  2563. return this.each(function () {
  2564. var a = -1;
  2565. if (this.grid && void 0 !== e && (b(this.p.colModel).each(function (b) {
  2566. if (this.name === e) return a = b,
  2567. !1
  2568. }), 0 <= a)) {
  2569. var l = b("tr.ui-jqgrid-labels th:eq(" + a + ")", this.grid.hDiv);
  2570. if (f) {
  2571. var g = b(".s-ico", l);
  2572. b("[id^=jqgh_]", l).empty().html(f).append(g);
  2573. this.p.colNames[a] = f
  2574. }
  2575. c && ("string" === typeof c ? b(l).addClass(c) : b(l).css(c));
  2576. "object" === typeof d && b(l).attr(d)
  2577. }
  2578. })
  2579. },
  2580. setCell: function (e, f, c, d, a, l) {
  2581. return this.each(function () {
  2582. var g = -1,
  2583. h, k;
  2584. if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
  2585. if (this.name === f) return g = a,
  2586. !1
  2587. }) : g = parseInt(f, 10), 0 <= g && (h = b(this).jqGrid("getGridRowById", e)))) {
  2588. var n = b("td:eq(" + g + ")", h);
  2589. if ("" !== c || !0 === l) h = this.formatter(e, c, g, h, "edit"),
  2590. k = this.p.colModel[g].title ? {
  2591. title: b.jgrid.stripHtml(h)
  2592. } : {},
  2593. this.p.treeGrid && 0 < b(".tree-wrap", b(n)).length ? b("span", b(n)).html(h).attr(k) : b(n).html(h).attr(k),
  2594. "local" === this.p.datatype && (h = this.p.colModel[g], c = h.formatter && "string" === typeof h.formatter && "date" === h.formatter ? b.unformat.date.call(this, c, h) : c, k = this.p._index[b.jgrid.stripPref(this.p.idPrefix, e)], void 0 !== k && (this.p.data[k][h.name] = c));
  2595. "string" === typeof d ? b(n).addClass(d) : d && b(n).css(d);
  2596. "object" === typeof a && b(n).attr(a)
  2597. }
  2598. })
  2599. },
  2600. getCell: function (e, f) {
  2601. var c = !1;
  2602. this.each(function () {
  2603. var d = -1;
  2604. if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
  2605. if (this.name === f) return d = a,
  2606. !1
  2607. }) : d = parseInt(f, 10), 0 <= d)) {
  2608. var a = b(this).jqGrid("getGridRowById", e);
  2609. if (a) try {
  2610. c = b.unformat.call(this, b("td:eq(" + d + ")", a), {
  2611. rowId: a.id,
  2612. colModel: this.p.colModel[d]
  2613. },
  2614. d)
  2615. } catch (l) {
  2616. c = b.jgrid.htmlDecode(b("td:eq(" + d + ")", a).html())
  2617. }
  2618. }
  2619. });
  2620. return c
  2621. },
  2622. getCol: function (e, f, c) {
  2623. var d = [],
  2624. a,
  2625. l = 0,
  2626. g,
  2627. h,
  2628. k;
  2629. f = "boolean" !== typeof f ? !1 : f;
  2630. void 0 === c && (c = !1);
  2631. this.each(function () {
  2632. var n = -1;
  2633. if (this.grid && (isNaN(e) ? b(this.p.colModel).each(function (a) {
  2634. if (this.name === e) return n = a,
  2635. !1
  2636. }) : n = parseInt(e, 10), 0 <= n)) {
  2637. var m = this.rows.length,
  2638. r = 0,
  2639. p = 0;
  2640. if (m && 0 < m) {
  2641. for (; r < m;) {
  2642. if (b(this.rows[r]).hasClass("jqgrow")) {
  2643. try {
  2644. a = b.unformat.call(this, b(this.rows[r].cells[n]), {
  2645. rowId: this.rows[r].id,
  2646. colModel: this.p.colModel[n]
  2647. },
  2648. n)
  2649. } catch (q) {
  2650. a = b.jgrid.htmlDecode(this.rows[r].cells[n].innerHTML)
  2651. }
  2652. c ? (k = parseFloat(a), isNaN(k) || (l += k, void 0 === h && (h = g = k), g = Math.min(g, k), h = Math.max(h, k), p++)) : f ? d.push({
  2653. id: this.rows[r].id,
  2654. value: a
  2655. }) : d.push(a)
  2656. }
  2657. r++
  2658. }
  2659. if (c) switch (c.toLowerCase()) {
  2660. case "sum":
  2661. d = l;
  2662. break;
  2663. case "avg":
  2664. d = l / p;
  2665. break;
  2666. case "count":
  2667. d = m - 1;
  2668. break;
  2669. case "min":
  2670. d = g;
  2671. break;
  2672. case "max":
  2673. d = h
  2674. }
  2675. }
  2676. }
  2677. });
  2678. return d
  2679. },
  2680. clearGridData: function (e) {
  2681. return this.each(function () {
  2682. if (this.grid) {
  2683. "boolean" !== typeof e && (e = !1);
  2684. if (this.p.deepempty) b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:gt(0)").remove();
  2685. else {
  2686. var f = b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:first")[0];
  2687. b("#" + b.jgrid.jqID(this.p.id) + " tbody:first").empty().append(f)
  2688. }
  2689. this.p.footerrow && e && b(".ui-jqgrid-ftable td", this.grid.sDiv).html("&#160;");
  2690. this.p.selrow = null;
  2691. this.p.selarrrow = [];
  2692. this.p.savedRow = [];
  2693. this.p.records = 0;
  2694. this.p.page = 1;
  2695. this.p.lastpage = 0;
  2696. this.p.reccount = 0;
  2697. this.p.data = [];
  2698. this.p._index = {};
  2699. this.updatepager(!0, !1)
  2700. }
  2701. })
  2702. },
  2703. getInd: function (e, f) {
  2704. var c = !1,
  2705. d;
  2706. this.each(function () {
  2707. (d = b(this).jqGrid("getGridRowById", e)) && (c = !0 === f ? d : d.rowIndex)
  2708. });
  2709. return c
  2710. },
  2711. bindKeys: function (e) {
  2712. var f = b.extend({
  2713. onEnter: null,
  2714. onSpace: null,
  2715. onLeftKey: null,
  2716. onRightKey: null,
  2717. scrollingRows: !0
  2718. },
  2719. e || {});
  2720. return this.each(function () {
  2721. var c = this;
  2722. b("body").is("[role]") || b("body").attr("role", "application");
  2723. c.p.scrollrows = f.scrollingRows;
  2724. b(c).keydown(function (d) {
  2725. var a = b(c).find("tr[tabindex=0]")[0],
  2726. e,
  2727. g,
  2728. h,
  2729. k = c.p.treeReader.expanded_field;
  2730. if (a) if (h = c.p._index[b.jgrid.stripPref(c.p.idPrefix, a.id)], 37 === d.keyCode || 38 === d.keyCode || 39 === d.keyCode || 40 === d.keyCode) {
  2731. if (38 === d.keyCode) {
  2732. g = a.previousSibling;
  2733. e = "";
  2734. if (g) if (b(g).is(":hidden")) for (; g;) {
  2735. if (g = g.previousSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
  2736. e = g.id;
  2737. break
  2738. }
  2739. } else e = g.id;
  2740. b(c).jqGrid("setSelection", e, !0, d);
  2741. d.preventDefault()
  2742. }
  2743. if (40 === d.keyCode) {
  2744. g = a.nextSibling;
  2745. e = "";
  2746. if (g) if (b(g).is(":hidden")) for (; g;) {
  2747. if (g = g.nextSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
  2748. e = g.id;
  2749. break
  2750. }
  2751. } else e = g.id;
  2752. b(c).jqGrid("setSelection", e, !0, d);
  2753. d.preventDefault()
  2754. }
  2755. 37 === d.keyCode && (c.p.treeGrid && c.p.data[h][k] && b(a).find("div.treeclick").trigger("click"), b(c).triggerHandler("jqGridKeyLeft", [c.p.selrow]), b.isFunction(f.onLeftKey) && f.onLeftKey.call(c, c.p.selrow));
  2756. 39 === d.keyCode && (c.p.treeGrid && !c.p.data[h][k] && b(a).find("div.treeclick").trigger("click"), b(c).triggerHandler("jqGridKeyRight", [c.p.selrow]), b.isFunction(f.onRightKey) && f.onRightKey.call(c, c.p.selrow))
  2757. } else 13 === d.keyCode ? (b(c).triggerHandler("jqGridKeyEnter", [c.p.selrow]), b.isFunction(f.onEnter) && f.onEnter.call(c, c.p.selrow)) : 32 === d.keyCode && (b(c).triggerHandler("jqGridKeySpace", [c.p.selrow]), b.isFunction(f.onSpace) && f.onSpace.call(c, c.p.selrow))
  2758. })
  2759. })
  2760. },
  2761. unbindKeys: function () {
  2762. return this.each(function () {
  2763. b(this).unbind("keydown")
  2764. })
  2765. },
  2766. getLocalRow: function (e) {
  2767. var f = !1,
  2768. c;
  2769. this.each(function () {
  2770. void 0 !== e && (c = this.p._index[b.jgrid.stripPref(this.p.idPrefix, e)], 0 <= c && (f = this.p.data[c]))
  2771. });
  2772. return f
  2773. }
  2774. })
  2775. })(jQuery); (function (a) {
  2776. a.fmatter = {};
  2777. a.extend(a.fmatter, {
  2778. isBoolean: function (a) {
  2779. return "boolean" === typeof a
  2780. },
  2781. isObject: function (c) {
  2782. return c && ("object" === typeof c || a.isFunction(c)) || !1
  2783. },
  2784. isString: function (a) {
  2785. return "string" === typeof a
  2786. },
  2787. isNumber: function (a) {
  2788. return "number" === typeof a && isFinite(a)
  2789. },
  2790. isValue: function (a) {
  2791. return this.isObject(a) || this.isString(a) || this.isNumber(a) || this.isBoolean(a)
  2792. },
  2793. isEmpty: function (c) {
  2794. if (!this.isString(c) && this.isValue(c)) return !1;
  2795. if (!this.isValue(c)) return !0;
  2796. c = a.trim(c).replace(/\&nbsp\;/ig, "").replace(/\&#160\;/ig, "");
  2797. return "" === c
  2798. }
  2799. });
  2800. a.fn.fmatter = function (c, b, d, e, f) {
  2801. var g = b;
  2802. d = a.extend({},
  2803. a.jgrid.formatter, d);
  2804. try {
  2805. g = a.fn.fmatter[c].call(this, b, d, e, f)
  2806. } catch (h) { }
  2807. return g
  2808. };
  2809. a.fmatter.util = {
  2810. NumberFormat: function (c, b) {
  2811. a.fmatter.isNumber(c) || (c *= 1);
  2812. if (a.fmatter.isNumber(c)) {
  2813. var d = 0 > c,
  2814. e = String(c),
  2815. f = b.decimalSeparator || ".",
  2816. g;
  2817. if (a.fmatter.isNumber(b.decimalPlaces)) {
  2818. var h = b.decimalPlaces,
  2819. e = Math.pow(10, h),
  2820. e = String(Math.round(c * e) / e);
  2821. g = e.lastIndexOf(".");
  2822. if (0 < h) for (0 > g ? (e += f, g = e.length - 1) : "." !== f && (e = e.replace(".", f)) ; e.length - 1 - g < h;) e += "0"
  2823. }
  2824. if (b.thousandsSeparator) {
  2825. h = b.thousandsSeparator;
  2826. g = e.lastIndexOf(f);
  2827. g = -1 < g ? g : e.length;
  2828. var f = e.substring(g),
  2829. l = -1,
  2830. k;
  2831. for (k = g; 0 < k; k--) l++,
  2832. 0 === l % 3 && k !== g && (!d || 1 < k) && (f = h + f),
  2833. f = e.charAt(k - 1) + f;
  2834. e = f
  2835. }
  2836. e = b.prefix ? b.prefix + e : e;
  2837. return e = b.suffix ? e + b.suffix : e
  2838. }
  2839. return c
  2840. }
  2841. };
  2842. a.fn.fmatter.defaultFormat = function (c, b) {
  2843. return a.fmatter.isValue(c) && "" !== c ? c : b.defaultValue || "&#160;"
  2844. };
  2845. a.fn.fmatter.email = function (c, b) {
  2846. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : '<a href="mailto:' + c + '">' + c + "</a>"
  2847. };
  2848. a.fn.fmatter.checkbox = function (c, b) {
  2849. var d = a.extend({},
  2850. b.checkbox),
  2851. e;
  2852. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2853. d, b.colModel.formatoptions));
  2854. e = !0 === d.disabled ? 'disabled="disabled"' : "";
  2855. if (a.fmatter.isEmpty(c) || void 0 === c) c = a.fn.fmatter.defaultFormat(c, d);
  2856. c = String(c);
  2857. c = (c + "").toLowerCase();
  2858. return '<input type="checkbox" ' + (0 > c.search(/(false|f|0|no|n|off|undefined)/i) ? " checked='checked' " : "") + ' value="' + c + '" offval="no" ' + e + "/>"
  2859. };
  2860. a.fn.fmatter.link = function (c, b) {
  2861. var d = {
  2862. target: b.target
  2863. },
  2864. e = "";
  2865. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2866. d, b.colModel.formatoptions));
  2867. d.target && (e = "target=" + d.target);
  2868. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : "<a " + e + ' href="' + c + '">' + c + "</a>"
  2869. };
  2870. a.fn.fmatter.showlink = function (c, b) {
  2871. var d = {
  2872. baseLinkUrl: b.baseLinkUrl,
  2873. showAction: b.showAction,
  2874. addParam: b.addParam || "",
  2875. target: b.target,
  2876. idName: b.idName
  2877. },
  2878. e = "";
  2879. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2880. d, b.colModel.formatoptions));
  2881. d.target && (e = "target=" + d.target);
  2882. d = d.baseLinkUrl + d.showAction + "?" + d.idName + "=" + b.rowId + d.addParam;
  2883. return a.fmatter.isString(c) || a.fmatter.isNumber(c) ? "<a " + e + ' href="' + d + '">' + c + "</a>" : a.fn.fmatter.defaultFormat(c, b)
  2884. };
  2885. a.fn.fmatter.integer = function (c, b) {
  2886. var d = a.extend({},
  2887. b.integer);
  2888. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2889. d, b.colModel.formatoptions));
  2890. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2891. };
  2892. a.fn.fmatter.number = function (c, b) {
  2893. var d = a.extend({},
  2894. b.number);
  2895. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2896. d, b.colModel.formatoptions));
  2897. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2898. };
  2899. a.fn.fmatter.currency = function (c, b) {
  2900. var d = a.extend({},
  2901. b.currency);
  2902. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2903. d, b.colModel.formatoptions));
  2904. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2905. };
  2906. a.fn.fmatter.date = function (c, b, d, e) {
  2907. d = a.extend({},
  2908. b.date);
  2909. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2910. d, b.colModel.formatoptions));
  2911. return d.reformatAfterEdit || "edit" !== e ? a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : a.jgrid.parseDate(d.srcformat, c, d.newformat, d) : a.fn.fmatter.defaultFormat(c, b)
  2912. };
  2913. a.fn.fmatter.select = function (c, b) {
  2914. c = String(c);
  2915. var d = !1,
  2916. e = [],
  2917. f,
  2918. g;
  2919. void 0 !== b.colModel.formatoptions ? (d = b.colModel.formatoptions.value, f = void 0 === b.colModel.formatoptions.separator ? ":" : b.colModel.formatoptions.separator, g = void 0 === b.colModel.formatoptions.delimiter ? ";" : b.colModel.formatoptions.delimiter) : void 0 !== b.colModel.editoptions && (d = b.colModel.editoptions.value, f = void 0 === b.colModel.editoptions.separator ? ":" : b.colModel.editoptions.separator, g = void 0 === b.colModel.editoptions.delimiter ? ";" : b.colModel.editoptions.delimiter);
  2920. if (d) {
  2921. var h = !0 === b.colModel.editoptions.multiple ? !0 : !1,
  2922. l = [];
  2923. h && (l = c.split(","), l = a.map(l,
  2924. function (b) {
  2925. return a.trim(b)
  2926. }));
  2927. if (a.fmatter.isString(d)) {
  2928. var k = d.split(g),
  2929. m = 0,
  2930. n;
  2931. for (n = 0; n < k.length; n++) if (g = k[n].split(f), 2 < g.length && (g[1] = a.map(g,
  2932. function (a, b) {
  2933. if (0 < b) return a
  2934. }).join(f)), h) -1 < a.inArray(g[0], l) && (e[m] = g[1], m++);
  2935. else if (a.trim(g[0]) === a.trim(c)) {
  2936. e[0] = g[1];
  2937. break
  2938. }
  2939. } else a.fmatter.isObject(d) && (h ? e = a.map(l,
  2940. function (a) {
  2941. return d[a]
  2942. }) : e[0] = d[c] || "")
  2943. }
  2944. c = e.join(", ");
  2945. return "" === c ? a.fn.fmatter.defaultFormat(c, b) : c
  2946. };
  2947. a.fn.fmatter.rowactions = function (c) {
  2948. var b = a(this).closest("tr.jqgrow"),
  2949. d = b.attr("id"),
  2950. e = a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/, "$1"),
  2951. e = a("#" + e),
  2952. f = e[0],
  2953. g = f.p,
  2954. h = g.colModel[a.jgrid.getCellIndex(this)],
  2955. l = h.frozen ? a("tr#" + d + " td:eq(" + a.jgrid.getCellIndex(this) + ") > div", e) : a(this).parent(),
  2956. k = {
  2957. extraparam: {}
  2958. },
  2959. m = function (b) {
  2960. a.isFunction(k.afterRestore) && k.afterRestore.call(f, b);
  2961. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2962. l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
  2963. };
  2964. void 0 !== h.formatoptions && (k = a.extend(k, h.formatoptions));
  2965. void 0 !== g.editOptions && (k.editOptions = g.editOptions);
  2966. void 0 !== g.delOptions && (k.delOptions = g.delOptions);
  2967. b.hasClass("jqgrid-new-row") && (k.extraparam[g.prmNames.oper] = g.prmNames.addoper);
  2968. b = {
  2969. keys: k.keys,
  2970. oneditfunc: k.onEdit,
  2971. successfunc: k.onSuccess,
  2972. url: k.url,
  2973. extraparam: k.extraparam,
  2974. aftersavefunc: function (b, c) {
  2975. a.isFunction(k.afterSave) && k.afterSave.call(f, b, c);
  2976. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2977. l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
  2978. },
  2979. errorfunc: k.onError,
  2980. afterrestorefunc: m,
  2981. restoreAfterError: k.restoreAfterError,
  2982. mtype: k.mtype
  2983. };
  2984. switch (c) {
  2985. case "edit":
  2986. e.jqGrid("editRow", d, b);
  2987. l.find("div.ui-inline-edit,div.ui-inline-del").hide();
  2988. l.find("div.ui-inline-save,div.ui-inline-cancel").show();
  2989. e.triggerHandler("jqGridAfterGridComplete");
  2990. break;
  2991. case "save":
  2992. e.jqGrid("saveRow", d, b) && (l.find("div.ui-inline-edit,div.ui-inline-del").show(), l.find("div.ui-inline-save,div.ui-inline-cancel").hide(), e.triggerHandler("jqGridAfterGridComplete"));
  2993. break;
  2994. case "cancel":
  2995. e.jqGrid("restoreRow", d, m);
  2996. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2997. l.find("div.ui-inline-save,div.ui-inline-cancel").hide();
  2998. e.triggerHandler("jqGridAfterGridComplete");
  2999. break;
  3000. case "del":
  3001. e.jqGrid("delGridRow", d, k.delOptions);
  3002. break;
  3003. case "formedit":
  3004. e.jqGrid("setSelection", d),
  3005. e.jqGrid("editGridRow", d, k.editOptions)
  3006. }
  3007. };
  3008. a.fn.fmatter.actions = function (c, b) {
  3009. var d = {
  3010. keys: !1,
  3011. editbutton: !0,
  3012. delbutton: !0,
  3013. editformbutton: !1
  3014. },
  3015. e = b.rowId,
  3016. f = "";
  3017. void 0 !== b.colModel.formatoptions && (d = a.extend(d, b.colModel.formatoptions));
  3018. if (void 0 === e || a.fmatter.isEmpty(e)) return "";
  3019. d.editformbutton ? f += "<div title='" + a.jgrid.nav.edittitle + "' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' " + ("id='jEditButton_" + e + "' onclick=jQuery.fn.fmatter.rowactions.call(this,'formedit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ") + "><span class='ui-icon ui-icon-pencil'></span></div>" : d.editbutton && (f += "<div title='" + a.jgrid.nav.edittitle + "' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' " + ("id='jEditButton_" + e + "' onclick=jQuery.fn.fmatter.rowactions.call(this,'edit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ") + "><span class='ui-icon ui-icon-pencil'></span></div>");
  3020. d.delbutton && (f += "<div title='" + a.jgrid.nav.deltitle + "' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' " + ("id='jDeleteButton_" + e + "' onclick=jQuery.fn.fmatter.rowactions.call(this,'del'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ") + "><span class='ui-icon ui-icon-trash'></span></div>");
  3021. f += "<div title='" + a.jgrid.edit.bSubmit + "' style='float:left;display:none' class='ui-pg-div ui-inline-save' " + ("id='jSaveButton_" + e + "' onclick=jQuery.fn.fmatter.rowactions.call(this,'save'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ") + "><span class='ui-icon ui-icon-disk'></span></div>";
  3022. f += "<div title='" + a.jgrid.edit.bCancel + "' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' " + ("id='jCancelButton_" + e + "' onclick=jQuery.fn.fmatter.rowactions.call(this,'cancel'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ") + "><span class='ui-icon ui-icon-cancel'></span></div>";
  3023. return "<div style='margin-left:8px;'>" + f + "</div>"
  3024. };
  3025. a.unformat = function (c, b, d, e) {
  3026. var f, g = b.colModel.formatter,
  3027. h = b.colModel.formatoptions || {},
  3028. l = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
  3029. k = b.colModel.unformat || a.fn.fmatter[g] && a.fn.fmatter[g].unformat;
  3030. if (void 0 !== k && a.isFunction(k)) f = k.call(this, a(c).text(), b, c);
  3031. else if (void 0 !== g && a.fmatter.isString(g)) switch (f = a.jgrid.formatter || {},
  3032. g) {
  3033. case "integer":
  3034. h = a.extend({},
  3035. f.integer, h);
  3036. b = h.thousandsSeparator.replace(l, "\\$1");
  3037. b = RegExp(b, "g");
  3038. f = a(c).text().replace(b, "");
  3039. break;
  3040. case "number":
  3041. h = a.extend({},
  3042. f.number, h);
  3043. b = h.thousandsSeparator.replace(l, "\\$1");
  3044. b = RegExp(b, "g");
  3045. f = a(c).text().replace(b, "").replace(h.decimalSeparator, ".");
  3046. break;
  3047. case "currency":
  3048. h = a.extend({},
  3049. f.currency, h);
  3050. b = h.thousandsSeparator.replace(l, "\\$1");
  3051. b = RegExp(b, "g");
  3052. f = a(c).text();
  3053. h.prefix && h.prefix.length && (f = f.substr(h.prefix.length));
  3054. h.suffix && h.suffix.length && (f = f.substr(0, f.length - h.suffix.length));
  3055. f = f.replace(b, "").replace(h.decimalSeparator, ".");
  3056. break;
  3057. case "checkbox":
  3058. h = b.colModel.editoptions ? b.colModel.editoptions.value.split(":") : ["Yes", "No"];
  3059. f = a("input", c).is(":checked") ? h[0] : h[1];
  3060. break;
  3061. case "select":
  3062. f = a.unformat.select(c, b, d, e);
  3063. break;
  3064. case "actions":
  3065. return "";
  3066. default:
  3067. f = a(c).text()
  3068. }
  3069. return void 0 !== f ? f : !0 === e ? a(c).text() : a.jgrid.htmlDecode(a(c).html())
  3070. };
  3071. a.unformat.select = function (c, b, d, e) {
  3072. d = [];
  3073. c = a(c).text();
  3074. if (!0 === e) return c;
  3075. e = a.extend({},
  3076. void 0 !== b.colModel.formatoptions ? b.colModel.formatoptions : b.colModel.editoptions);
  3077. b = void 0 === e.separator ? ":" : e.separator;
  3078. var f = void 0 === e.delimiter ? ";" : e.delimiter;
  3079. if (e.value) {
  3080. var g = e.value;
  3081. e = !0 === e.multiple ? !0 : !1;
  3082. var h = [];
  3083. e && (h = c.split(","), h = a.map(h,
  3084. function (b) {
  3085. return a.trim(b)
  3086. }));
  3087. if (a.fmatter.isString(g)) {
  3088. var l = g.split(f),
  3089. k = 0,
  3090. m;
  3091. for (m = 0; m < l.length; m++) if (f = l[m].split(b), 2 < f.length && (f[1] = a.map(f,
  3092. function (a, b) {
  3093. if (0 < b) return a
  3094. }).join(b)), e) -1 < a.inArray(f[1], h) && (d[k] = f[0], k++);
  3095. else if (a.trim(f[1]) === a.trim(c)) {
  3096. d[0] = f[0];
  3097. break
  3098. }
  3099. } else if (a.fmatter.isObject(g) || a.isArray(g)) e || (h[0] = c),
  3100. d = a.map(h,
  3101. function (b) {
  3102. var c;
  3103. a.each(g,
  3104. function (a, d) {
  3105. if (d === b) return c = a,
  3106. !1
  3107. });
  3108. if (void 0 !== c) return c
  3109. });
  3110. return d.join(", ")
  3111. }
  3112. return c || ""
  3113. };
  3114. a.unformat.date = function (c, b) {
  3115. var d = a.jgrid.formatter.date || {};
  3116. void 0 !== b.formatoptions && (d = a.extend({},
  3117. d, b.formatoptions));
  3118. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : a.jgrid.parseDate(d.newformat, c, d.srcformat, d)
  3119. }
  3120. })(jQuery); (function (a) {
  3121. a.jgrid.extend({
  3122. getColProp: function (a) {
  3123. var c = {},
  3124. d = this[0];
  3125. if (!d.grid) return !1;
  3126. var d = d.p.colModel,
  3127. h;
  3128. for (h = 0; h < d.length; h++) if (d[h].name === a) {
  3129. c = d[h];
  3130. break
  3131. }
  3132. return c
  3133. },
  3134. setColProp: function (b, c) {
  3135. return this.each(function () {
  3136. if (this.grid && c) {
  3137. var d = this.p.colModel,
  3138. h;
  3139. for (h = 0; h < d.length; h++) if (d[h].name === b) {
  3140. a.extend(!0, this.p.colModel[h], c);
  3141. break
  3142. }
  3143. }
  3144. })
  3145. },
  3146. sortGrid: function (a, c, d) {
  3147. return this.each(function () {
  3148. var h = -1,
  3149. k, e = !1;
  3150. if (this.grid) {
  3151. a || (a = this.p.sortname);
  3152. for (k = 0; k < this.p.colModel.length; k++) if (this.p.colModel[k].index === a || this.p.colModel[k].name === a) {
  3153. h = k; !0 === this.p.frozenColumns && !0 === this.p.colModel[k].frozen && (e = this.grid.fhDiv.find("#" + this.p.id + "_" + a));
  3154. break
  3155. } -1 !== h && (k = this.p.colModel[h].sortable, e || (e = this.grid.headers[h].el), "boolean" !== typeof k && (k = !0), "boolean" !== typeof c && (c = !1), k && this.sortData("jqgh_" + this.p.id + "_" + a, h, c, d, e))
  3156. }
  3157. })
  3158. },
  3159. clearBeforeUnload: function () {
  3160. return this.each(function () {
  3161. var b = this.grid;
  3162. a.isFunction(b.emptyRows) && b.emptyRows.call(this, !0, !0);
  3163. a(document).unbind("mouseup.jqGrid" + this.p.id);
  3164. a(b.hDiv).unbind("mousemove");
  3165. a(this).unbind();
  3166. b.dragEnd = null;
  3167. b.dragMove = null;
  3168. b.dragStart = null;
  3169. b.emptyRows = null;
  3170. b.populate = null;
  3171. b.populateVisible = null;
  3172. b.scrollGrid = null;
  3173. b.selectionPreserver = null;
  3174. b.bDiv = null;
  3175. b.cDiv = null;
  3176. b.hDiv = null;
  3177. b.cols = null;
  3178. var c, d = b.headers.length;
  3179. for (c = 0; c < d; c++) b.headers[c].el = null;
  3180. this.grid = this.addJSONData = this.addXmlData = this.formatter = this.constructTr = this.setHeadCheckBox = this.refreshIndex = this.updatepager = this.sortData = this.formatCol = null
  3181. })
  3182. },
  3183. GridDestroy: function () {
  3184. return this.each(function () {
  3185. if (this.grid) {
  3186. this.p.pager && a(this.p.pager).remove();
  3187. try {
  3188. a(this).jqGrid("clearBeforeUnload"),
  3189. a("#gbox_" + a.jgrid.jqID(this.id)).remove()
  3190. } catch (b) { }
  3191. }
  3192. })
  3193. },
  3194. GridUnload: function () {
  3195. return this.each(function () {
  3196. if (this.grid) {
  3197. var b = a(this).attr("id"),
  3198. c = a(this).attr("class");
  3199. this.p.pager && a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");
  3200. var d = document.createElement("table");
  3201. a(d).attr({
  3202. id: b
  3203. });
  3204. d.className = c;
  3205. b = a.jgrid.jqID(this.id);
  3206. a(d).removeClass("ui-jqgrid-btable");
  3207. 1 === a(this.p.pager).parents("#gbox_" + b).length ? (a(d).insertBefore("#gbox_" + b).show(), a(this.p.pager).insertBefore("#gbox_" + b)) : a(d).insertBefore("#gbox_" + b).show();
  3208. a(this).jqGrid("clearBeforeUnload");
  3209. a("#gbox_" + b).remove()
  3210. }
  3211. })
  3212. },
  3213. setGridState: function (b) {
  3214. return this.each(function () {
  3215. this.grid && ("hidden" === b ? (a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv", "#gview_" + a.jgrid.jqID(this.p.id)).slideUp("fast"), this.p.pager && a(this.p.pager).slideUp("fast"), this.p.toppager && a(this.p.toppager).slideUp("fast"), !0 === this.p.toolbar[0] && ("both" === this.p.toolbar[1] && a(this.grid.ubDiv).slideUp("fast"), a(this.grid.uDiv).slideUp("fast")), this.p.footerrow && a(".ui-jqgrid-sdiv", "#gbox_" + a.jgrid.jqID(this.p.id)).slideUp("fast"), a(".ui-jqgrid-titlebar-close span", this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"), this.p.gridstate = "hidden") : "visible" === b && (a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv", "#gview_" + a.jgrid.jqID(this.p.id)).slideDown("fast"), this.p.pager && a(this.p.pager).slideDown("fast"), this.p.toppager && a(this.p.toppager).slideDown("fast"), !0 === this.p.toolbar[0] && ("both" === this.p.toolbar[1] && a(this.grid.ubDiv).slideDown("fast"), a(this.grid.uDiv).slideDown("fast")), this.p.footerrow && a(".ui-jqgrid-sdiv", "#gbox_" + a.jgrid.jqID(this.p.id)).slideDown("fast"), a(".ui-jqgrid-titlebar-close span", this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"), this.p.gridstate = "visible"))
  3216. })
  3217. },
  3218. filterToolbar: function (b) {
  3219. b = a.extend({
  3220. autosearch: !0,
  3221. searchOnEnter: !0,
  3222. beforeSearch: null,
  3223. afterSearch: null,
  3224. beforeClear: null,
  3225. afterClear: null,
  3226. searchurl: "",
  3227. stringResult: !1,
  3228. groupOp: "AND",
  3229. defaultSearch: "bw",
  3230. searchOperators: !1,
  3231. resetIcon: "x",
  3232. operands: {
  3233. eq: "==",
  3234. ne: "!",
  3235. lt: "<",
  3236. le: "<=",
  3237. gt: ">",
  3238. ge: ">=",
  3239. bw: "^",
  3240. bn: "!^",
  3241. "in": "=",
  3242. ni: "!=",
  3243. ew: "|",
  3244. en: "!@",
  3245. cn: "~",
  3246. nc: "!~",
  3247. nu: "#",
  3248. nn: "!#"
  3249. }
  3250. },
  3251. a.jgrid.search, b || {});
  3252. return this.each(function () {
  3253. var c = this;
  3254. if (!this.ftoolbar) {
  3255. var d = function () {
  3256. var d = {},
  3257. f = 0,
  3258. g, m, e = {},
  3259. q;
  3260. a.each(c.p.colModel,
  3261. function () {
  3262. var l = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
  3263. m = this.index || this.name;
  3264. q = b.searchOperators ? l.parent().prev().children("a").attr("soper") || b.defaultSearch : this.searchoptions && this.searchoptions.sopt ? this.searchoptions.sopt[0] : "select" === this.stype ? "eq" : b.defaultSearch;
  3265. if ((g = "custom" === this.stype && a.isFunction(this.searchoptions.custom_value) && 0 < l.length && "SPAN" === l[0].nodeName.toUpperCase() ? this.searchoptions.custom_value.call(c, l.children(".customelement:first"), "get") : l.val()) || "nu" === q || "nn" === q) d[m] = g,
  3266. e[m] = q,
  3267. f++;
  3268. else try {
  3269. delete c.p.postData[m]
  3270. } catch (k) { }
  3271. });
  3272. var k = 0 < f ? !0 : !1;
  3273. if (!0 === b.stringResult || "local" === c.p.datatype) {
  3274. var l = '{"groupOp":"' + b.groupOp + '","rules":[',
  3275. n = 0;
  3276. a.each(d,
  3277. function (a, b) {
  3278. 0 < n && (l += ",");
  3279. l += '{"field":"' + a + '",';
  3280. l += '"op":"' + e[a] + '",';
  3281. l += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
  3282. n++
  3283. });
  3284. l += "]}";
  3285. a.extend(c.p.postData, {
  3286. filters: l
  3287. });
  3288. a.each(["searchField", "searchString", "searchOper"],
  3289. function (a, b) {
  3290. c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
  3291. })
  3292. } else a.extend(c.p.postData, d);
  3293. var r;
  3294. c.p.searchurl && (r = c.p.url, a(c).jqGrid("setGridParam", {
  3295. url: c.p.searchurl
  3296. }));
  3297. var h = "stop" === a(c).triggerHandler("jqGridToolbarBeforeSearch") ? !0 : !1; !h && a.isFunction(b.beforeSearch) && (h = b.beforeSearch.call(c));
  3298. h || a(c).jqGrid("setGridParam", {
  3299. search: k
  3300. }).trigger("reloadGrid", [{
  3301. page: 1
  3302. }]);
  3303. r && a(c).jqGrid("setGridParam", {
  3304. url: r
  3305. });
  3306. a(c).triggerHandler("jqGridToolbarAfterSearch");
  3307. a.isFunction(b.afterSearch) && b.afterSearch.call(c)
  3308. },
  3309. h = function (e, f, g) {
  3310. a("#sopt_menu").remove();
  3311. f = parseInt(f, 10);
  3312. g = parseInt(g, 10) + 18;
  3313. f = '<ul id="sopt_menu" class="ui-search-menu" role="menu" tabindex="0" style="font-size:' + (a(".ui-jqgrid-view").css("font-size") || "11px") + ";left:" + f + "px;top:" + g + 'px;">';
  3314. g = a(e).attr("soper");
  3315. var k, h = [],
  3316. q,
  3317. p = 0,
  3318. l = a(e).attr("colname");
  3319. for (k = c.p.colModel.length; p < k && c.p.colModel[p].name !== l;) p++;
  3320. p = c.p.colModel[p];
  3321. l = a.extend({},
  3322. p.searchoptions);
  3323. l.sopt || (l.sopt = [], l.sopt[0] = "select" === p.stype ? "eq" : b.defaultSearch);
  3324. a.each(b.odata,
  3325. function () {
  3326. h.push(this.oper)
  3327. });
  3328. for (p = 0; p < l.sopt.length; p++) q = a.inArray(l.sopt[p], h),
  3329. -1 !== q && (k = g === b.odata[q].oper ? "ui-state-highlight" : "", f += '<li class="ui-menu-item ' + k + '" role="presentation"><a class="ui-corner-all g-menu-item" tabindex="0" role="menuitem" value="' + b.odata[q].oper + '" oper="' + b.operands[b.odata[q].oper] + '"><table cellspacing="0" cellpadding="0" border="0"><tr><td width="25px">' + b.operands[b.odata[q].oper] + "</td><td>" + b.odata[q].text + "</td></tr></table></a></li>");
  3330. f += "</ul>";
  3331. a("body").append(f);
  3332. a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");
  3333. a("#sopt_menu > li > a").hover(function () {
  3334. a(this).addClass("ui-state-hover")
  3335. },
  3336. function () {
  3337. a(this).removeClass("ui-state-hover")
  3338. }).click(function (f) {
  3339. f = a(this).attr("value");
  3340. var g = a(this).attr("oper");
  3341. a(c).triggerHandler("jqGridToolbarSelectOper", [f, g, e]);
  3342. a("#sopt_menu").hide();
  3343. a(e).text(g).attr("soper", f); !0 === b.autosearch && (g = a(e).parent().next().children()[0], (a(g).val() || "nu" === f || "nn" === f) && d())
  3344. })
  3345. },
  3346. k = a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),
  3347. e;
  3348. a.each(c.p.colModel,
  3349. function (h) {
  3350. var f = this,
  3351. g, m;
  3352. m = "";
  3353. var x = "=",
  3354. q, p = a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-" + c.p.direction + "'></th>"),
  3355. l = a("<div style='position:relative;height:100%;padding-right:0.3em;padding-left:0.3em;'></div>"),
  3356. n = a("<table class='ui-search-table' cellspacing='0'><tr><td class='ui-search-oper'></td><td class='ui-search-input'></td><td class='ui-search-clear'></td></tr></table>"); !0 === this.hidden && a(p).css("display", "none");
  3357. this.search = !1 === this.search ? !1 : !0;
  3358. void 0 === this.stype && (this.stype = "text");
  3359. g = a.extend({},
  3360. this.searchoptions || {});
  3361. if (this.search) {
  3362. if (b.searchOperators) {
  3363. m = g.sopt ? g.sopt[0] : "select" === f.stype ? "eq" : b.defaultSearch;
  3364. for (q = 0; q < b.odata.length; q++) if (b.odata[q].oper === m) {
  3365. x = b.operands[m] || "";
  3366. break
  3367. }
  3368. m = "<a title='" + (null != g.searchtitle ? g.searchtitle : b.operandTitle) + "' style='padding-right: 0.5em;' soper='" + m + "' class='soptclass' colname='" + this.name + "'>" + x + "</a>"
  3369. }
  3370. a("td:eq(0)", n).attr("colindex", h).append(m);
  3371. void 0 === g.clearSearch && (g.clearSearch = !0);
  3372. g.clearSearch ? (m = b.resetTitle || "Clear Search Value", a("td:eq(2)", n).append("<a title='" + m + "' style='padding-right: 0.3em;padding-left: 0.3em;' class='clearsearchclass'>" + b.resetIcon + "</a>")) : a("td:eq(2)", n).hide();
  3373. switch (this.stype) {
  3374. case "select":
  3375. if (m = this.surl || g.dataUrl) a(l).append(n),
  3376. a.ajax(a.extend({
  3377. url: m,
  3378. dataType: "html",
  3379. success: function (e) {
  3380. void 0 !== g.buildSelect ? (e = g.buildSelect(e)) && a("td:eq(1)", n).append(e) : a("td:eq(1)", n).append(e);
  3381. void 0 !== g.defaultValue && a("select", l).val(g.defaultValue);
  3382. a("select", l).attr({
  3383. name: f.index || f.name,
  3384. id: "gs_" + f.name
  3385. });
  3386. g.attr && a("select", l).attr(g.attr);
  3387. a("select", l).css({
  3388. width: "100%"
  3389. });
  3390. a.jgrid.bindEv.call(c, a("select", l)[0], g); !0 === b.autosearch && a("select", l).change(function () {
  3391. d();
  3392. return !1
  3393. });
  3394. e = null
  3395. }
  3396. },
  3397. a.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
  3398. else {
  3399. var r, w, u;
  3400. f.searchoptions ? (r = void 0 === f.searchoptions.value ? "" : f.searchoptions.value, w = void 0 === f.searchoptions.separator ? ":" : f.searchoptions.separator, u = void 0 === f.searchoptions.delimiter ? ";" : f.searchoptions.delimiter) : f.editoptions && (r = void 0 === f.editoptions.value ? "" : f.editoptions.value, w = void 0 === f.editoptions.separator ? ":" : f.editoptions.separator, u = void 0 === f.editoptions.delimiter ? ";" : f.editoptions.delimiter);
  3401. if (r) {
  3402. var t = document.createElement("select");
  3403. t.style.width = "100%";
  3404. a(t).attr({
  3405. name: f.index || f.name,
  3406. id: "gs_" + f.name
  3407. });
  3408. var v;
  3409. if ("string" === typeof r) for (m = r.split(u), v = 0; v < m.length; v++) r = m[v].split(w),
  3410. u = document.createElement("option"),
  3411. u.value = r[0],
  3412. u.innerHTML = r[1],
  3413. t.appendChild(u);
  3414. else if ("object" === typeof r) for (v in r) r.hasOwnProperty(v) && (u = document.createElement("option"), u.value = v, u.innerHTML = r[v], t.appendChild(u));
  3415. void 0 !== g.defaultValue && a(t).val(g.defaultValue);
  3416. g.attr && a(t).attr(g.attr);
  3417. a(l).append(n);
  3418. a.jgrid.bindEv.call(c, t, g);
  3419. a("td:eq(1)", n).append(t); !0 === b.autosearch && a(t).change(function () {
  3420. d();
  3421. return !1
  3422. })
  3423. }
  3424. }
  3425. break;
  3426. case "text":
  3427. w = void 0 !== g.defaultValue ? g.defaultValue : "";
  3428. a("td:eq(1)", n).append("<input type='text' style='width:100%;padding:0px;' name='" + (f.index || f.name) + "' id='gs_" + f.name + "' value='" + w + "'/>");
  3429. a(l).append(n);
  3430. g.attr && a("input", l).attr(g.attr);
  3431. a.jgrid.bindEv.call(c, a("input", l)[0], g); !0 === b.autosearch && (b.searchOnEnter ? a("input", l).keypress(function (a) {
  3432. return 13 === (a.charCode || a.keyCode || 0) ? (d(), !1) : this
  3433. }) : a("input", l).keydown(function (a) {
  3434. switch (a.which) {
  3435. case 13:
  3436. return !1;
  3437. case 9:
  3438. case 16:
  3439. case 37:
  3440. case 38:
  3441. case 39:
  3442. case 40:
  3443. case 27:
  3444. break;
  3445. default:
  3446. e && clearTimeout(e),
  3447. e = setTimeout(function () {
  3448. d()
  3449. },
  3450. 500)
  3451. }
  3452. }));
  3453. break;
  3454. case "custom":
  3455. a("td:eq(1)", n).append("<span style='width:95%;padding:0px;' name='" + (f.index || f.name) + "' id='gs_" + f.name + "'/>");
  3456. a(l).append(n);
  3457. try {
  3458. if (a.isFunction(g.custom_element)) if (t = g.custom_element.call(c, void 0 !== g.defaultValue ? g.defaultValue : "", g)) t = a(t).addClass("customelement"),
  3459. a(l).find(">span").append(t);
  3460. else throw "e2";
  3461. else throw "e1";
  3462. } catch (y) {
  3463. "e1" === y && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  3464. "e2" === y ? a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.novalue, a.jgrid.edit.bClose) : a.jgrid.info_dialog(a.jgrid.errors.errcap, "string" === typeof y ? y : y.message, a.jgrid.edit.bClose)
  3465. }
  3466. }
  3467. }
  3468. a(p).append(l);
  3469. a(k).append(p);
  3470. b.searchOperators || a("td:eq(0)", n).hide()
  3471. });
  3472. a("table thead", c.grid.hDiv).append(k);
  3473. b.searchOperators && (a(".soptclass", k).click(function (b) {
  3474. var c = a(this).offset();
  3475. h(this, c.left, c.top);
  3476. b.stopPropagation()
  3477. }), a("body").on("click",
  3478. function (b) {
  3479. "soptclass" !== b.target.className && a("#sopt_menu").hide()
  3480. }));
  3481. a(".clearsearchclass", k).click(function (e) {
  3482. e = a(this).parents("tr:first");
  3483. var f = parseInt(a("td.ui-search-oper", e).attr("colindex"), 10),
  3484. g = a.extend({},
  3485. c.p.colModel[f].searchoptions || {}),
  3486. g = g.defaultValue ? g.defaultValue : "";
  3487. "select" === c.p.colModel[f].stype ? g ? a("td.ui-search-input select", e).val(g) : a("td.ui-search-input select", e)[0].selectedIndex = 0 : a("td.ui-search-input input", e).val(g); !0 === b.autosearch && d()
  3488. });
  3489. this.ftoolbar = !0;
  3490. this.triggerToolbar = d;
  3491. this.clearToolbar = function (d) {
  3492. var f = {},
  3493. g = 0,
  3494. e;
  3495. d = "boolean" !== typeof d ? !0 : d;
  3496. a.each(c.p.colModel,
  3497. function () {
  3498. var b, d = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
  3499. this.searchoptions && void 0 !== this.searchoptions.defaultValue && (b = this.searchoptions.defaultValue);
  3500. e = this.index || this.name;
  3501. switch (this.stype) {
  3502. case "select":
  3503. d.find("option").each(function (c) {
  3504. 0 === c && (this.selected = !0);
  3505. if (a(this).val() === b) return this.selected = !0,
  3506. !1
  3507. });
  3508. if (void 0 !== b) f[e] = b,
  3509. g++;
  3510. else try {
  3511. delete c.p.postData[e]
  3512. } catch (h) { }
  3513. break;
  3514. case "text":
  3515. d.val(b || "");
  3516. if (void 0 !== b) f[e] = b,
  3517. g++;
  3518. else try {
  3519. delete c.p.postData[e]
  3520. } catch (k) { }
  3521. break;
  3522. case "custom":
  3523. a.isFunction(this.searchoptions.custom_value) && 0 < d.length && "SPAN" === d[0].nodeName.toUpperCase() && this.searchoptions.custom_value.call(c, d.children(".customelement:first"), "set", b || "")
  3524. }
  3525. });
  3526. var k = 0 < g ? !0 : !1;
  3527. c.p.resetsearch = !0;
  3528. if (!0 === b.stringResult || "local" === c.p.datatype) {
  3529. var h = '{"groupOp":"' + b.groupOp + '","rules":[',
  3530. p = 0;
  3531. a.each(f,
  3532. function (a, b) {
  3533. 0 < p && (h += ",");
  3534. h += '{"field":"' + a + '",';
  3535. h += '"op":"eq",';
  3536. h += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
  3537. p++
  3538. });
  3539. h += "]}";
  3540. a.extend(c.p.postData, {
  3541. filters: h
  3542. });
  3543. a.each(["searchField", "searchString", "searchOper"],
  3544. function (a, b) {
  3545. c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
  3546. })
  3547. } else a.extend(c.p.postData, f);
  3548. var l;
  3549. c.p.searchurl && (l = c.p.url, a(c).jqGrid("setGridParam", {
  3550. url: c.p.searchurl
  3551. }));
  3552. var n = "stop" === a(c).triggerHandler("jqGridToolbarBeforeClear") ? !0 : !1; !n && a.isFunction(b.beforeClear) && (n = b.beforeClear.call(c));
  3553. n || d && a(c).jqGrid("setGridParam", {
  3554. search: k
  3555. }).trigger("reloadGrid", [{
  3556. page: 1
  3557. }]);
  3558. l && a(c).jqGrid("setGridParam", {
  3559. url: l
  3560. });
  3561. a(c).triggerHandler("jqGridToolbarAfterClear");
  3562. a.isFunction(b.afterClear) && b.afterClear()
  3563. };
  3564. this.toggleToolbar = function () {
  3565. var b = a("tr.ui-search-toolbar", c.grid.hDiv),
  3566. d = !0 === c.p.frozenColumns ? a("tr.ui-search-toolbar", c.grid.fhDiv) : !1;
  3567. "none" === b.css("display") ? (b.show(), d && d.show()) : (b.hide(), d && d.hide())
  3568. }
  3569. }
  3570. })
  3571. },
  3572. destroyFilterToolbar: function () {
  3573. return this.each(function () {
  3574. this.ftoolbar && (this.toggleToolbar = this.clearToolbar = this.triggerToolbar = null, this.ftoolbar = !1, a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())
  3575. })
  3576. },
  3577. destroyGroupHeader: function (b) {
  3578. void 0 === b && (b = !0);
  3579. return this.each(function () {
  3580. var c, d, h, k, e, s;
  3581. d = this.grid;
  3582. var f = a("table.ui-jqgrid-htable thead", d.hDiv),
  3583. g = this.p.colModel;
  3584. if (d) {
  3585. a(this).unbind(".setGroupHeaders");
  3586. c = a("<tr>", {
  3587. role: "rowheader"
  3588. }).addClass("ui-jqgrid-labels");
  3589. k = d.headers;
  3590. d = 0;
  3591. for (h = k.length; d < h; d++) {
  3592. e = g[d].hidden ? "none" : "";
  3593. e = a(k[d].el).width(k[d].width).css("display", e);
  3594. try {
  3595. e.removeAttr("rowSpan")
  3596. } catch (m) {
  3597. e.attr("rowSpan", 1)
  3598. }
  3599. c.append(e);
  3600. s = e.children("span.ui-jqgrid-resize");
  3601. 0 < s.length && (s[0].style.height = "");
  3602. e.children("div")[0].style.top = ""
  3603. }
  3604. a(f).children("tr.ui-jqgrid-labels").remove();
  3605. a(f).prepend(c); !0 === b && a(this).jqGrid("setGridParam", {
  3606. groupHeader: null
  3607. })
  3608. }
  3609. })
  3610. },
  3611. setGroupHeaders: function (b) {
  3612. b = a.extend({
  3613. useColSpanStyle: !1,
  3614. groupHeaders: []
  3615. },
  3616. b || {});
  3617. return this.each(function () {
  3618. this.p.groupHeader = b;
  3619. var c, d, h = 0,
  3620. k, e, s, f, g, m = this.p.colModel,
  3621. x = m.length,
  3622. q = this.grid.headers,
  3623. p = a("table.ui-jqgrid-htable", this.grid.hDiv),
  3624. l = p.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");
  3625. k = p.children("thead");
  3626. var n = p.find(".jqg-first-row-header");
  3627. void 0 === n[0] ? n = a("<tr>", {
  3628. role: "row",
  3629. "aria-hidden": "true"
  3630. }).addClass("jqg-first-row-header").css("height", "auto") : n.empty();
  3631. var r, w = function (a, b) {
  3632. var c = b.length,
  3633. d;
  3634. for (d = 0; d < c; d++) if (b[d].startColumnName === a) return d;
  3635. return -1
  3636. };
  3637. a(this).prepend(k);
  3638. k = a("<tr>", {
  3639. role: "rowheader"
  3640. }).addClass("ui-jqgrid-labels jqg-third-row-header");
  3641. for (c = 0; c < x; c++) if (s = q[c].el, f = a(s), d = m[c], e = {
  3642. height: "0px",
  3643. width: q[c].width + "px",
  3644. display: d.hidden ? "none" : ""
  3645. },
  3646. a("<th>", {
  3647. role: "gridcell"
  3648. }).css(e).addClass("ui-first-th-" + this.p.direction).appendTo(n), s.style.width = "", e = w(d.name, b.groupHeaders), 0 <= e) {
  3649. e = b.groupHeaders[e];
  3650. h = e.numberOfColumns;
  3651. g = e.titleText;
  3652. for (e = d = 0; e < h && c + e < x; e++) m[c + e].hidden || d++;
  3653. e = a("<th>").attr({
  3654. role: "columnheader"
  3655. }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).css({
  3656. height: "28px",
  3657. "border-top": "0 none"
  3658. }).html(g);
  3659. 0 < d && e.attr("colspan", String(d));
  3660. this.p.headertitles && e.attr("title", e.text());
  3661. 0 === d && e.hide();
  3662. f.before(e);
  3663. k.append(s);
  3664. h -= 1
  3665. } else 0 === h ? b.useColSpanStyle ? f.attr("rowspan", "2") : (a("<th>", {
  3666. role: "columnheader"
  3667. }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).css({
  3668. display: d.hidden ? "none" : "",
  3669. "border-top": "0 none"
  3670. }).insertBefore(f), k.append(s)) : (k.append(s), h--);
  3671. m = a(this).children("thead");
  3672. m.prepend(n);
  3673. k.insertAfter(l);
  3674. p.append(m);
  3675. b.useColSpanStyle && (p.find("span.ui-jqgrid-resize").each(function () {
  3676. var b = a(this).parent();
  3677. b.is(":visible") && (this.style.cssText = "height: " + b.height() + "px !important; cursor: col-resize;")
  3678. }), p.find("div.ui-jqgrid-sortable").each(function () {
  3679. var b = a(this),
  3680. c = b.parent();
  3681. c.is(":visible") && c.is(":has(span.ui-jqgrid-resize)") && b.css("top", (c.height() - b.outerHeight()) / 2 - 2 + "px")
  3682. }));
  3683. r = m.find("tr.jqg-first-row-header");
  3684. a(this).bind("jqGridResizeStop.setGroupHeaders",
  3685. function (a, b, c) {
  3686. r.find("th").eq(c).width(b)
  3687. })
  3688. })
  3689. },
  3690. setFrozenColumns: function () {
  3691. return this.each(function () {
  3692. if (this.grid) {
  3693. var b = this,
  3694. c = b.p.colModel,
  3695. d = 0,
  3696. h = c.length,
  3697. k = -1,
  3698. e = !1;
  3699. if (!0 !== b.p.subGrid && !0 !== b.p.treeGrid && !0 !== b.p.cellEdit && !b.p.sortable && !b.p.scroll) {
  3700. b.p.rownumbers && d++;
  3701. for (b.p.multiselect && d++; d < h;) {
  3702. if (!0 === c[d].frozen) e = !0,
  3703. k = d;
  3704. else break;
  3705. d++
  3706. }
  3707. if (0 <= k && e) {
  3708. c = b.p.caption ? a(b.grid.cDiv).outerHeight() : 0;
  3709. d = a(".ui-jqgrid-htable", "#gview_" + a.jgrid.jqID(b.p.id)).height();
  3710. b.p.toppager && (c += a(b.grid.topDiv).outerHeight()); !0 === b.p.toolbar[0] && "bottom" !== b.p.toolbar[1] && (c += a(b.grid.uDiv).outerHeight());
  3711. b.grid.fhDiv = a('<div style="position:absolute;left:0px;top:' + c + "px;height:" + d + 'px;" class="frozen-div ui-state-default ui-jqgrid-hdiv"></div>');
  3712. b.grid.fbDiv = a('<div style="position:absolute;left:0px;top:' + (parseInt(c, 10) + parseInt(d, 10) + 1) + 'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>');
  3713. a("#gview_" + a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);
  3714. c = a(".ui-jqgrid-htable", "#gview_" + a.jgrid.jqID(b.p.id)).clone(!0);
  3715. if (b.p.groupHeader) {
  3716. a("tr.jqg-first-row-header, tr.jqg-third-row-header", c).each(function () {
  3717. a("th:gt(" + k + ")", this).remove()
  3718. });
  3719. var s = -1,
  3720. f = -1,
  3721. g, m;
  3722. a("tr.jqg-second-row-header th", c).each(function () {
  3723. g = parseInt(a(this).attr("colspan"), 10);
  3724. if (m = parseInt(a(this).attr("rowspan"), 10)) s++,
  3725. f++;
  3726. g && (s += g, f++);
  3727. if (s === k) return !1
  3728. });
  3729. s !== k && (f = k);
  3730. a("tr.jqg-second-row-header", c).each(function () {
  3731. a("th:gt(" + f + ")", this).remove()
  3732. })
  3733. } else a("tr", c).each(function () {
  3734. a("th:gt(" + k + ")", this).remove()
  3735. });
  3736. a(c).width(1);
  3737. a(b.grid.fhDiv).append(c).mousemove(function (a) {
  3738. if (b.grid.resizing) return b.grid.dragMove(a),
  3739. !1
  3740. });
  3741. a(b).bind("jqGridResizeStop.setFrozenColumns",
  3742. function (c, d, e) {
  3743. c = a(".ui-jqgrid-htable", b.grid.fhDiv);
  3744. a("th:eq(" + e + ")", c).width(d);
  3745. c = a(".ui-jqgrid-btable", b.grid.fbDiv);
  3746. a("tr:first td:eq(" + e + ")", c).width(d)
  3747. });
  3748. a(b).bind("jqGridSortCol.setFrozenColumns",
  3749. function (c, d, e) {
  3750. c = a("tr.ui-jqgrid-labels:last th:eq(" + b.p.lastsort + ")", b.grid.fhDiv);
  3751. d = a("tr.ui-jqgrid-labels:last th:eq(" + e + ")", b.grid.fhDiv);
  3752. a("span.ui-grid-ico-sort", c).addClass("ui-state-disabled");
  3753. a(c).attr("aria-selected", "false");
  3754. a("span.ui-icon-" + b.p.sortorder, d).removeClass("ui-state-disabled");
  3755. a(d).attr("aria-selected", "true");
  3756. b.p.viewsortcols[0] || b.p.lastsort === e || (a("span.s-ico", c).hide(), a("span.s-ico", d).show())
  3757. });
  3758. a("#gview_" + a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);
  3759. a(b.grid.bDiv).scroll(function () {
  3760. a(b.grid.fbDiv).scrollTop(a(this).scrollTop())
  3761. }); !0 === b.p.hoverrows && a("#" + a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");
  3762. a(b).bind("jqGridAfterGridComplete.setFrozenColumns",
  3763. function () {
  3764. a("#" + a.jgrid.jqID(b.p.id) + "_frozen").remove();
  3765. a(b.grid.fbDiv).height(a(b.grid.bDiv).height() - 16);
  3766. var c = a("#" + a.jgrid.jqID(b.p.id)).clone(!0);
  3767. a("tr[role=row]", c).each(function () {
  3768. a("td[role=gridcell]:gt(" + k + ")", this).remove()
  3769. });
  3770. a(c).width(1).attr("id", b.p.id + "_frozen");
  3771. a(b.grid.fbDiv).append(c); !0 === b.p.hoverrows && (a("tr.jqgrow", c).hover(function () {
  3772. a(this).addClass("ui-state-hover");
  3773. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id)).addClass("ui-state-hover")
  3774. },
  3775. function () {
  3776. a(this).removeClass("ui-state-hover");
  3777. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id)).removeClass("ui-state-hover")
  3778. }), a("tr.jqgrow", "#" + a.jgrid.jqID(b.p.id)).hover(function () {
  3779. a(this).addClass("ui-state-hover");
  3780. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id) + "_frozen").addClass("ui-state-hover")
  3781. },
  3782. function () {
  3783. a(this).removeClass("ui-state-hover");
  3784. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id) + "_frozen").removeClass("ui-state-hover")
  3785. }));
  3786. c = null
  3787. });
  3788. b.grid.hDiv.loading || a(b).triggerHandler("jqGridAfterGridComplete");
  3789. b.p.frozenColumns = !0
  3790. }
  3791. }
  3792. }
  3793. })
  3794. },
  3795. destroyFrozenColumns: function () {
  3796. return this.each(function () {
  3797. if (this.grid && !0 === this.p.frozenColumns) {
  3798. a(this.grid.fhDiv).remove();
  3799. a(this.grid.fbDiv).remove();
  3800. this.grid.fhDiv = null;
  3801. this.grid.fbDiv = null;
  3802. a(this).unbind(".setFrozenColumns");
  3803. if (!0 === this.p.hoverrows) {
  3804. var b;
  3805. a("#" + a.jgrid.jqID(this.p.id)).bind("mouseover",
  3806. function (c) {
  3807. b = a(c.target).closest("tr.jqgrow");
  3808. "ui-subgrid" !== a(b).attr("class") && a(b).addClass("ui-state-hover")
  3809. }).bind("mouseout",
  3810. function (c) {
  3811. b = a(c.target).closest("tr.jqgrow");
  3812. a(b).removeClass("ui-state-hover")
  3813. })
  3814. }
  3815. this.p.frozenColumns = !1
  3816. }
  3817. })
  3818. }
  3819. })
  3820. })(jQuery); (function (a) {
  3821. a.extend(a.jgrid, {
  3822. showModal: function (a) {
  3823. a.w.show()
  3824. },
  3825. closeModal: function (a) {
  3826. a.w.hide().attr("aria-hidden", "true");
  3827. a.o && a.o.remove()
  3828. },
  3829. hideModal: function (d, b) {
  3830. b = a.extend({
  3831. jqm: !0,
  3832. gb: ""
  3833. },
  3834. b || {});
  3835. if (b.onClose) {
  3836. var c = b.gb && "string" === typeof b.gb && "#gbox_" === b.gb.substr(0, 6) ? b.onClose.call(a("#" + b.gb.substr(6))[0], d) : b.onClose(d);
  3837. if ("boolean" === typeof c && !c) return
  3838. }
  3839. if (a.fn.jqm && !0 === b.jqm) a(d).attr("aria-hidden", "true").jqmHide();
  3840. else {
  3841. if ("" !== b.gb) try {
  3842. a(".jqgrid-overlay:first", b.gb).hide()
  3843. } catch (g) { }
  3844. a(d).hide().attr("aria-hidden", "true")
  3845. }
  3846. },
  3847. findPos: function (a) {
  3848. var b = 0,
  3849. c = 0;
  3850. if (a.offsetParent) {
  3851. do b += a.offsetLeft,
  3852. c += a.offsetTop;
  3853. while (a = a.offsetParent)
  3854. }
  3855. return [b, c]
  3856. },
  3857. createModal: function (d, b, c, g, e, h, f) {
  3858. c = a.extend(!0, {},
  3859. a.jgrid.jqModal || {},
  3860. c);
  3861. var k = document.createElement("div"),
  3862. l,
  3863. m = this;
  3864. f = a.extend({},
  3865. f || {});
  3866. l = "rtl" === a(c.gbox).attr("dir") ? !0 : !1;
  3867. k.className = "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
  3868. k.id = d.themodal;
  3869. var n = document.createElement("div");
  3870. n.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
  3871. n.id = d.modalhead;
  3872. a(n).append("<span class='ui-jqdialog-title'>" + c.caption + "</span>");
  3873. var q = a("<a class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function () {
  3874. q.addClass("ui-state-hover")
  3875. },
  3876. function () {
  3877. q.removeClass("ui-state-hover")
  3878. }).append("<span class='ui-icon ui-icon-closethick'></span>");
  3879. a(n).append(q);
  3880. l ? (k.dir = "rtl", a(".ui-jqdialog-title", n).css("float", "right"), a(".ui-jqdialog-titlebar-close", n).css("left", "0.3em")) : (k.dir = "ltr", a(".ui-jqdialog-title", n).css("float", "left"), a(".ui-jqdialog-titlebar-close", n).css("right", "0.3em"));
  3881. var p = document.createElement("div");
  3882. a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id", d.modalcontent);
  3883. a(p).append(b);
  3884. k.appendChild(p);
  3885. a(k).prepend(n); !0 === h ? a("body").append(k) : "string" === typeof h ? a(h).append(k) : a(k).insertBefore(g);
  3886. a(k).css(f);
  3887. void 0 === c.jqModal && (c.jqModal = !0);
  3888. b = {};
  3889. if (a.fn.jqm && !0 === c.jqModal) 0 === c.left && 0 === c.top && c.overlay && (f = [], f = a.jgrid.findPos(e), c.left = f[0] + 4, c.top = f[1] + 4),
  3890. b.top = c.top + "px",
  3891. b.left = c.left;
  3892. else if (0 !== c.left || 0 !== c.top) b.left = c.left,
  3893. b.top = c.top + "px";
  3894. a("a.ui-jqdialog-titlebar-close", n).click(function () {
  3895. var b = a("#" + a.jgrid.jqID(d.themodal)).data("onClose") || c.onClose,
  3896. e = a("#" + a.jgrid.jqID(d.themodal)).data("gbox") || c.gbox;
  3897. m.hideModal("#" + a.jgrid.jqID(d.themodal), {
  3898. gb: e,
  3899. jqm: c.jqModal,
  3900. onClose: b
  3901. });
  3902. return !1
  3903. });
  3904. 0 !== c.width && c.width || (c.width = 300);
  3905. 0 !== c.height && c.height || (c.height = 200);
  3906. c.zIndex || (g = a(g).parents("*[role=dialog]").filter(":first").css("z-index"), c.zIndex = g ? parseInt(g, 10) + 2 : 950);
  3907. g = 0;
  3908. l && b.left && !h && (g = a(c.gbox).width() - (isNaN(c.width) ? 0 : parseInt(c.width, 10)) - 8, b.left = parseInt(b.left, 10) + parseInt(g, 10));
  3909. b.left && (b.left += "px");
  3910. a(k).css(a.extend({
  3911. width: isNaN(c.width) ? "auto" : c.width + "px",
  3912. height: isNaN(c.height) ? "auto" : c.height + "px",
  3913. zIndex: c.zIndex,
  3914. overflow: "hidden"
  3915. },
  3916. b)).attr({
  3917. tabIndex: "-1",
  3918. role: "dialog",
  3919. "aria-labelledby": d.modalhead,
  3920. "aria-hidden": "true"
  3921. });
  3922. void 0 === c.drag && (c.drag = !0);
  3923. void 0 === c.resize && (c.resize = !0);
  3924. if (c.drag) if (a(n).css("cursor", "move"), a.fn.jqDrag) a(k).jqDrag(n);
  3925. else try {
  3926. a(k).draggable({
  3927. handle: a("#" + a.jgrid.jqID(n.id))
  3928. })
  3929. } catch (r) { }
  3930. if (c.resize) if (a.fn.jqResize) a(k).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se'></div>"),
  3931. a("#" + a.jgrid.jqID(d.themodal)).jqResize(".jqResize", d.scrollelm ? "#" + a.jgrid.jqID(d.scrollelm) : !1);
  3932. else try {
  3933. a(k).resizable({
  3934. handles: "se, sw",
  3935. alsoResize: d.scrollelm ? "#" + a.jgrid.jqID(d.scrollelm) : !1
  3936. })
  3937. } catch (s) { } !0 === c.closeOnEscape && a(k).keydown(function (b) {
  3938. 27 == b.which && (b = a("#" + a.jgrid.jqID(d.themodal)).data("onClose") || c.onClose, m.hideModal("#" + a.jgrid.jqID(d.themodal), {
  3939. gb: c.gbox,
  3940. jqm: c.jqModal,
  3941. onClose: b
  3942. }))
  3943. })
  3944. },
  3945. viewModal: function (d, b) {
  3946. b = a.extend({
  3947. toTop: !0,
  3948. overlay: 10,
  3949. modal: !1,
  3950. overlayClass: "ui-widget-overlay",
  3951. onShow: a.jgrid.showModal,
  3952. onHide: a.jgrid.closeModal,
  3953. gbox: "",
  3954. jqm: !0,
  3955. jqM: !0
  3956. },
  3957. b || {});
  3958. if (a.fn.jqm && !0 === b.jqm) b.jqM ? a(d).attr("aria-hidden", "false").jqm(b).jqmShow() : a(d).attr("aria-hidden", "false").jqmShow();
  3959. else {
  3960. "" !== b.gbox && (a(".jqgrid-overlay:first", b.gbox).show(), a(d).data("gbox", b.gbox));
  3961. a(d).show().attr("aria-hidden", "false");
  3962. try {
  3963. a(":input:visible", d)[0].focus()
  3964. } catch (c) { }
  3965. }
  3966. },
  3967. info_dialog: function (d, b, c, g) {
  3968. var e = {
  3969. width: 290,
  3970. height: "auto",
  3971. dataheight: "auto",
  3972. drag: !0,
  3973. resize: !1,
  3974. left: 250,
  3975. top: 170,
  3976. zIndex: 1E3,
  3977. jqModal: !0,
  3978. modal: !1,
  3979. closeOnEscape: !0,
  3980. align: "center",
  3981. buttonalign: "center",
  3982. buttons: []
  3983. };
  3984. a.extend(!0, e, a.jgrid.jqModal || {},
  3985. {
  3986. caption: "<b>" + d + "</b>"
  3987. },
  3988. g || {});
  3989. var h = e.jqModal,
  3990. f = this;
  3991. a.fn.jqm && !h && (h = !1);
  3992. d = "";
  3993. if (0 < e.buttons.length) for (g = 0; g < e.buttons.length; g++) void 0 === e.buttons[g].id && (e.buttons[g].id = "info_button_" + g),
  3994. d += "<a id='" + e.buttons[g].id + "' class='fm-button ui-state-default ui-corner-all'>" + e.buttons[g].text + "</a>";
  3995. g = isNaN(e.dataheight) ? e.dataheight : e.dataheight + "px";
  3996. b = "<div id='info_id'>" + ("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:" + g + ";" + ("text-align:" + e.align + ";") + "'>" + b + "</div>");
  3997. b += c ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:" + e.buttonalign + ";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a id='closedialog' class='fm-button ui-state-default ui-corner-all'>" + c + "</a>" + d + "</div>" : "" !== d ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:" + e.buttonalign + ";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>" + d + "</div>" : "";
  3998. b += "</div>";
  3999. try {
  4000. "false" === a("#info_dialog").attr("aria-hidden") && a.jgrid.hideModal("#info_dialog", {
  4001. jqm: h
  4002. }),
  4003. a("#info_dialog").remove()
  4004. } catch (k) { }
  4005. a.jgrid.createModal({
  4006. themodal: "info_dialog",
  4007. modalhead: "info_head",
  4008. modalcontent: "info_content",
  4009. scrollelm: "infocnt"
  4010. },
  4011. b, e, "", "", !0);
  4012. d && a.each(e.buttons,
  4013. function (b) {
  4014. a("#" + a.jgrid.jqID(this.id), "#info_id").bind("click",
  4015. function () {
  4016. e.buttons[b].onClick.call(a("#info_dialog"));
  4017. return !1
  4018. })
  4019. });
  4020. a("#closedialog", "#info_id").click(function () {
  4021. f.hideModal("#info_dialog", {
  4022. jqm: h,
  4023. onClose: a("#info_dialog").data("onClose") || e.onClose,
  4024. gb: a("#info_dialog").data("gbox") || e.gbox
  4025. });
  4026. return !1
  4027. });
  4028. a(".fm-button", "#info_dialog").hover(function () {
  4029. a(this).addClass("ui-state-hover")
  4030. },
  4031. function () {
  4032. a(this).removeClass("ui-state-hover")
  4033. });
  4034. a.isFunction(e.beforeOpen) && e.beforeOpen();
  4035. a.jgrid.viewModal("#info_dialog", {
  4036. onHide: function (a) {
  4037. a.w.hide().remove();
  4038. a.o && a.o.remove()
  4039. },
  4040. modal: e.modal,
  4041. jqm: h
  4042. });
  4043. a.isFunction(e.afterOpen) && e.afterOpen();
  4044. try {
  4045. a("#info_dialog").focus()
  4046. } catch (l) { }
  4047. },
  4048. bindEv: function (d, b) {
  4049. a.isFunction(b.dataInit) && b.dataInit.call(this, d, b);
  4050. b.dataEvents && a.each(b.dataEvents,
  4051. function () {
  4052. void 0 !== this.data ? a(d).bind(this.type, this.data, this.fn) : a(d).bind(this.type, this.fn)
  4053. })
  4054. },
  4055. createEl: function (d, b, c, g, e) {
  4056. function h(b, d, c) {
  4057. var e = "dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr custom_element custom_value".split(" ");
  4058. void 0 !== c && a.isArray(c) && a.merge(e, c);
  4059. a.each(d,
  4060. function (d, c) {
  4061. -1 === a.inArray(d, e) && a(b).attr(d, c)
  4062. });
  4063. d.hasOwnProperty("id") || a(b).attr("id", a.jgrid.randId())
  4064. }
  4065. var f = "",
  4066. k = this;
  4067. switch (d) {
  4068. case "textarea":
  4069. f = document.createElement("textarea");
  4070. g ? b.cols || a(f).css({
  4071. width: "100%"
  4072. }) : b.cols || (b.cols = 20);
  4073. b.rows || (b.rows = 2);
  4074. if ("&nbsp;" === c || "&#160;" === c || 1 === c.length && 160 === c.charCodeAt(0)) c = "";
  4075. f.value = c;
  4076. h(f, b);
  4077. a(f).attr({
  4078. role: "textbox",
  4079. multiline: "true"
  4080. });
  4081. break;
  4082. case "checkbox":
  4083. f = document.createElement("input");
  4084. f.type = "checkbox";
  4085. b.value ? (d = b.value.split(":"), c === d[0] && (f.checked = !0, f.defaultChecked = !0), f.value = d[0], a(f).attr("offval", d[1])) : (d = (c + "").toLowerCase(), 0 > d.search(/(false|f|0|no|n|off|undefined)/i) && "" !== d ? (f.checked = !0, f.defaultChecked = !0, f.value = c) : f.value = "on", a(f).attr("offval", "off"));
  4086. h(f, b, ["value"]);
  4087. a(f).attr("role", "checkbox");
  4088. break;
  4089. case "select":
  4090. f = document.createElement("select");
  4091. f.setAttribute("role", "select");
  4092. g = []; !0 === b.multiple ? (d = !0, f.multiple = "multiple", a(f).attr("aria-multiselectable", "true")) : d = !1;
  4093. if (void 0 !== b.dataUrl) {
  4094. d = b.name ? String(b.id).substring(0, String(b.id).length - String(b.name).length - 1) : String(b.id);
  4095. var l = b.postData || e.postData;
  4096. k.p && k.p.idPrefix && (d = a.jgrid.stripPref(k.p.idPrefix, d));
  4097. a.ajax(a.extend({
  4098. url: a.isFunction(b.dataUrl) ? b.dataUrl.call(k, d, c, String(b.name)) : b.dataUrl,
  4099. type: "GET",
  4100. dataType: "html",
  4101. data: a.isFunction(l) ? l.call(k, d, c, String(b.name)) : l,
  4102. context: {
  4103. elem: f,
  4104. options: b,
  4105. vl: c
  4106. },
  4107. success: function (b) {
  4108. var d = [],
  4109. c = this.elem,
  4110. e = this.vl,
  4111. f = a.extend({},
  4112. this.options),
  4113. g = !0 === f.multiple;
  4114. b = a.isFunction(f.buildSelect) ? f.buildSelect.call(k, b) : b;
  4115. "string" === typeof b && (b = a(a.trim(b)).html());
  4116. b && (a(c).append(b), h(c, f, l ? ["postData"] : void 0), void 0 === f.size && (f.size = g ? 3 : 1), g ? (d = e.split(","), d = a.map(d,
  4117. function (b) {
  4118. return a.trim(b)
  4119. })) : d[0] = a.trim(e), setTimeout(function () {
  4120. a("option", c).each(function (b) {
  4121. 0 === b && c.multiple && (this.selected = !1);
  4122. a(this).attr("role", "option");
  4123. if (-1 < a.inArray(a.trim(a(this).text()), d) || -1 < a.inArray(a.trim(a(this).val()), d)) this.selected = "selected"
  4124. })
  4125. },
  4126. 0))
  4127. }
  4128. },
  4129. e || {}))
  4130. } else if (b.value) {
  4131. var m;
  4132. void 0 === b.size && (b.size = d ? 3 : 1);
  4133. d && (g = c.split(","), g = a.map(g,
  4134. function (b) {
  4135. return a.trim(b)
  4136. }));
  4137. "function" === typeof b.value && (b.value = b.value());
  4138. var n, q, p = void 0 === b.separator ? ":" : b.separator;
  4139. e = void 0 === b.delimiter ? ";" : b.delimiter;
  4140. if ("string" === typeof b.value) for (n = b.value.split(e), m = 0; m < n.length; m++) q = n[m].split(p),
  4141. 2 < q.length && (q[1] = a.map(q,
  4142. function (a, b) {
  4143. if (0 < b) return a
  4144. }).join(p)),
  4145. e = document.createElement("option"),
  4146. e.setAttribute("role", "option"),
  4147. e.value = q[0],
  4148. e.innerHTML = q[1],
  4149. f.appendChild(e),
  4150. d || a.trim(q[0]) !== a.trim(c) && a.trim(q[1]) !== a.trim(c) || (e.selected = "selected"),
  4151. d && (-1 < a.inArray(a.trim(q[1]), g) || -1 < a.inArray(a.trim(q[0]), g)) && (e.selected = "selected");
  4152. else if ("object" === typeof b.value) for (m in p = b.value, p) p.hasOwnProperty(m) && (e = document.createElement("option"), e.setAttribute("role", "option"), e.value = m, e.innerHTML = p[m], f.appendChild(e), d || a.trim(m) !== a.trim(c) && a.trim(p[m]) !== a.trim(c) || (e.selected = "selected"), d && (-1 < a.inArray(a.trim(p[m]), g) || -1 < a.inArray(a.trim(m), g)) && (e.selected = "selected"));
  4153. h(f, b, ["value"])
  4154. }
  4155. break;
  4156. case "text":
  4157. case "password":
  4158. case "button":
  4159. m = "button" === d ? "button" : "textbox";
  4160. f = document.createElement("input");
  4161. f.type = d;
  4162. f.value = c;
  4163. h(f, b);
  4164. "button" !== d && (g ? b.size || a(f).css({
  4165. width: "100%"
  4166. }) : b.size || (b.size = 20));
  4167. a(f).attr("role", m);
  4168. break;
  4169. case "image":
  4170. case "file":
  4171. f = document.createElement("input");
  4172. f.type = d;
  4173. h(f, b);
  4174. break;
  4175. case "custom":
  4176. f = document.createElement("span");
  4177. try {
  4178. if (a.isFunction(b.custom_element)) if (p = b.custom_element.call(k, c, b)) p = a(p).addClass("customelement").attr({
  4179. id: b.id,
  4180. name: b.name
  4181. }),
  4182. a(f).empty().append(p);
  4183. else throw "e2";
  4184. else throw "e1";
  4185. } catch (r) {
  4186. "e1" === r && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  4187. "e2" === r ? a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.novalue, a.jgrid.edit.bClose) : a.jgrid.info_dialog(a.jgrid.errors.errcap, "string" === typeof r ? r : r.message, a.jgrid.edit.bClose)
  4188. }
  4189. }
  4190. return f
  4191. },
  4192. checkDate: function (a, b) {
  4193. var c = {},
  4194. g;
  4195. a = a.toLowerCase();
  4196. g = -1 !== a.indexOf("/") ? "/" : -1 !== a.indexOf("-") ? "-" : -1 !== a.indexOf(".") ? "." : "/";
  4197. a = a.split(g);
  4198. b = b.split(g);
  4199. if (3 !== b.length) return !1;
  4200. var e = -1,
  4201. h, f = g = -1,
  4202. k;
  4203. for (k = 0; k < a.length; k++) h = isNaN(b[k]) ? 0 : parseInt(b[k], 10),
  4204. c[a[k]] = h,
  4205. h = a[k],
  4206. -1 !== h.indexOf("y") && (e = k),
  4207. -1 !== h.indexOf("m") && (f = k),
  4208. -1 !== h.indexOf("d") && (g = k);
  4209. h = "y" === a[e] || "yyyy" === a[e] ? 4 : "yy" === a[e] ? 2 : -1;
  4210. k = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  4211. var l;
  4212. if (-1 === e) return !1;
  4213. l = c[a[e]].toString();
  4214. 2 === h && 1 === l.length && (h = 1);
  4215. if (l.length !== h || 0 === c[a[e]] && "00" !== b[e] || -1 === f) return !1;
  4216. l = c[a[f]].toString();
  4217. if (1 > l.length || 1 > c[a[f]] || 12 < c[a[f]] || -1 === g) return !1;
  4218. l = c[a[g]].toString();
  4219. if (!(h = 1 > l.length) && !(h = 1 > c[a[g]]) && !(h = 31 < c[a[g]])) {
  4220. if (h = 2 === c[a[f]]) e = c[a[e]],
  4221. h = c[a[g]] > (0 !== e % 4 || 0 === e % 100 && 0 !== e % 400 ? 28 : 29);
  4222. h = h || c[a[g]] > k[c[a[f]]]
  4223. }
  4224. return h ? !1 : !0
  4225. },
  4226. isEmpty: function (a) {
  4227. return a.match(/^\s+$/) || "" === a ? !0 : !1
  4228. },
  4229. checkTime: function (d) {
  4230. var b = /^(\d{1,2}):(\d{2})([apAP][Mm])?$/;
  4231. if (!a.jgrid.isEmpty(d)) if (d = d.match(b)) {
  4232. if (d[3]) {
  4233. if (1 > d[1] || 12 < d[1]) return !1
  4234. } else if (23 < d[1]) return !1;
  4235. if (59 < d[2]) return !1
  4236. } else return !1;
  4237. return !0
  4238. },
  4239. checkValues: function (d, b, c, g) {
  4240. var e, h, f;
  4241. f = this.p.colModel;
  4242. if (void 0 === c) if ("string" === typeof b) for (c = 0, g = f.length; c < g; c++) {
  4243. if (f[c].name === b) {
  4244. e = f[c].editrules;
  4245. b = c;
  4246. null != f[c].formoptions && (h = f[c].formoptions.label);
  4247. break
  4248. }
  4249. } else 0 <= b && (e = f[b].editrules);
  4250. else e = c,
  4251. h = void 0 === g ? "_" : g;
  4252. if (e) {
  4253. h || (h = null != this.p.colNames ? this.p.colNames[b] : f[b].label);
  4254. if (!0 === e.required && a.jgrid.isEmpty(d)) return [!1, h + ": " + a.jgrid.edit.msg.required, ""];
  4255. c = !1 === e.required ? !1 : !0;
  4256. if (!0 === e.number && (!1 !== c || !a.jgrid.isEmpty(d)) && isNaN(d)) return [!1, h + ": " + a.jgrid.edit.msg.number, ""];
  4257. if (void 0 !== e.minValue && !isNaN(e.minValue) && parseFloat(d) < parseFloat(e.minValue)) return [!1, h + ": " + a.jgrid.edit.msg.minValue + " " + e.minValue, ""];
  4258. if (void 0 !== e.maxValue && !isNaN(e.maxValue) && parseFloat(d) > parseFloat(e.maxValue)) return [!1, h + ": " + a.jgrid.edit.msg.maxValue + " " + e.maxValue, ""];
  4259. if (!(!0 !== e.email || !1 === c && a.jgrid.isEmpty(d) || (g = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, g.test(d)))) return [!1, h + ": " + a.jgrid.edit.msg.email, ""];
  4260. if (!(!0 !== e.integer || !1 === c && a.jgrid.isEmpty(d) || !isNaN(d) && 0 === d % 1 && -1 === d.indexOf("."))) return [!1, h + ": " + a.jgrid.edit.msg.integer, ""];
  4261. if (!(!0 !== e.date || !1 === c && a.jgrid.isEmpty(d) || (f[b].formatoptions && f[b].formatoptions.newformat ? (f = f[b].formatoptions.newformat, a.jgrid.formatter.date.masks.hasOwnProperty(f) && (f = a.jgrid.formatter.date.masks[f])) : f = f[b].datefmt || "Y-m-d", a.jgrid.checkDate(f, d)))) return [!1, h + ": " + a.jgrid.edit.msg.date + " - " + f, ""];
  4262. if (!0 === e.time && !(!1 === c && a.jgrid.isEmpty(d) || a.jgrid.checkTime(d))) return [!1, h + ": " + a.jgrid.edit.msg.date + " - hh:mm (am/pm)", ""];
  4263. if (!(!0 !== e.url || !1 === c && a.jgrid.isEmpty(d) || (g = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i, g.test(d)))) return [!1, h + ": " + a.jgrid.edit.msg.url, ""];
  4264. if (!0 === e.custom && (!1 !== c || !a.jgrid.isEmpty(d))) return a.isFunction(e.custom_func) ? (d = e.custom_func.call(this, d, h, b), a.isArray(d) ? d : [!1, a.jgrid.edit.msg.customarray, ""]) : [!1, a.jgrid.edit.msg.customfcheck, ""]
  4265. }
  4266. return [!0, "", ""]
  4267. }
  4268. })
  4269. })(jQuery); (function (a) {
  4270. var b = {};
  4271. a.jgrid.extend({
  4272. searchGrid: function (b) {
  4273. b = a.extend(!0, {
  4274. recreateFilter: !1,
  4275. drag: !0,
  4276. sField: "searchField",
  4277. sValue: "searchString",
  4278. sOper: "searchOper",
  4279. sFilter: "filters",
  4280. loadDefaults: !0,
  4281. beforeShowSearch: null,
  4282. afterShowSearch: null,
  4283. onInitializeSearch: null,
  4284. afterRedraw: null,
  4285. afterChange: null,
  4286. closeAfterSearch: !1,
  4287. closeAfterReset: !1,
  4288. closeOnEscape: !1,
  4289. searchOnEnter: !1,
  4290. multipleSearch: !1,
  4291. multipleGroup: !1,
  4292. top: 0,
  4293. left: 0,
  4294. jqModal: !0,
  4295. modal: !1,
  4296. resize: !0,
  4297. width: 450,
  4298. height: "auto",
  4299. dataheight: "auto",
  4300. showQuery: !1,
  4301. errorcheck: !0,
  4302. sopt: null,
  4303. stringResult: void 0,
  4304. onClose: null,
  4305. onSearch: null,
  4306. onReset: null,
  4307. toTop: !0,
  4308. overlay: 30,
  4309. columns: [],
  4310. tmplNames: null,
  4311. tmplFilters: null,
  4312. tmplLabel: " Template: ",
  4313. showOnLoad: !1,
  4314. layer: null,
  4315. operands: {
  4316. eq: "=",
  4317. ne: "<>",
  4318. lt: "<",
  4319. le: "<=",
  4320. gt: ">",
  4321. ge: ">=",
  4322. bw: "LIKE",
  4323. bn: "NOT LIKE",
  4324. "in": "IN",
  4325. ni: "NOT IN",
  4326. ew: "LIKE",
  4327. en: "NOT LIKE",
  4328. cn: "LIKE",
  4329. nc: "NOT LIKE",
  4330. nu: "IS NULL",
  4331. nn: "ISNOT NULL"
  4332. }
  4333. },
  4334. a.jgrid.search, b || {});
  4335. return this.each(function () {
  4336. function c(c) {
  4337. w = a(e).triggerHandler("jqGridFilterBeforeShow", [c]);
  4338. void 0 === w && (w = !0);
  4339. w && a.isFunction(b.beforeShowSearch) && (w = b.beforeShowSearch.call(e, c));
  4340. w && (a.jgrid.viewModal("#" + a.jgrid.jqID(s.themodal), {
  4341. gbox: "#gbox_" + a.jgrid.jqID(h),
  4342. jqm: b.jqModal,
  4343. modal: b.modal,
  4344. overlay: b.overlay,
  4345. toTop: b.toTop
  4346. }), a(e).triggerHandler("jqGridFilterAfterShow", [c]), a.isFunction(b.afterShowSearch) && b.afterShowSearch.call(e, c))
  4347. }
  4348. var e = this;
  4349. if (e.grid) {
  4350. var h = "fbox_" + e.p.id,
  4351. w = !0,
  4352. t = !0,
  4353. s = {
  4354. themodal: "searchmod" + h,
  4355. modalhead: "searchhd" + h,
  4356. modalcontent: "searchcnt" + h,
  4357. scrollelm: h
  4358. },
  4359. r = e.p.postData[b.sFilter];
  4360. "string" === typeof r && (r = a.jgrid.parse(r)); !0 === b.recreateFilter && a("#" + a.jgrid.jqID(s.themodal)).remove();
  4361. if (void 0 !== a("#" + a.jgrid.jqID(s.themodal))[0]) c(a("#fbox_" + a.jgrid.jqID(+e.p.id)));
  4362. else {
  4363. var f = a("<div><div id='" + h + "' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_" + a.jgrid.jqID(e.p.id)),
  4364. k = "left",
  4365. u = "";
  4366. "rtl" === e.p.direction && (k = "right", u = " style='text-align:left'", f.attr("dir", "rtl"));
  4367. var x = a.extend([], e.p.colModel),
  4368. d = "<a id='" + h + "_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>" + b.Find + "</a>",
  4369. v = "<a id='" + h + "_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>" + b.Reset + "</a>",
  4370. g = "",
  4371. m = "",
  4372. p,
  4373. q = !1,
  4374. y = -1;
  4375. b.showQuery && (g = "<a id='" + h + "_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");
  4376. b.columns.length ? (x = b.columns, y = 0, p = x[0].index || x[0].name) : a.each(x,
  4377. function (a, b) {
  4378. b.label || (b.label = e.p.colNames[a]);
  4379. if (!q) {
  4380. var c = void 0 === b.search ? !0 : b.search,
  4381. d = !0 === b.hidden;
  4382. if (b.searchoptions && !0 === b.searchoptions.searchhidden && c || c && !d) q = !0,
  4383. p = b.index || b.name,
  4384. y = a
  4385. }
  4386. });
  4387. if (!r && p || !1 === b.multipleSearch) {
  4388. var D = "eq";
  4389. 0 <= y && x[y].searchoptions && x[y].searchoptions.sopt ? D = x[y].searchoptions.sopt[0] : b.sopt && b.sopt.length && (D = b.sopt[0]);
  4390. r = {
  4391. groupOp: "AND",
  4392. rules: [{
  4393. field: p,
  4394. op: D,
  4395. data: ""
  4396. }]
  4397. }
  4398. }
  4399. q = !1;
  4400. b.tmplNames && b.tmplNames.length && (q = !0, m = b.tmplLabel, m += "<select class='ui-template'>", m += "<option value='default'>Default</option>", a.each(b.tmplNames,
  4401. function (a, b) {
  4402. m += "<option value='" + a + "'>" + b + "</option>"
  4403. }), m += "</select>");
  4404. k = "<table class='EditTable' style='border:0px none;margin-top:5px' id='" + h + "_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:" + k + "'>" + v + m + "</td><td class='EditButton' " + u + ">" + g + d + "</td></tr></tbody></table>";
  4405. h = a.jgrid.jqID(h);
  4406. a("#" + h).jqFilter({
  4407. columns: x,
  4408. filter: b.loadDefaults ? r : null,
  4409. showQuery: b.showQuery,
  4410. errorcheck: b.errorcheck,
  4411. sopt: b.sopt,
  4412. groupButton: b.multipleGroup,
  4413. ruleButtons: b.multipleSearch,
  4414. afterRedraw: b.afterRedraw,
  4415. ops: b.odata,
  4416. operands: b.operands,
  4417. ajaxSelectOptions: e.p.ajaxSelectOptions,
  4418. groupOps: b.groupOps,
  4419. onChange: function () {
  4420. this.p.showQuery && a(".query", this).html(this.toUserFriendlyString());
  4421. a.isFunction(b.afterChange) && b.afterChange.call(e, a("#" + h), b)
  4422. },
  4423. direction: e.p.direction,
  4424. id: e.p.id
  4425. });
  4426. f.append(k);
  4427. q && b.tmplFilters && b.tmplFilters.length && a(".ui-template", f).bind("change",
  4428. function () {
  4429. var c = a(this).val();
  4430. "default" === c ? a("#" + h).jqFilter("addFilter", r) : a("#" + h).jqFilter("addFilter", b.tmplFilters[parseInt(c, 10)]);
  4431. return !1
  4432. }); !0 === b.multipleGroup && (b.multipleSearch = !0);
  4433. a(e).triggerHandler("jqGridFilterInitialize", [a("#" + h)]);
  4434. a.isFunction(b.onInitializeSearch) && b.onInitializeSearch.call(e, a("#" + h));
  4435. b.gbox = "#gbox_" + h;
  4436. b.layer ? a.jgrid.createModal(s, f, b, "#gview_" + a.jgrid.jqID(e.p.id), a("#gbox_" + a.jgrid.jqID(e.p.id))[0], "#" + a.jgrid.jqID(b.layer), {
  4437. position: "relative"
  4438. }) : a.jgrid.createModal(s, f, b, "#gview_" + a.jgrid.jqID(e.p.id), a("#gbox_" + a.jgrid.jqID(e.p.id))[0]); (b.searchOnEnter || b.closeOnEscape) && a("#" + a.jgrid.jqID(s.themodal)).keydown(function (c) {
  4439. var d = a(c.target);
  4440. if (b.searchOnEnter && 13 === c.which && !(d.hasClass("add-group") || d.hasClass("add-rule") || d.hasClass("delete-group") || d.hasClass("delete-rule") || d.hasClass("fm-button") && d.is("[id$=_query]"))) return a("#" + h + "_search").click(),
  4441. !1;
  4442. if (b.closeOnEscape && 27 === c.which) return a("#" + a.jgrid.jqID(s.modalhead)).find(".ui-jqdialog-titlebar-close").click(),
  4443. !1
  4444. });
  4445. g && a("#" + h + "_query").bind("click",
  4446. function () {
  4447. a(".queryresult", f).toggle();
  4448. return !1
  4449. });
  4450. void 0 === b.stringResult && (b.stringResult = b.multipleSearch);
  4451. a("#" + h + "_search").bind("click",
  4452. function () {
  4453. var c = a("#" + h),
  4454. d = {},
  4455. n,
  4456. g;
  4457. c.find(".input-elm:focus").change();
  4458. g = c.jqFilter("filterData");
  4459. if (b.errorcheck && (c[0].hideError(), b.showQuery || c.jqFilter("toSQLString"), c[0].p.error)) return c[0].showError(),
  4460. !1;
  4461. if (b.stringResult) {
  4462. try {
  4463. n = xmlJsonClass.toJson(g, "", "", !1)
  4464. } catch (f) {
  4465. try {
  4466. n = JSON.stringify(g)
  4467. } catch (k) { }
  4468. }
  4469. "string" === typeof n && (d[b.sFilter] = n, a.each([b.sField, b.sValue, b.sOper],
  4470. function () {
  4471. d[this] = ""
  4472. }))
  4473. } else b.multipleSearch ? (d[b.sFilter] = g, a.each([b.sField, b.sValue, b.sOper],
  4474. function () {
  4475. d[this] = ""
  4476. })) : (d[b.sField] = g.rules[0].field, d[b.sValue] = g.rules[0].data, d[b.sOper] = g.rules[0].op, d[b.sFilter] = "");
  4477. e.p.search = !0;
  4478. a.extend(e.p.postData, d);
  4479. t = a(e).triggerHandler("jqGridFilterSearch");
  4480. void 0 === t && (t = !0);
  4481. t && a.isFunction(b.onSearch) && (t = b.onSearch.call(e, e.p.filters)); !1 !== t && a(e).trigger("reloadGrid", [{
  4482. page: 1
  4483. }]);
  4484. b.closeAfterSearch && a.jgrid.hideModal("#" + a.jgrid.jqID(s.themodal), {
  4485. gb: "#gbox_" + a.jgrid.jqID(e.p.id),
  4486. jqm: b.jqModal,
  4487. onClose: b.onClose
  4488. });
  4489. return !1
  4490. });
  4491. a("#" + h + "_reset").bind("click",
  4492. function () {
  4493. var c = {},
  4494. d = a("#" + h);
  4495. e.p.search = !1;
  4496. e.p.resetsearch = !0; !1 === b.multipleSearch ? c[b.sField] = c[b.sValue] = c[b.sOper] = "" : c[b.sFilter] = "";
  4497. d[0].resetFilter();
  4498. q && a(".ui-template", f).val("default");
  4499. a.extend(e.p.postData, c);
  4500. t = a(e).triggerHandler("jqGridFilterReset");
  4501. void 0 === t && (t = !0);
  4502. t && a.isFunction(b.onReset) && (t = b.onReset.call(e)); !1 !== t && a(e).trigger("reloadGrid", [{
  4503. page: 1
  4504. }]);
  4505. b.closeAfterReset && a.jgrid.hideModal("#" + a.jgrid.jqID(s.themodal), {
  4506. gb: "#gbox_" + a.jgrid.jqID(e.p.id),
  4507. jqm: b.jqModal,
  4508. onClose: b.onClose
  4509. });
  4510. return !1
  4511. });
  4512. c(a("#" + h));
  4513. a(".fm-button:not(.ui-state-disabled)", f).hover(function () {
  4514. a(this).addClass("ui-state-hover")
  4515. },
  4516. function () {
  4517. a(this).removeClass("ui-state-hover")
  4518. })
  4519. }
  4520. }
  4521. })
  4522. },
  4523. editGridRow: function (z, c) {
  4524. c = a.extend(!0, {
  4525. top: 0,
  4526. left: 0,
  4527. width: 300,
  4528. datawidth: "auto",
  4529. height: "auto",
  4530. dataheight: "auto",
  4531. modal: !1,
  4532. overlay: 30,
  4533. drag: !0,
  4534. resize: !0,
  4535. url: null,
  4536. mtype: "POST",
  4537. clearAfterAdd: !0,
  4538. closeAfterEdit: !1,
  4539. reloadAfterSubmit: !0,
  4540. onInitializeForm: null,
  4541. beforeInitData: null,
  4542. beforeShowForm: null,
  4543. afterShowForm: null,
  4544. beforeSubmit: null,
  4545. afterSubmit: null,
  4546. onclickSubmit: null,
  4547. afterComplete: null,
  4548. onclickPgButtons: null,
  4549. afterclickPgButtons: null,
  4550. editData: {},
  4551. recreateForm: !1,
  4552. jqModal: !0,
  4553. closeOnEscape: !1,
  4554. addedrow: "first",
  4555. topinfo: "",
  4556. bottominfo: "",
  4557. saveicon: [],
  4558. closeicon: [],
  4559. savekey: [!1, 13],
  4560. navkeys: [!1, 38, 40],
  4561. checkOnSubmit: !1,
  4562. checkOnUpdate: !1,
  4563. _savedData: {},
  4564. processing: !1,
  4565. onClose: null,
  4566. ajaxEditOptions: {},
  4567. serializeEditData: null,
  4568. viewPagerButtons: !0,
  4569. overlayClass: "ui-widget-overlay"
  4570. },
  4571. a.jgrid.edit, c || {});
  4572. b[a(this)[0].p.id] = c;
  4573. return this.each(function () {
  4574. function e() {
  4575. a(p + " > tbody > tr > td > .FormElement").each(function () {
  4576. var b = a(".customelement", this);
  4577. if (b.length) {
  4578. var c = a(b[0]).attr("name");
  4579. a.each(d.p.colModel,
  4580. function () {
  4581. if (this.name === c && this.editoptions && a.isFunction(this.editoptions.custom_value)) {
  4582. try {
  4583. if (l[c] = this.editoptions.custom_value.call(d, a("#" + a.jgrid.jqID(c), p), "get"), void 0 === l[c]) throw "e1";
  4584. } catch (b) {
  4585. "e1" === b ? a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.novalue, a.jgrid.edit.bClose) : a.jgrid.info_dialog(a.jgrid.errors.errcap, b.message, a.jgrid.edit.bClose)
  4586. }
  4587. return !0
  4588. }
  4589. })
  4590. } else {
  4591. switch (a(this).get(0).type) {
  4592. case "checkbox":
  4593. a(this).is(":checked") ? l[this.name] = a(this).val() : (b = a(this).attr("offval"), l[this.name] = b);
  4594. break;
  4595. case "select-one":
  4596. l[this.name] = a("option:selected", this).val();
  4597. break;
  4598. case "select-multiple":
  4599. l[this.name] = a(this).val();
  4600. l[this.name] = l[this.name] ? l[this.name].join(",") : "";
  4601. a("option:selected", this).each(function (b, c) {
  4602. a(c).text()
  4603. });
  4604. break;
  4605. case "password":
  4606. case "text":
  4607. case "textarea":
  4608. case "button":
  4609. l[this.name] = a(this).val()
  4610. }
  4611. d.p.autoencode && (l[this.name] = a.jgrid.htmlEncode(l[this.name]))
  4612. }
  4613. });
  4614. return !0
  4615. }
  4616. function h(c, e, n, f) {
  4617. var k, l, p, h = 0,
  4618. q, m, r, C = [],
  4619. u = !1,
  4620. z = "",
  4621. t;
  4622. for (t = 1; t <= f; t++) z += "<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";
  4623. "_empty" !== c && (u = a(e).jqGrid("getInd", c));
  4624. a(e.p.colModel).each(function (t) {
  4625. k = this.name;
  4626. m = (l = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) ? "style='display:none'" : "";
  4627. if ("cb" !== k && "subgrid" !== k && !0 === this.editable && "rn" !== k) {
  4628. if (!1 === u) q = "";
  4629. else if (k === e.p.ExpandColumn && !0 === e.p.treeGrid) q = a("td[role='gridcell']:eq(" + t + ")", e.rows[u]).text();
  4630. else {
  4631. try {
  4632. q = a.unformat.call(e, a("td[role='gridcell']:eq(" + t + ")", e.rows[u]), {
  4633. rowId: c,
  4634. colModel: this
  4635. },
  4636. t)
  4637. } catch (w) {
  4638. q = this.edittype && "textarea" === this.edittype ? a("td[role='gridcell']:eq(" + t + ")", e.rows[u]).text() : a("td[role='gridcell']:eq(" + t + ")", e.rows[u]).html()
  4639. }
  4640. if (!q || "&nbsp;" === q || "&#160;" === q || 1 === q.length && 160 === q.charCodeAt(0)) q = ""
  4641. }
  4642. var s = a.extend({},
  4643. this.editoptions || {},
  4644. {
  4645. id: k,
  4646. name: k
  4647. }),
  4648. y = a.extend({},
  4649. {
  4650. elmprefix: "",
  4651. elmsuffix: "",
  4652. rowabove: !1,
  4653. rowcontent: ""
  4654. },
  4655. this.formoptions || {}),
  4656. v = parseInt(y.rowpos, 10) || h + 1,
  4657. A = parseInt(2 * (parseInt(y.colpos, 10) || 1), 10);
  4658. "_empty" === c && s.defaultValue && (q = a.isFunction(s.defaultValue) ? s.defaultValue.call(d) : s.defaultValue);
  4659. this.edittype || (this.edittype = "text");
  4660. d.p.autoencode && (q = a.jgrid.htmlDecode(q));
  4661. r = a.jgrid.createEl.call(d, this.edittype, s, q, !1, a.extend({},
  4662. a.jgrid.ajaxOptions, e.p.ajaxSelectOptions || {}));
  4663. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData[k] = q;
  4664. a(r).addClass("FormElement"); -1 < a.inArray(this.edittype, ["text", "textarea", "password", "select"]) && a(r).addClass("ui-widget-content ui-corner-all");
  4665. p = a(n).find("tr[rowpos=" + v + "]");
  4666. if (y.rowabove) {
  4667. var x = a("<tr><td class='contentinfo' colspan='" + 2 * f + "'>" + y.rowcontent + "</td></tr>");
  4668. a(n).append(x);
  4669. x[0].rp = v
  4670. }
  4671. 0 === p.length && (p = a("<tr " + m + " rowpos='" + v + "'></tr>").addClass("FormData").attr("id", "tr_" + k), a(p).append(z), a(n).append(p), p[0].rp = v);
  4672. a("td:eq(" + (A - 2) + ")", p[0]).html(void 0 === y.label ? e.p.colNames[t] : y.label);
  4673. a("td:eq(" + (A - 1) + ")", p[0]).append(y.elmprefix).append(r).append(y.elmsuffix);
  4674. "custom" === this.edittype && a.isFunction(s.custom_value) && s.custom_value.call(d, a("#" + k, "#" + g), "set", q);
  4675. a.jgrid.bindEv.call(d, r, s);
  4676. C[h] = t;
  4677. h++
  4678. }
  4679. });
  4680. 0 < h && (t = a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='" + (2 * f - 1) + "' class='DataTD'><input class='FormElement' id='id_g' type='text' name='" + e.p.id + "_id' value='" + c + "'/></td></tr>"), t[0].rp = h + 999, a(n).append(t), b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) && (b[d.p.id]._savedData[e.p.id + "_id"] = c);
  4681. return C
  4682. }
  4683. function w(c, e, n) {
  4684. var g, k = 0,
  4685. f, l, q, h, r;
  4686. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData = {},
  4687. b[d.p.id]._savedData[e.p.id + "_id"] = c;
  4688. var m = e.p.colModel;
  4689. if ("_empty" === c) a(m).each(function () {
  4690. g = this.name;
  4691. q = a.extend({},
  4692. this.editoptions || {}); (l = a("#" + a.jgrid.jqID(g), "#" + n)) && l.length && null !== l[0] && (h = "", "custom" === this.edittype && a.isFunction(q.custom_value) ? q.custom_value.call(d, a("#" + g, "#" + n), "set", h) : q.defaultValue ? (h = a.isFunction(q.defaultValue) ? q.defaultValue.call(d) : q.defaultValue, "checkbox" === l[0].type ? (r = h.toLowerCase(), 0 > r.search(/(false|f|0|no|n|off|undefined)/i) && "" !== r ? (l[0].checked = !0, l[0].defaultChecked = !0, l[0].value = h) : (l[0].checked = !1, l[0].defaultChecked = !1)) : l.val(h)) : "checkbox" === l[0].type ? (l[0].checked = !1, l[0].defaultChecked = !1, h = a(l).attr("offval")) : l[0].type && "select" === l[0].type.substr(0, 6) ? l[0].selectedIndex = 0 : l.val(h), !0 === b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) && (b[d.p.id]._savedData[g] = h)
  4693. }),
  4694. a("#id_g", "#" + n).val(c);
  4695. else {
  4696. var t = a(e).jqGrid("getInd", c, !0);
  4697. t && (a('td[role="gridcell"]', t).each(function (l) {
  4698. g = m[l].name;
  4699. if ("cb" !== g && "subgrid" !== g && "rn" !== g && !0 === m[l].editable) {
  4700. if (g === e.p.ExpandColumn && !0 === e.p.treeGrid) f = a(this).text();
  4701. else try {
  4702. f = a.unformat.call(e, a(this), {
  4703. rowId: c,
  4704. colModel: m[l]
  4705. },
  4706. l)
  4707. } catch (q) {
  4708. f = "textarea" === m[l].edittype ? a(this).text() : a(this).html()
  4709. }
  4710. d.p.autoencode && (f = a.jgrid.htmlDecode(f));
  4711. if (!0 === b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData[g] = f;
  4712. g = a.jgrid.jqID(g);
  4713. switch (m[l].edittype) {
  4714. case "password":
  4715. case "text":
  4716. case "button":
  4717. case "image":
  4718. case "textarea":
  4719. if ("&nbsp;" === f || "&#160;" === f || 1 === f.length && 160 === f.charCodeAt(0)) f = "";
  4720. a("#" + g, "#" + n).val(f);
  4721. break;
  4722. case "select":
  4723. var h = f.split(","),
  4724. h = a.map(h,
  4725. function (b) {
  4726. return a.trim(b)
  4727. });
  4728. a("#" + g + " option", "#" + n).each(function () {
  4729. m[l].editoptions.multiple || a.trim(f) !== a.trim(a(this).text()) && h[0] !== a.trim(a(this).text()) && h[0] !== a.trim(a(this).val()) ? m[l].editoptions.multiple ? -1 < a.inArray(a.trim(a(this).text()), h) || -1 < a.inArray(a.trim(a(this).val()), h) ? this.selected = !0 : this.selected = !1 : this.selected = !1 : this.selected = !0
  4730. });
  4731. break;
  4732. case "checkbox":
  4733. f = String(f);
  4734. if (m[l].editoptions && m[l].editoptions.value) if (m[l].editoptions.value.split(":")[0] === f) a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]({
  4735. checked: !0,
  4736. defaultChecked: !0
  4737. });
  4738. else a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]({
  4739. checked: !1,
  4740. defaultChecked: !1
  4741. });
  4742. else f = f.toLowerCase(),
  4743. 0 > f.search(/(false|f|0|no|n|off|undefined)/i) && "" !== f ? (a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]("checked", !0), a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]("defaultChecked", !0)) : (a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]("checked", !1), a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]("defaultChecked", !1));
  4744. break;
  4745. case "custom":
  4746. try {
  4747. if (m[l].editoptions && a.isFunction(m[l].editoptions.custom_value)) m[l].editoptions.custom_value.call(d, a("#" + g, "#" + n), "set", f);
  4748. else throw "e1";
  4749. } catch (p) {
  4750. "e1" === p ? a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose) : a.jgrid.info_dialog(a.jgrid.errors.errcap, p.message, a.jgrid.edit.bClose)
  4751. }
  4752. }
  4753. k++
  4754. }
  4755. }), 0 < k && a("#id_g", p).val(c))
  4756. }
  4757. }
  4758. function t() {
  4759. a.each(d.p.colModel,
  4760. function (a, b) {
  4761. b.editoptions && !0 === b.editoptions.NullIfEmpty && l.hasOwnProperty(b.name) && "" === l[b.name] && (l[b.name] = "null")
  4762. })
  4763. }
  4764. function s() {
  4765. var e, n = [!0, "", ""],
  4766. f = {},
  4767. k = d.p.prmNames,
  4768. h,
  4769. m,
  4770. r,
  4771. u,
  4772. s,
  4773. C = a(d).triggerHandler("jqGridAddEditBeforeCheckValues", [a("#" + g), B]);
  4774. C && "object" === typeof C && (l = C);
  4775. a.isFunction(b[d.p.id].beforeCheckValues) && (C = b[d.p.id].beforeCheckValues.call(d, l, a("#" + g), B)) && "object" === typeof C && (l = C);
  4776. for (r in l) if (l.hasOwnProperty(r) && (n = a.jgrid.checkValues.call(d, l[r], r), !1 === n[0])) break;
  4777. t();
  4778. n[0] && (f = a(d).triggerHandler("jqGridAddEditClickSubmit", [b[d.p.id], l, B]), void 0 === f && a.isFunction(b[d.p.id].onclickSubmit) && (f = b[d.p.id].onclickSubmit.call(d, b[d.p.id], l, B) || {}), n = a(d).triggerHandler("jqGridAddEditBeforeSubmit", [l, a("#" + g), B]), void 0 === n && (n = [!0, "", ""]), n[0] && a.isFunction(b[d.p.id].beforeSubmit) && (n = b[d.p.id].beforeSubmit.call(d, l, a("#" + g), B)));
  4779. if (n[0] && !b[d.p.id].processing) {
  4780. b[d.p.id].processing = !0;
  4781. a("#sData", p + "_2").addClass("ui-state-active");
  4782. m = k.oper;
  4783. h = k.id;
  4784. l[m] = "_empty" === a.trim(l[d.p.id + "_id"]) ? k.addoper : k.editoper;
  4785. l[m] !== k.addoper ? l[h] = l[d.p.id + "_id"] : void 0 === l[h] && (l[h] = l[d.p.id + "_id"]);
  4786. delete l[d.p.id + "_id"];
  4787. l = a.extend(l, b[d.p.id].editData, f);
  4788. if (!0 === d.p.treeGrid) for (s in l[m] === k.addoper && (u = a(d).jqGrid("getGridParam", "selrow"), l["adjacency" === d.p.treeGridModel ? d.p.treeReader.parent_id_field : "parent_id"] = u), d.p.treeReader) d.p.treeReader.hasOwnProperty(s) && (f = d.p.treeReader[s], !l.hasOwnProperty(f) || l[m] === k.addoper && "parent_id_field" === s || delete l[f]);
  4789. l[h] = a.jgrid.stripPref(d.p.idPrefix, l[h]);
  4790. s = a.extend({
  4791. url: b[d.p.id].url || a(d).jqGrid("getGridParam", "editurl"),
  4792. type: b[d.p.id].mtype,
  4793. data: a.isFunction(b[d.p.id].serializeEditData) ? b[d.p.id].serializeEditData.call(d, l) : l,
  4794. complete: function (f, r) {
  4795. var s;
  4796. l[h] = d.p.idPrefix + l[h];
  4797. 300 <= f.status && 304 !== f.status ? (n[0] = !1, n[1] = a(d).triggerHandler("jqGridAddEditErrorTextFormat", [f, B]), a.isFunction(b[d.p.id].errorTextFormat) ? n[1] = b[d.p.id].errorTextFormat.call(d, f, B) : n[1] = r + " Status: '" + f.statusText + "'. Error code: " + f.status) : (n = a(d).triggerHandler("jqGridAddEditAfterSubmit", [f, l, B]), void 0 === n && (n = [!0, "", ""]), n[0] && a.isFunction(b[d.p.id].afterSubmit) && (n = b[d.p.id].afterSubmit.call(d, f, l, B)));
  4798. if (!1 === n[0]) a("#FormError>td", p).html(n[1]),
  4799. a("#FormError", p).show();
  4800. else if (d.p.autoencode && a.each(l,
  4801. function (b, c) {
  4802. l[b] = a.jgrid.htmlDecode(c)
  4803. }), l[m] === k.addoper ? (n[2] || (n[2] = a.jgrid.randId()), l[h] = n[2], b[d.p.id].reloadAfterSubmit ? a(d).trigger("reloadGrid") : !0 === d.p.treeGrid ? a(d).jqGrid("addChildNode", n[2], u, l) : a(d).jqGrid("addRowData", n[2], l, c.addedrow), b[d.p.id].closeAfterAdd ? (!0 !== d.p.treeGrid && a(d).jqGrid("setSelection", n[2]), a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4804. gb: "#gbox_" + a.jgrid.jqID(v),
  4805. jqm: c.jqModal,
  4806. onClose: b[d.p.id].onClose
  4807. })) : b[d.p.id].clearAfterAdd && w("_empty", d, g)) : (b[d.p.id].reloadAfterSubmit ? (a(d).trigger("reloadGrid"), b[d.p.id].closeAfterEdit || setTimeout(function () {
  4808. a(d).jqGrid("setSelection", l[h])
  4809. },
  4810. 1E3)) : !0 === d.p.treeGrid ? a(d).jqGrid("setTreeRow", l[h], l) : a(d).jqGrid("setRowData", l[h], l), b[d.p.id].closeAfterEdit && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4811. gb: "#gbox_" + a.jgrid.jqID(v),
  4812. jqm: c.jqModal,
  4813. onClose: b[d.p.id].onClose
  4814. })), a.isFunction(b[d.p.id].afterComplete) && (e = f, setTimeout(function () {
  4815. a(d).triggerHandler("jqGridAddEditAfterComplete", [e, l, a("#" + g), B]);
  4816. b[d.p.id].afterComplete.call(d, e, l, a("#" + g), B);
  4817. e = null
  4818. },
  4819. 500)), b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) if (a("#" + g).data("disabled", !1), "_empty" !== b[d.p.id]._savedData[d.p.id + "_id"]) for (s in b[d.p.id]._savedData) b[d.p.id]._savedData.hasOwnProperty(s) && l[s] && (b[d.p.id]._savedData[s] = l[s]);
  4820. b[d.p.id].processing = !1;
  4821. a("#sData", p + "_2").removeClass("ui-state-active");
  4822. try {
  4823. a(":input:visible", "#" + g)[0].focus()
  4824. } catch (t) { }
  4825. }
  4826. },
  4827. a.jgrid.ajaxOptions, b[d.p.id].ajaxEditOptions);
  4828. s.url || b[d.p.id].useDataProxy || (a.isFunction(d.p.dataProxy) ? b[d.p.id].useDataProxy = !0 : (n[0] = !1, n[1] += " " + a.jgrid.errors.nourl));
  4829. n[0] && (b[d.p.id].useDataProxy ? (f = d.p.dataProxy.call(d, s, "set_" + d.p.id), void 0 === f && (f = [!0, ""]), !1 === f[0] ? (n[0] = !1, n[1] = f[1] || "Error deleting the selected row!") : (s.data.oper === k.addoper && b[d.p.id].closeAfterAdd && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4830. gb: "#gbox_" + a.jgrid.jqID(v),
  4831. jqm: c.jqModal,
  4832. onClose: b[d.p.id].onClose
  4833. }), s.data.oper === k.editoper && b[d.p.id].closeAfterEdit && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4834. gb: "#gbox_" + a.jgrid.jqID(v),
  4835. jqm: c.jqModal,
  4836. onClose: b[d.p.id].onClose
  4837. }))) : a.ajax(s))
  4838. } !1 === n[0] && (a("#FormError>td", p).html(n[1]), a("#FormError", p).show())
  4839. }
  4840. function r(a, b) {
  4841. var c = !1,
  4842. d;
  4843. for (d in a) if (a.hasOwnProperty(d) && a[d] != b[d]) {
  4844. c = !0;
  4845. break
  4846. }
  4847. return c
  4848. }
  4849. function f() {
  4850. var c = !0;
  4851. a("#FormError", p).hide();
  4852. b[d.p.id].checkOnUpdate && (l = {},
  4853. e(), M = r(l, b[d.p.id]._savedData)) && (a("#" + g).data("disabled", !0), a(".confirm", "#" + q.themodal).show(), c = !1);
  4854. return c
  4855. }
  4856. function k() {
  4857. var b;
  4858. if ("_empty" !== z && void 0 !== d.p.savedRow && 0 < d.p.savedRow.length && a.isFunction(a.fn.jqGrid.restoreRow)) for (b = 0; b < d.p.savedRow.length; b++) if (d.p.savedRow[b].id == z) {
  4859. a(d).jqGrid("restoreRow", z);
  4860. break
  4861. }
  4862. }
  4863. function u(b, c) {
  4864. var d = c[1].length - 1;
  4865. 0 === b ? a("#pData", p + "_2").addClass("ui-state-disabled") : void 0 !== c[1][b - 1] && a("#" + a.jgrid.jqID(c[1][b - 1])).hasClass("ui-state-disabled") ? a("#pData", p + "_2").addClass("ui-state-disabled") : a("#pData", p + "_2").removeClass("ui-state-disabled");
  4866. b === d ? a("#nData", p + "_2").addClass("ui-state-disabled") : void 0 !== c[1][b + 1] && a("#" + a.jgrid.jqID(c[1][b + 1])).hasClass("ui-state-disabled") ? a("#nData", p + "_2").addClass("ui-state-disabled") : a("#nData", p + "_2").removeClass("ui-state-disabled")
  4867. }
  4868. function x() {
  4869. var b = a(d).jqGrid("getDataIDs"),
  4870. c = a("#id_g", p).val();
  4871. return [a.inArray(c, b), b]
  4872. }
  4873. var d = this;
  4874. if (d.grid && z) {
  4875. var v = d.p.id,
  4876. g = "FrmGrid_" + v,
  4877. m = "TblGrid_" + v,
  4878. p = "#" + a.jgrid.jqID(m),
  4879. q = {
  4880. themodal: "editmod" + v,
  4881. modalhead: "edithd" + v,
  4882. modalcontent: "editcnt" + v,
  4883. scrollelm: g
  4884. },
  4885. y = a.isFunction(b[d.p.id].beforeShowForm) ? b[d.p.id].beforeShowForm : !1,
  4886. D = a.isFunction(b[d.p.id].afterShowForm) ? b[d.p.id].afterShowForm : !1,
  4887. A = a.isFunction(b[d.p.id].beforeInitData) ? b[d.p.id].beforeInitData : !1,
  4888. E = a.isFunction(b[d.p.id].onInitializeForm) ? b[d.p.id].onInitializeForm : !1,
  4889. n = !0,
  4890. C = 1,
  4891. I = 0,
  4892. l,
  4893. M,
  4894. B,
  4895. g = a.jgrid.jqID(g);
  4896. "new" === z ? (z = "_empty", B = "add", c.caption = b[d.p.id].addCaption) : (c.caption = b[d.p.id].editCaption, B = "edit");
  4897. c.recreateForm || a(d).data("formProp") && a.extend(b[a(this)[0].p.id], a(d).data("formProp"));
  4898. var N = !0;
  4899. c.checkOnUpdate && c.jqModal && !c.modal && (N = !1);
  4900. var H = isNaN(b[a(this)[0].p.id].dataheight) ? b[a(this)[0].p.id].dataheight : b[a(this)[0].p.id].dataheight + "px",
  4901. n = isNaN(b[a(this)[0].p.id].datawidth) ? b[a(this)[0].p.id].datawidth : b[a(this)[0].p.id].datawidth + "px",
  4902. H = a("<form name='FormPost' id='" + g + "' class='FormGrid' onSubmit='return false;' style='width:" + n + ";overflow:auto;position:relative;height:" + H + ";'></form>").data("disabled", !1),
  4903. F = a("<table id='" + m + "' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  4904. n = a(d).triggerHandler("jqGridAddEditBeforeInitData", [a("#" + g), B]);
  4905. void 0 === n && (n = !0);
  4906. n && A && (n = A.call(d, a("#" + g), B));
  4907. if (!1 !== n) {
  4908. k();
  4909. a(d.p.colModel).each(function () {
  4910. var a = this.formoptions;
  4911. C = Math.max(C, a ? a.colpos || 0 : 0);
  4912. I = Math.max(I, a ? a.rowpos || 0 : 0)
  4913. });
  4914. a(H).append(F);
  4915. A = a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='" + 2 * C + "'></td></tr>");
  4916. A[0].rp = 0;
  4917. a(F).append(A);
  4918. A = a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='" + 2 * C + "'>" + b[d.p.id].topinfo + "</td></tr>");
  4919. A[0].rp = 0;
  4920. a(F).append(A);
  4921. var n = (A = "rtl" === d.p.direction ? !0 : !1) ? "nData" : "pData",
  4922. G = A ? "pData" : "nData";
  4923. h(z, d, F, C);
  4924. var n = "<a id='" + n + "' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
  4925. G = "<a id='" + G + "' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
  4926. J = "<a id='sData' class='fm-button ui-state-default ui-corner-all'>" + c.bSubmit + "</a>",
  4927. K = "<a id='cData' class='fm-button ui-state-default ui-corner-all'>" + c.bCancel + "</a>",
  4928. m = "<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='" + m + "_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>" + (A ? G + n : n + G) + "</td><td class='EditButton'>" + J + K + "</td></tr>" + ("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>" + b[d.p.id].bottominfo + "</td></tr>"),
  4929. m = m + "</tbody></table>";
  4930. if (0 < I) {
  4931. var L = [];
  4932. a.each(a(F)[0].rows,
  4933. function (a, b) {
  4934. L[a] = b
  4935. });
  4936. L.sort(function (a, b) {
  4937. return a.rp > b.rp ? 1 : a.rp < b.rp ? -1 : 0
  4938. });
  4939. a.each(L,
  4940. function (b, c) {
  4941. a("tbody", F).append(c)
  4942. })
  4943. }
  4944. c.gbox = "#gbox_" + a.jgrid.jqID(v);
  4945. var O = !1; !0 === c.closeOnEscape && (c.closeOnEscape = !1, O = !0);
  4946. m = a("<div></div>").append(H).append(m);
  4947. a.jgrid.createModal(q, m, b[a(this)[0].p.id], "#gview_" + a.jgrid.jqID(d.p.id), a("#gbox_" + a.jgrid.jqID(d.p.id))[0]);
  4948. A && (a("#pData, #nData", p + "_2").css("float", "right"), a(".EditButton", p + "_2").css("text-align", "left"));
  4949. b[d.p.id].topinfo && a(".tinfo", p).show();
  4950. b[d.p.id].bottominfo && a(".binfo", p + "_2").show();
  4951. m = m = null;
  4952. a("#" + a.jgrid.jqID(q.themodal)).keydown(function (e) {
  4953. var n = e.target;
  4954. if (!0 === a("#" + g).data("disabled")) return !1;
  4955. if (!0 === b[d.p.id].savekey[0] && e.which === b[d.p.id].savekey[1] && "TEXTAREA" !== n.tagName) return a("#sData", p + "_2").trigger("click"),
  4956. !1;
  4957. if (27 === e.which) {
  4958. if (!f()) return !1;
  4959. O && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4960. gb: c.gbox,
  4961. jqm: c.jqModal,
  4962. onClose: b[d.p.id].onClose
  4963. });
  4964. return !1
  4965. }
  4966. if (!0 === b[d.p.id].navkeys[0]) {
  4967. if ("_empty" === a("#id_g", p).val()) return !0;
  4968. if (e.which === b[d.p.id].navkeys[1]) return a("#pData", p + "_2").trigger("click"),
  4969. !1;
  4970. if (e.which === b[d.p.id].navkeys[2]) return a("#nData", p + "_2").trigger("click"),
  4971. !1
  4972. }
  4973. });
  4974. c.checkOnUpdate && (a("a.ui-jqdialog-titlebar-close span", "#" + a.jgrid.jqID(q.themodal)).removeClass("jqmClose"), a("a.ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(q.themodal)).unbind("click").click(function () {
  4975. if (!f()) return !1;
  4976. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4977. gb: "#gbox_" + a.jgrid.jqID(v),
  4978. jqm: c.jqModal,
  4979. onClose: b[d.p.id].onClose
  4980. });
  4981. return !1
  4982. }));
  4983. c.saveicon = a.extend([!0, "left", "ui-icon-disk"], c.saveicon);
  4984. c.closeicon = a.extend([!0, "left", "ui-icon-close"], c.closeicon); !0 === c.saveicon[0] && a("#sData", p + "_2").addClass("right" === c.saveicon[1] ? "fm-button-icon-right" : "fm-button-icon-left").append("<span class='ui-icon " + c.saveicon[2] + "'></span>"); !0 === c.closeicon[0] && a("#cData", p + "_2").addClass("right" === c.closeicon[1] ? "fm-button-icon-right" : "fm-button-icon-left").append("<span class='ui-icon " + c.closeicon[2] + "'></span>");
  4985. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) J = "<a id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bYes + "</a>",
  4986. G = "<a id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bNo + "</a>",
  4987. K = "<a id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bExit + "</a>",
  4988. m = c.zIndex || 999,
  4989. m++,
  4990. a("<div class='" + c.overlayClass + " jqgrid-overlay confirm' style='z-index:" + m + ";display:none;'>&#160;</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:" + (m + 1) + "'>" + c.saveData + "<br/><br/>" + J + G + K + "</div>").insertAfter("#" + g),
  4991. a("#sNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  4992. s();
  4993. a("#" + g).data("disabled", !1);
  4994. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  4995. return !1
  4996. }),
  4997. a("#nNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  4998. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  4999. a("#" + g).data("disabled", !1);
  5000. setTimeout(function () {
  5001. a(":input:visible", "#" + g)[0].focus()
  5002. },
  5003. 0);
  5004. return !1
  5005. }),
  5006. a("#cNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  5007. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  5008. a("#" + g).data("disabled", !1);
  5009. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5010. gb: "#gbox_" + a.jgrid.jqID(v),
  5011. jqm: c.jqModal,
  5012. onClose: b[d.p.id].onClose
  5013. });
  5014. return !1
  5015. });
  5016. a(d).triggerHandler("jqGridAddEditInitializeForm", [a("#" + g), B]);
  5017. E && E.call(d, a("#" + g), B);
  5018. "_empty" !== z && b[d.p.id].viewPagerButtons ? a("#pData,#nData", p + "_2").show() : a("#pData,#nData", p + "_2").hide();
  5019. a(d).triggerHandler("jqGridAddEditBeforeShowForm", [a("#" + g), B]);
  5020. y && y.call(d, a("#" + g), B);
  5021. a("#" + a.jgrid.jqID(q.themodal)).data("onClose", b[d.p.id].onClose);
  5022. a.jgrid.viewModal("#" + a.jgrid.jqID(q.themodal), {
  5023. gbox: "#gbox_" + a.jgrid.jqID(v),
  5024. jqm: c.jqModal,
  5025. overlay: c.overlay,
  5026. modal: c.modal,
  5027. overlayClass: c.overlayClass,
  5028. onHide: function (b) {
  5029. a(d).data("formProp", {
  5030. top: parseFloat(a(b.w).css("top")),
  5031. left: parseFloat(a(b.w).css("left")),
  5032. width: a(b.w).width(),
  5033. height: a(b.w).height(),
  5034. dataheight: a("#" + g).height(),
  5035. datawidth: a("#" + g).width()
  5036. });
  5037. b.w.remove();
  5038. b.o && b.o.remove()
  5039. }
  5040. });
  5041. N || a("." + a.jgrid.jqID(c.overlayClass)).click(function () {
  5042. if (!f()) return !1;
  5043. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5044. gb: "#gbox_" + a.jgrid.jqID(v),
  5045. jqm: c.jqModal,
  5046. onClose: b[d.p.id].onClose
  5047. });
  5048. return !1
  5049. });
  5050. a(".fm-button", "#" + a.jgrid.jqID(q.themodal)).hover(function () {
  5051. a(this).addClass("ui-state-hover")
  5052. },
  5053. function () {
  5054. a(this).removeClass("ui-state-hover")
  5055. });
  5056. a("#sData", p + "_2").click(function () {
  5057. l = {};
  5058. a("#FormError", p).hide();
  5059. e();
  5060. "_empty" === l[d.p.id + "_id"] ? s() : !0 === c.checkOnSubmit ? (M = r(l, b[d.p.id]._savedData)) ? (a("#" + g).data("disabled", !0), a(".confirm", "#" + a.jgrid.jqID(q.themodal)).show()) : s() : s();
  5061. return !1
  5062. });
  5063. a("#cData", p + "_2").click(function () {
  5064. if (!f()) return !1;
  5065. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5066. gb: "#gbox_" + a.jgrid.jqID(v),
  5067. jqm: c.jqModal,
  5068. onClose: b[d.p.id].onClose
  5069. });
  5070. return !1
  5071. });
  5072. a("#nData", p + "_2").click(function () {
  5073. if (!f()) return !1;
  5074. a("#FormError", p).hide();
  5075. var b = x();
  5076. b[0] = parseInt(b[0], 10);
  5077. if (-1 !== b[0] && b[1][b[0] + 1]) {
  5078. a(d).triggerHandler("jqGridAddEditClickPgButtons", ["next", a("#" + g), b[1][b[0]]]);
  5079. var e;
  5080. if (a.isFunction(c.onclickPgButtons) && (e = c.onclickPgButtons.call(d, "next", a("#" + g), b[1][b[0]]), void 0 !== e && !1 === e) || a("#" + a.jgrid.jqID(b[1][b[0] + 1])).hasClass("ui-state-disabled")) return !1;
  5081. w(b[1][b[0] + 1], d, g);
  5082. a(d).jqGrid("setSelection", b[1][b[0] + 1]);
  5083. a(d).triggerHandler("jqGridAddEditAfterClickPgButtons", ["next", a("#" + g), b[1][b[0]]]);
  5084. a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(d, "next", a("#" + g), b[1][b[0] + 1]);
  5085. u(b[0] + 1, b)
  5086. }
  5087. return !1
  5088. });
  5089. a("#pData", p + "_2").click(function () {
  5090. if (!f()) return !1;
  5091. a("#FormError", p).hide();
  5092. var b = x();
  5093. if (-1 !== b[0] && b[1][b[0] - 1]) {
  5094. a(d).triggerHandler("jqGridAddEditClickPgButtons", ["prev", a("#" + g), b[1][b[0]]]);
  5095. var e;
  5096. if (a.isFunction(c.onclickPgButtons) && (e = c.onclickPgButtons.call(d, "prev", a("#" + g), b[1][b[0]]), void 0 !== e && !1 === e) || a("#" + a.jgrid.jqID(b[1][b[0] - 1])).hasClass("ui-state-disabled")) return !1;
  5097. w(b[1][b[0] - 1], d, g);
  5098. a(d).jqGrid("setSelection", b[1][b[0] - 1]);
  5099. a(d).triggerHandler("jqGridAddEditAfterClickPgButtons", ["prev", a("#" + g), b[1][b[0]]]);
  5100. a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(d, "prev", a("#" + g), b[1][b[0] - 1]);
  5101. u(b[0] - 1, b)
  5102. }
  5103. return !1
  5104. });
  5105. a(d).triggerHandler("jqGridAddEditAfterShowForm", [a("#" + g), B]);
  5106. D && D.call(d, a("#" + g), B);
  5107. y = x();
  5108. u(y[0], y)
  5109. }
  5110. }
  5111. })
  5112. },
  5113. viewGridRow: function (z, c) {
  5114. c = a.extend(!0, {
  5115. top: 0,
  5116. left: 0,
  5117. width: 0,
  5118. datawidth: "auto",
  5119. height: "auto",
  5120. dataheight: "auto",
  5121. modal: !1,
  5122. overlay: 30,
  5123. drag: !0,
  5124. resize: !0,
  5125. jqModal: !0,
  5126. closeOnEscape: !1,
  5127. labelswidth: "30%",
  5128. closeicon: [],
  5129. navkeys: [!1, 38, 40],
  5130. onClose: null,
  5131. beforeShowForm: null,
  5132. beforeInitData: null,
  5133. viewPagerButtons: !0,
  5134. recreateForm: !1
  5135. },
  5136. a.jgrid.view, c || {});
  5137. b[a(this)[0].p.id] = c;
  5138. return this.each(function () {
  5139. function e() {
  5140. !0 !== b[r.p.id].closeOnEscape && !0 !== b[r.p.id].navkeys[0] || setTimeout(function () {
  5141. a(".ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(v.modalhead)).focus()
  5142. },
  5143. 0)
  5144. }
  5145. function h(b, d, e, f) {
  5146. var g, k, h, q = 0,
  5147. m, p, r = [],
  5148. s = !1,
  5149. t,
  5150. u = "<td class='CaptionTD form-view-label ui-widget-content' width='" + c.labelswidth + "'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",
  5151. y = "",
  5152. z = ["integer", "number", "currency"],
  5153. v = 0,
  5154. w = 0,
  5155. A,
  5156. x,
  5157. D;
  5158. for (t = 1; t <= f; t++) y += 1 === t ? u : "<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";
  5159. a(d.p.colModel).each(function () {
  5160. (k = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) || "right" !== this.align || (this.formatter && -1 !== a.inArray(this.formatter, z) ? v = Math.max(v, parseInt(this.width, 10)) : w = Math.max(w, parseInt(this.width, 10)))
  5161. });
  5162. A = 0 !== v ? v : 0 !== w ? w : 0;
  5163. s = a(d).jqGrid("getInd", b);
  5164. a(d.p.colModel).each(function (b) {
  5165. g = this.name;
  5166. x = !1;
  5167. p = (k = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) ? "style='display:none'" : "";
  5168. D = "boolean" !== typeof this.viewable ? !0 : this.viewable;
  5169. if ("cb" !== g && "subgrid" !== g && "rn" !== g && D) {
  5170. m = !1 === s ? "" : g === d.p.ExpandColumn && !0 === d.p.treeGrid ? a("td:eq(" + b + ")", d.rows[s]).text() : a("td:eq(" + b + ")", d.rows[s]).html();
  5171. x = "right" === this.align && 0 !== A ? !0 : !1;
  5172. var c = a.extend({},
  5173. {
  5174. rowabove: !1,
  5175. rowcontent: ""
  5176. },
  5177. this.formoptions || {}),
  5178. n = parseInt(c.rowpos, 10) || q + 1,
  5179. t = parseInt(2 * (parseInt(c.colpos, 10) || 1), 10);
  5180. if (c.rowabove) {
  5181. var u = a("<tr><td class='contentinfo' colspan='" + 2 * f + "'>" + c.rowcontent + "</td></tr>");
  5182. a(e).append(u);
  5183. u[0].rp = n
  5184. }
  5185. h = a(e).find("tr[rowpos=" + n + "]");
  5186. 0 === h.length && (h = a("<tr " + p + " rowpos='" + n + "'></tr>").addClass("FormData").attr("id", "trv_" + g), a(h).append(y), a(e).append(h), h[0].rp = n);
  5187. a("td:eq(" + (t - 2) + ")", h[0]).html("<b>" + (void 0 === c.label ? d.p.colNames[b] : c.label) + "</b>");
  5188. a("td:eq(" + (t - 1) + ")", h[0]).append("<span>" + m + "</span>").attr("id", "v_" + g);
  5189. x && a("td:eq(" + (t - 1) + ") span", h[0]).css({
  5190. "text-align": "right",
  5191. width: A + "px"
  5192. });
  5193. r[q] = b;
  5194. q++
  5195. }
  5196. });
  5197. 0 < q && (b = a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='" + (2 * f - 1) + "' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='" + b + "'/></td></tr>"), b[0].rp = q + 99, a(e).append(b));
  5198. return r
  5199. }
  5200. function w(b, c) {
  5201. var d, e, f = 0,
  5202. g, k;
  5203. if (k = a(c).jqGrid("getInd", b, !0)) a("td", k).each(function (b) {
  5204. d = c.p.colModel[b].name;
  5205. e = c.p.colModel[b].editrules && !0 === c.p.colModel[b].editrules.edithidden ? !1 : !0 === c.p.colModel[b].hidden ? !0 : !1;
  5206. "cb" !== d && "subgrid" !== d && "rn" !== d && (g = d === c.p.ExpandColumn && !0 === c.p.treeGrid ? a(this).text() : a(this).html(), d = a.jgrid.jqID("v_" + d), a("#" + d + " span", "#" + u).html(g), e && a("#" + d, "#" + u).parents("tr:first").hide(), f++)
  5207. }),
  5208. 0 < f && a("#id_g", "#" + u).val(b)
  5209. }
  5210. function t(b, c) {
  5211. var d = c[1].length - 1;
  5212. 0 === b ? a("#pData", "#" + u + "_2").addClass("ui-state-disabled") : void 0 !== c[1][b - 1] && a("#" + a.jgrid.jqID(c[1][b - 1])).hasClass("ui-state-disabled") ? a("#pData", u + "_2").addClass("ui-state-disabled") : a("#pData", "#" + u + "_2").removeClass("ui-state-disabled");
  5213. b === d ? a("#nData", "#" + u + "_2").addClass("ui-state-disabled") : void 0 !== c[1][b + 1] && a("#" + a.jgrid.jqID(c[1][b + 1])).hasClass("ui-state-disabled") ? a("#nData", u + "_2").addClass("ui-state-disabled") : a("#nData", "#" + u + "_2").removeClass("ui-state-disabled")
  5214. }
  5215. function s() {
  5216. var b = a(r).jqGrid("getDataIDs"),
  5217. c = a("#id_g", "#" + u).val();
  5218. return [a.inArray(c, b), b]
  5219. }
  5220. var r = this;
  5221. if (r.grid && z) {
  5222. var f = r.p.id,
  5223. k = "ViewGrid_" + a.jgrid.jqID(f),
  5224. u = "ViewTbl_" + a.jgrid.jqID(f),
  5225. x = "ViewGrid_" + f,
  5226. d = "ViewTbl_" + f,
  5227. v = {
  5228. themodal: "viewmod" + f,
  5229. modalhead: "viewhd" + f,
  5230. modalcontent: "viewcnt" + f,
  5231. scrollelm: k
  5232. },
  5233. g = a.isFunction(b[r.p.id].beforeInitData) ? b[r.p.id].beforeInitData : !1,
  5234. m = !0,
  5235. p = 1,
  5236. q = 0;
  5237. c.recreateForm || a(r).data("viewProp") && a.extend(b[a(this)[0].p.id], a(r).data("viewProp"));
  5238. var y = isNaN(b[a(this)[0].p.id].dataheight) ? b[a(this)[0].p.id].dataheight : b[a(this)[0].p.id].dataheight + "px",
  5239. D = isNaN(b[a(this)[0].p.id].datawidth) ? b[a(this)[0].p.id].datawidth : b[a(this)[0].p.id].datawidth + "px",
  5240. x = a("<form name='FormPost' id='" + x + "' class='FormGrid' style='width:" + D + ";overflow:auto;position:relative;height:" + y + ";'></form>"),
  5241. A = a("<table id='" + d + "' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
  5242. g && (m = g.call(r, a("#" + k)), void 0 === m && (m = !0));
  5243. if (!1 !== m) {
  5244. a(r.p.colModel).each(function () {
  5245. var a = this.formoptions;
  5246. p = Math.max(p, a ? a.colpos || 0 : 0);
  5247. q = Math.max(q, a ? a.rowpos || 0 : 0)
  5248. });
  5249. a(x).append(A);
  5250. h(z, r, A, p);
  5251. d = "rtl" === r.p.direction ? !0 : !1;
  5252. g = "<a id='" + (d ? "nData" : "pData") + "' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
  5253. m = "<a id='" + (d ? "pData" : "nData") + "' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";
  5254. y = "<a id='cData' class='fm-button ui-state-default ui-corner-all'>" + c.bClose + "</a>";
  5255. if (0 < q) {
  5256. var E = [];
  5257. a.each(a(A)[0].rows,
  5258. function (a, b) {
  5259. E[a] = b
  5260. });
  5261. E.sort(function (a, b) {
  5262. return a.rp > b.rp ? 1 : a.rp < b.rp ? -1 : 0
  5263. });
  5264. a.each(E,
  5265. function (b, c) {
  5266. a("tbody", A).append(c)
  5267. })
  5268. }
  5269. c.gbox = "#gbox_" + a.jgrid.jqID(f);
  5270. x = a("<div></div>").append(x).append("<table border='0' class='EditTable' id='" + u + "_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='" + c.labelswidth + "'>" + (d ? m + g : g + m) + "</td><td class='EditButton'>" + y + "</td></tr></tbody></table>");
  5271. a.jgrid.createModal(v, x, c, "#gview_" + a.jgrid.jqID(r.p.id), a("#gview_" + a.jgrid.jqID(r.p.id))[0]);
  5272. d && (a("#pData, #nData", "#" + u + "_2").css("float", "right"), a(".EditButton", "#" + u + "_2").css("text-align", "left"));
  5273. c.viewPagerButtons || a("#pData, #nData", "#" + u + "_2").hide();
  5274. x = null;
  5275. a("#" + v.themodal).keydown(function (d) {
  5276. if (27 === d.which) return b[r.p.id].closeOnEscape && a.jgrid.hideModal("#" + a.jgrid.jqID(v.themodal), {
  5277. gb: c.gbox,
  5278. jqm: c.jqModal,
  5279. onClose: c.onClose
  5280. }),
  5281. !1;
  5282. if (!0 === c.navkeys[0]) {
  5283. if (d.which === c.navkeys[1]) return a("#pData", "#" + u + "_2").trigger("click"),
  5284. !1;
  5285. if (d.which === c.navkeys[2]) return a("#nData", "#" + u + "_2").trigger("click"),
  5286. !1
  5287. }
  5288. });
  5289. c.closeicon = a.extend([!0, "left", "ui-icon-close"], c.closeicon); !0 === c.closeicon[0] && a("#cData", "#" + u + "_2").addClass("right" === c.closeicon[1] ? "fm-button-icon-right" : "fm-button-icon-left").append("<span class='ui-icon " + c.closeicon[2] + "'></span>");
  5290. a.isFunction(c.beforeShowForm) && c.beforeShowForm.call(r, a("#" + k));
  5291. a.jgrid.viewModal("#" + a.jgrid.jqID(v.themodal), {
  5292. gbox: "#gbox_" + a.jgrid.jqID(f),
  5293. jqm: c.jqModal,
  5294. overlay: c.overlay,
  5295. modal: c.modal,
  5296. onHide: function (b) {
  5297. a(r).data("viewProp", {
  5298. top: parseFloat(a(b.w).css("top")),
  5299. left: parseFloat(a(b.w).css("left")),
  5300. width: a(b.w).width(),
  5301. height: a(b.w).height(),
  5302. dataheight: a("#" + k).height(),
  5303. datawidth: a("#" + k).width()
  5304. });
  5305. b.w.remove();
  5306. b.o && b.o.remove()
  5307. }
  5308. });
  5309. a(".fm-button:not(.ui-state-disabled)", "#" + u + "_2").hover(function () {
  5310. a(this).addClass("ui-state-hover")
  5311. },
  5312. function () {
  5313. a(this).removeClass("ui-state-hover")
  5314. });
  5315. e();
  5316. a("#cData", "#" + u + "_2").click(function () {
  5317. a.jgrid.hideModal("#" + a.jgrid.jqID(v.themodal), {
  5318. gb: "#gbox_" + a.jgrid.jqID(f),
  5319. jqm: c.jqModal,
  5320. onClose: c.onClose
  5321. });
  5322. return !1
  5323. });
  5324. a("#nData", "#" + u + "_2").click(function () {
  5325. a("#FormError", "#" + u).hide();
  5326. var b = s();
  5327. b[0] = parseInt(b[0], 10); -1 !== b[0] && b[1][b[0] + 1] && (a.isFunction(c.onclickPgButtons) && c.onclickPgButtons.call(r, "next", a("#" + k), b[1][b[0]]), w(b[1][b[0] + 1], r), a(r).jqGrid("setSelection", b[1][b[0] + 1]), a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(r, "next", a("#" + k), b[1][b[0] + 1]), t(b[0] + 1, b));
  5328. e();
  5329. return !1
  5330. });
  5331. a("#pData", "#" + u + "_2").click(function () {
  5332. a("#FormError", "#" + u).hide();
  5333. var b = s(); -1 !== b[0] && b[1][b[0] - 1] && (a.isFunction(c.onclickPgButtons) && c.onclickPgButtons.call(r, "prev", a("#" + k), b[1][b[0]]), w(b[1][b[0] - 1], r), a(r).jqGrid("setSelection", b[1][b[0] - 1]), a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(r, "prev", a("#" + k), b[1][b[0] - 1]), t(b[0] - 1, b));
  5334. e();
  5335. return !1
  5336. });
  5337. x = s();
  5338. t(x[0], x)
  5339. }
  5340. }
  5341. })
  5342. },
  5343. delGridRow: function (z, c) {
  5344. c = a.extend(!0, {
  5345. top: 0,
  5346. left: 0,
  5347. width: 240,
  5348. height: "auto",
  5349. dataheight: "auto",
  5350. modal: !1,
  5351. overlay: 30,
  5352. drag: !0,
  5353. resize: !0,
  5354. url: "",
  5355. mtype: "POST",
  5356. reloadAfterSubmit: !0,
  5357. beforeShowForm: null,
  5358. beforeInitData: null,
  5359. afterShowForm: null,
  5360. beforeSubmit: null,
  5361. onclickSubmit: null,
  5362. afterSubmit: null,
  5363. jqModal: !0,
  5364. closeOnEscape: !1,
  5365. delData: {},
  5366. delicon: [],
  5367. cancelicon: [],
  5368. onClose: null,
  5369. ajaxDelOptions: {},
  5370. processing: !1,
  5371. serializeDelData: null,
  5372. useDataProxy: !1
  5373. },
  5374. a.jgrid.del, c || {});
  5375. b[a(this)[0].p.id] = c;
  5376. return this.each(function () {
  5377. var e = this;
  5378. if (e.grid && z) {
  5379. var h = a.isFunction(b[e.p.id].beforeShowForm),
  5380. w = a.isFunction(b[e.p.id].afterShowForm),
  5381. t = a.isFunction(b[e.p.id].beforeInitData) ? b[e.p.id].beforeInitData : !1,
  5382. s = e.p.id,
  5383. r = {},
  5384. f = !0,
  5385. k = "DelTbl_" + a.jgrid.jqID(s),
  5386. u,
  5387. x,
  5388. d,
  5389. v,
  5390. g = "DelTbl_" + s,
  5391. m = {
  5392. themodal: "delmod" + s,
  5393. modalhead: "delhd" + s,
  5394. modalcontent: "delcnt" + s,
  5395. scrollelm: k
  5396. };
  5397. a.isArray(z) && (z = z.join());
  5398. if (void 0 !== a("#" + a.jgrid.jqID(m.themodal))[0]) {
  5399. t && (f = t.call(e, a("#" + k)), void 0 === f && (f = !0));
  5400. if (!1 === f) return;
  5401. a("#DelData>td", "#" + k).text(z);
  5402. a("#DelError", "#" + k).hide(); !0 === b[e.p.id].processing && (b[e.p.id].processing = !1, a("#dData", "#" + k).removeClass("ui-state-active"));
  5403. h && b[e.p.id].beforeShowForm.call(e, a("#" + k));
  5404. a.jgrid.viewModal("#" + a.jgrid.jqID(m.themodal), {
  5405. gbox: "#gbox_" + a.jgrid.jqID(s),
  5406. jqm: b[e.p.id].jqModal,
  5407. jqM: !1,
  5408. overlay: b[e.p.id].overlay,
  5409. modal: b[e.p.id].modal
  5410. })
  5411. } else {
  5412. var p = isNaN(b[e.p.id].dataheight) ? b[e.p.id].dataheight : b[e.p.id].dataheight + "px",
  5413. q = isNaN(c.datawidth) ? c.datawidth : c.datawidth + "px",
  5414. g = "<div id='" + g + "' class='formdata' style='width:" + q + ";overflow:auto;position:relative;height:" + p + ";'><table class='DelTable'><tbody>",
  5415. g = g + "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",
  5416. g = g + ("<tr id='DelData' style='display:none'><td >" + z + "</td></tr>"),
  5417. g = g + ('<tr><td class="delmsg" style="white-space:pre;">' + b[e.p.id].msg + "</td></tr><tr><td >&#160;</td></tr>"),
  5418. g = g + "</tbody></table></div>",
  5419. g = g + ("<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='" + k + "_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>" + ("<a id='dData' class='fm-button ui-state-default ui-corner-all'>" + c.bSubmit + "</a>") + "&#160;" + ("<a id='eData' class='fm-button ui-state-default ui-corner-all'>" + c.bCancel + "</a>") + "</td></tr></tbody></table>");
  5420. c.gbox = "#gbox_" + a.jgrid.jqID(s);
  5421. a.jgrid.createModal(m, g, c, "#gview_" + a.jgrid.jqID(e.p.id), a("#gview_" + a.jgrid.jqID(e.p.id))[0]);
  5422. t && (f = t.call(e, a("#" + k)), void 0 === f && (f = !0));
  5423. if (!1 === f) return;
  5424. a(".fm-button", "#" + k + "_2").hover(function () {
  5425. a(this).addClass("ui-state-hover")
  5426. },
  5427. function () {
  5428. a(this).removeClass("ui-state-hover")
  5429. });
  5430. c.delicon = a.extend([!0, "left", "ui-icon-scissors"], b[e.p.id].delicon);
  5431. c.cancelicon = a.extend([!0, "left", "ui-icon-cancel"], b[e.p.id].cancelicon); !0 === c.delicon[0] && a("#dData", "#" + k + "_2").addClass("right" === c.delicon[1] ? "fm-button-icon-right" : "fm-button-icon-left").append("<span class='ui-icon " + c.delicon[2] + "'></span>"); !0 === c.cancelicon[0] && a("#eData", "#" + k + "_2").addClass("right" === c.cancelicon[1] ? "fm-button-icon-right" : "fm-button-icon-left").append("<span class='ui-icon " + c.cancelicon[2] + "'></span>");
  5432. a("#dData", "#" + k + "_2").click(function () {
  5433. var f = [!0, ""],
  5434. g,
  5435. h = a("#DelData>td", "#" + k).text();
  5436. r = {};
  5437. a.isFunction(b[e.p.id].onclickSubmit) && (r = b[e.p.id].onclickSubmit.call(e, b[e.p.id], h) || {});
  5438. a.isFunction(b[e.p.id].beforeSubmit) && (f = b[e.p.id].beforeSubmit.call(e, h));
  5439. if (f[0] && !b[e.p.id].processing) {
  5440. b[e.p.id].processing = !0;
  5441. d = e.p.prmNames;
  5442. u = a.extend({},
  5443. b[e.p.id].delData, r);
  5444. v = d.oper;
  5445. u[v] = d.deloper;
  5446. x = d.id;
  5447. h = String(h).split(",");
  5448. if (!h.length) return !1;
  5449. for (g in h) h.hasOwnProperty(g) && (h[g] = a.jgrid.stripPref(e.p.idPrefix, h[g]));
  5450. u[x] = h.join();
  5451. a(this).addClass("ui-state-active");
  5452. g = a.extend({
  5453. url: b[e.p.id].url || a(e).jqGrid("getGridParam", "editurl"),
  5454. type: b[e.p.id].mtype,
  5455. data: a.isFunction(b[e.p.id].serializeDelData) ? b[e.p.id].serializeDelData.call(e, u) : u,
  5456. complete: function (d, g) {
  5457. var q;
  5458. 300 <= d.status && 304 !== d.status ? (f[0] = !1, a.isFunction(b[e.p.id].errorTextFormat) ? f[1] = b[e.p.id].errorTextFormat.call(e, d) : f[1] = g + " Status: '" + d.statusText + "'. Error code: " + d.status) : a.isFunction(b[e.p.id].afterSubmit) && (f = b[e.p.id].afterSubmit.call(e, d, u));
  5459. if (!1 === f[0]) a("#DelError>td", "#" + k).html(f[1]),
  5460. a("#DelError", "#" + k).show();
  5461. else {
  5462. if (b[e.p.id].reloadAfterSubmit && "local" !== e.p.datatype) a(e).trigger("reloadGrid");
  5463. else {
  5464. if (!0 === e.p.treeGrid) try {
  5465. a(e).jqGrid("delTreeNode", e.p.idPrefix + h[0])
  5466. } catch (p) { } else for (q = 0; q < h.length; q++) a(e).jqGrid("delRowData", e.p.idPrefix + h[q]);
  5467. e.p.selrow = null;
  5468. e.p.selarrrow = []
  5469. }
  5470. a.isFunction(b[e.p.id].afterComplete) && setTimeout(function () {
  5471. b[e.p.id].afterComplete.call(e, d, h)
  5472. },
  5473. 500)
  5474. }
  5475. b[e.p.id].processing = !1;
  5476. a("#dData", "#" + k + "_2").removeClass("ui-state-active");
  5477. f[0] && a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5478. gb: "#gbox_" + a.jgrid.jqID(s),
  5479. jqm: c.jqModal,
  5480. onClose: b[e.p.id].onClose
  5481. })
  5482. }
  5483. },
  5484. a.jgrid.ajaxOptions, b[e.p.id].ajaxDelOptions);
  5485. g.url || b[e.p.id].useDataProxy || (a.isFunction(e.p.dataProxy) ? b[e.p.id].useDataProxy = !0 : (f[0] = !1, f[1] += " " + a.jgrid.errors.nourl));
  5486. f[0] && (b[e.p.id].useDataProxy ? (g = e.p.dataProxy.call(e, g, "del_" + e.p.id), void 0 === g && (g = [!0, ""]), !1 === g[0] ? (f[0] = !1, f[1] = g[1] || "Error deleting the selected row!") : a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5487. gb: "#gbox_" + a.jgrid.jqID(s),
  5488. jqm: c.jqModal,
  5489. onClose: b[e.p.id].onClose
  5490. })) : a.ajax(g))
  5491. } !1 === f[0] && (a("#DelError>td", "#" + k).html(f[1]), a("#DelError", "#" + k).show());
  5492. return !1
  5493. });
  5494. a("#eData", "#" + k + "_2").click(function () {
  5495. a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5496. gb: "#gbox_" + a.jgrid.jqID(s),
  5497. jqm: b[e.p.id].jqModal,
  5498. onClose: b[e.p.id].onClose
  5499. });
  5500. return !1
  5501. });
  5502. h && b[e.p.id].beforeShowForm.call(e, a("#" + k));
  5503. a.jgrid.viewModal("#" + a.jgrid.jqID(m.themodal), {
  5504. gbox: "#gbox_" + a.jgrid.jqID(s),
  5505. jqm: b[e.p.id].jqModal,
  5506. overlay: b[e.p.id].overlay,
  5507. modal: b[e.p.id].modal
  5508. })
  5509. }
  5510. w && b[e.p.id].afterShowForm.call(e, a("#" + k)); !0 === b[e.p.id].closeOnEscape && setTimeout(function () {
  5511. a(".ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(m.modalhead)).focus()
  5512. },
  5513. 0)
  5514. }
  5515. })
  5516. },
  5517. navGrid: function (b, c, e, h, w, t, s) {
  5518. c = a.extend({
  5519. edit: !0,
  5520. editicon: "ui-icon-pencil",
  5521. add: !0,
  5522. addicon: "ui-icon-plus",
  5523. del: !0,
  5524. delicon: "ui-icon-trash",
  5525. search: !0,
  5526. searchicon: "ui-icon-search",
  5527. refresh: !0,
  5528. refreshicon: "ui-icon-refresh",
  5529. refreshstate: "firstpage",
  5530. view: !1,
  5531. viewicon: "ui-icon-document",
  5532. position: "left",
  5533. closeOnEscape: !0,
  5534. beforeRefresh: null,
  5535. afterRefresh: null,
  5536. cloneToTop: !1,
  5537. alertwidth: 200,
  5538. alertheight: "auto",
  5539. alerttop: null,
  5540. alertleft: null,
  5541. alertzIndex: null
  5542. },
  5543. a.jgrid.nav, c || {});
  5544. return this.each(function () {
  5545. if (!this.nav) {
  5546. var r = {
  5547. themodal: "alertmod_" + this.p.id,
  5548. modalhead: "alerthd_" + this.p.id,
  5549. modalcontent: "alertcnt_" + this.p.id
  5550. },
  5551. f = this,
  5552. k;
  5553. if (f.grid && "string" === typeof b) {
  5554. void 0 === a("#" + r.themodal)[0] && (c.alerttop || c.alertleft || (void 0 !== window.innerWidth ? (c.alertleft = window.innerWidth, c.alerttop = window.innerHeight) : void 0 !== document.documentElement && void 0 !== document.documentElement.clientWidth && 0 !== document.documentElement.clientWidth ? (c.alertleft = document.documentElement.clientWidth, c.alerttop = document.documentElement.clientHeight) : (c.alertleft = 1024, c.alerttop = 768), c.alertleft = c.alertleft / 2 - parseInt(c.alertwidth, 10) / 2, c.alerttop = c.alerttop / 2 - 25), a.jgrid.createModal(r, "<div>" + c.alerttext + "</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>", {
  5555. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5556. jqModal: !0,
  5557. drag: !0,
  5558. resize: !0,
  5559. caption: c.alertcap,
  5560. top: c.alerttop,
  5561. left: c.alertleft,
  5562. width: c.alertwidth,
  5563. height: c.alertheight,
  5564. closeOnEscape: c.closeOnEscape,
  5565. zIndex: c.alertzIndex
  5566. },
  5567. "#gview_" + a.jgrid.jqID(f.p.id), a("#gbox_" + a.jgrid.jqID(f.p.id))[0], !0));
  5568. var u = 1,
  5569. x, d = function () {
  5570. a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")
  5571. },
  5572. v = function () {
  5573. a(this).removeClass("ui-state-hover")
  5574. };
  5575. c.cloneToTop && f.p.toppager && (u = 2);
  5576. for (x = 0; x < u; x++) {
  5577. var g = a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),
  5578. m,
  5579. p;
  5580. 0 === x ? (m = b, p = f.p.id, m === f.p.toppager && (p += "_top", u = 1)) : (m = f.p.toppager, p = f.p.id + "_top");
  5581. "rtl" === f.p.direction && a(g).attr("dir", "rtl").css("float", "right");
  5582. c.add && (h = h || {},
  5583. k = a("<td class='ui-pg-button ui-corner-all'></td>"), a(k).append("<div class='ui-pg-div'><span class='ui-icon " + c.addicon + "'></span>" + c.addtext + "</div>"), a("tr", g).append(k), a(k, g).attr({
  5584. title: c.addtitle || "",
  5585. id: h.id || "add_" + p
  5586. }).click(function () {
  5587. a(this).hasClass("ui-state-disabled") || (a.isFunction(c.addfunc) ? c.addfunc.call(f) : a(f).jqGrid("editGridRow", "new", h));
  5588. return !1
  5589. }).hover(d, v), k = null);
  5590. c.edit && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), e = e || {},
  5591. a(k).append("<div class='ui-pg-div'><span class='ui-icon " + c.editicon + "'></span>" + c.edittext + "</div>"), a("tr", g).append(k), a(k, g).attr({
  5592. title: c.edittitle || "",
  5593. id: e.id || "edit_" + p
  5594. }).click(function () {
  5595. if (!a(this).hasClass("ui-state-disabled")) {
  5596. var b = f.p.selrow;
  5597. b ? a.isFunction(c.editfunc) ? c.editfunc.call(f, b) : a(f).jqGrid("editGridRow", b, e) : (a.jgrid.viewModal("#" + r.themodal, {
  5598. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5599. jqm: !0
  5600. }), a("#jqg_alrt").focus())
  5601. }
  5602. return !1
  5603. }).hover(d, v), k = null);
  5604. c.view && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), s = s || {},
  5605. a(k).append("<div class='ui-pg-div'><span class='ui-icon " + c.viewicon + "'></span>" + c.viewtext + "</div>"), a("tr", g).append(k), a(k, g).attr({
  5606. title: c.viewtitle || "",
  5607. id: s.id || "view_" + p
  5608. }).click(function () {
  5609. if (!a(this).hasClass("ui-state-disabled")) {
  5610. var b = f.p.selrow;
  5611. b ? a.isFunction(c.viewfunc) ? c.viewfunc.call(f, b) : a(f).jqGrid("viewGridRow", b, s) : (a.jgrid.viewModal("#" + r.themodal, {
  5612. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5613. jqm: !0
  5614. }), a("#jqg_alrt").focus())
  5615. }
  5616. return !1
  5617. }).hover(d, v), k = null);
  5618. c.del && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), w = w || {},
  5619. a(k).append("<div class='ui-pg-div'><span class='ui-icon " + c.delicon + "'></span>" + c.deltext + "</div>"), a("tr", g).append(k), a(k, g).attr({
  5620. title: c.deltitle || "",
  5621. id: w.id || "del_" + p
  5622. }).click(function () {
  5623. if (!a(this).hasClass("ui-state-disabled")) {
  5624. var b;
  5625. f.p.multiselect ? (b = f.p.selarrrow, 0 === b.length && (b = null)) : b = f.p.selrow;
  5626. b ? a.isFunction(c.delfunc) ? c.delfunc.call(f, b) : a(f).jqGrid("delGridRow", b, w) : (a.jgrid.viewModal("#" + r.themodal, {
  5627. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5628. jqm: !0
  5629. }), a("#jqg_alrt").focus())
  5630. }
  5631. return !1
  5632. }).hover(d, v), k = null); (c.add || c.edit || c.del || c.view) && a("tr", g).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");
  5633. c.search && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), t = t || {},
  5634. a(k).append("<div class='ui-pg-div'><span class='ui-icon " + c.searchicon + "'></span>" + c.searchtext + "</div>"), a("tr", g).append(k), a(k, g).attr({
  5635. title: c.searchtitle || "",
  5636. id: t.id || "search_" + p
  5637. }).click(function () {
  5638. a(this).hasClass("ui-state-disabled") || (a.isFunction(c.searchfunc) ? c.searchfunc.call(f, t) : a(f).jqGrid("searchGrid", t));
  5639. return !1
  5640. }).hover(d, v), t.showOnLoad && !0 === t.showOnLoad && a(k, g).click(), k = null);
  5641. c.refresh && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), a(k).append("<div class='ui-pg-div'><span class='ui-icon " + c.refreshicon + "'></span>" + c.refreshtext + "</div>"), a("tr", g).append(k), a(k, g).attr({
  5642. title: c.refreshtitle || "",
  5643. id: "refresh_" + p
  5644. }).click(function () {
  5645. if (!a(this).hasClass("ui-state-disabled")) {
  5646. a.isFunction(c.beforeRefresh) && c.beforeRefresh.call(f);
  5647. f.p.search = !1;
  5648. f.p.resetsearch = !0;
  5649. try {
  5650. var b = f.p.id;
  5651. f.p.postData.filters = "";
  5652. try {
  5653. a("#fbox_" + a.jgrid.jqID(b)).jqFilter("resetFilter")
  5654. } catch (d) { }
  5655. a.isFunction(f.clearToolbar) && f.clearToolbar.call(f, !1)
  5656. } catch (e) { }
  5657. switch (c.refreshstate) {
  5658. case "firstpage":
  5659. a(f).trigger("reloadGrid", [{
  5660. page: 1
  5661. }]);
  5662. break;
  5663. case "current":
  5664. a(f).trigger("reloadGrid", [{
  5665. current: !0
  5666. }])
  5667. }
  5668. a.isFunction(c.afterRefresh) && c.afterRefresh.call(f)
  5669. }
  5670. return !1
  5671. }).hover(d, v), k = null);
  5672. k = a(".ui-jqgrid").css("font-size") || "11px";
  5673. a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + k + ";visibility:hidden;' ></div>");
  5674. k = a(g).clone().appendTo("#testpg2").width();
  5675. a("#testpg2").remove();
  5676. a(m + "_" + c.position, m).append(g);
  5677. f.p._nvtd && (k > f.p._nvtd[0] && (a(m + "_" + c.position, m).width(k), f.p._nvtd[0] = k), f.p._nvtd[1] = k);
  5678. g = k = k = null;
  5679. this.nav = !0
  5680. }
  5681. }
  5682. }
  5683. })
  5684. },
  5685. navButtonAdd: function (b, c) {
  5686. c = a.extend({
  5687. caption: "newButton",
  5688. title: "",
  5689. buttonicon: "ui-icon-newwin",
  5690. onClickButton: null,
  5691. position: "last",
  5692. cursor: "pointer"
  5693. },
  5694. c || {});
  5695. return this.each(function () {
  5696. if (this.grid) {
  5697. "string" === typeof b && 0 !== b.indexOf("#") && (b = "#" + a.jgrid.jqID(b));
  5698. var e = a(".navtable", b)[0],
  5699. h = this;
  5700. if (e && (!c.id || void 0 === a("#" + a.jgrid.jqID(c.id), e)[0])) {
  5701. var w = a("<td></td>");
  5702. "NONE" === c.buttonicon.toString().toUpperCase() ? a(w).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>" + c.caption + "</div>") : a(w).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon " + c.buttonicon + "'></span>" + c.caption + "</div>");
  5703. c.id && a(w).attr("id", c.id);
  5704. "first" === c.position ? 0 === e.rows[0].cells.length ? a("tr", e).append(w) : a("tr td:eq(0)", e).before(w) : a("tr", e).append(w);
  5705. a(w, e).attr("title", c.title || "").click(function (b) {
  5706. a(this).hasClass("ui-state-disabled") || a.isFunction(c.onClickButton) && c.onClickButton.call(h, b);
  5707. return !1
  5708. }).hover(function () {
  5709. a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")
  5710. },
  5711. function () {
  5712. a(this).removeClass("ui-state-hover")
  5713. })
  5714. }
  5715. }
  5716. })
  5717. },
  5718. navSeparatorAdd: function (b, c) {
  5719. c = a.extend({
  5720. sepclass: "ui-separator",
  5721. sepcontent: "",
  5722. position: "last"
  5723. },
  5724. c || {});
  5725. return this.each(function () {
  5726. if (this.grid) {
  5727. "string" === typeof b && 0 !== b.indexOf("#") && (b = "#" + a.jgrid.jqID(b));
  5728. var e = a(".navtable", b)[0];
  5729. if (e) {
  5730. var h = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='" + c.sepclass + "'></span>" + c.sepcontent + "</td>";
  5731. "first" === c.position ? 0 === e.rows[0].cells.length ? a("tr", e).append(h) : a("tr td:eq(0)", e).before(h) : a("tr", e).append(h)
  5732. }
  5733. }
  5734. })
  5735. },
  5736. GridToForm: function (b, c) {
  5737. return this.each(function () {
  5738. var e = this,
  5739. h;
  5740. if (e.grid) {
  5741. var w = a(e).jqGrid("getRowData", b);
  5742. if (w) for (h in w) w.hasOwnProperty(h) && (a("[name=" + a.jgrid.jqID(h) + "]", c).is("input:radio") || a("[name=" + a.jgrid.jqID(h) + "]", c).is("input:checkbox") ? a("[name=" + a.jgrid.jqID(h) + "]", c).each(function () {
  5743. if (a(this).val() == w[h]) a(this)[e.p.useProp ? "prop" : "attr"]("checked", !0);
  5744. else a(this)[e.p.useProp ? "prop" : "attr"]("checked", !1)
  5745. }) : a("[name=" + a.jgrid.jqID(h) + "]", c).val(w[h]))
  5746. }
  5747. })
  5748. },
  5749. FormToGrid: function (b, c, e, h) {
  5750. return this.each(function () {
  5751. if (this.grid) {
  5752. e || (e = "set");
  5753. h || (h = "first");
  5754. var w = a(c).serializeArray(),
  5755. t = {};
  5756. a.each(w,
  5757. function (a, b) {
  5758. t[b.name] = b.value
  5759. });
  5760. "add" === e ? a(this).jqGrid("addRowData", b, t, h) : "set" === e && a(this).jqGrid("setRowData", b, t)
  5761. }
  5762. })
  5763. }
  5764. })
  5765. })(jQuery); (function (a) {
  5766. a.fn.jqFilter = function (d) {
  5767. if ("string" === typeof d) {
  5768. var q = a.fn.jqFilter[d];
  5769. if (!q) throw "jqFilter - No such method: " + d;
  5770. var x = a.makeArray(arguments).slice(1);
  5771. return q.apply(this, x)
  5772. }
  5773. var n = a.extend(!0, {
  5774. filter: null,
  5775. columns: [],
  5776. onChange: null,
  5777. afterRedraw: null,
  5778. checkValues: null,
  5779. error: !1,
  5780. errmsg: "",
  5781. errorcheck: !0,
  5782. showQuery: !0,
  5783. sopt: null,
  5784. ops: [],
  5785. operands: null,
  5786. numopts: "eq ne lt le gt ge nu nn in ni".split(" "),
  5787. stropts: "eq ne bw bn ew en cn nc nu nn in ni".split(" "),
  5788. strarr: ["text", "string", "blob"],
  5789. groupOps: [{
  5790. op: "AND",
  5791. text: "AND"
  5792. },
  5793. {
  5794. op: "OR",
  5795. text: "OR"
  5796. }],
  5797. groupButton: !0,
  5798. ruleButtons: !0,
  5799. direction: "ltr"
  5800. },
  5801. a.jgrid.filter, d || {});
  5802. return this.each(function () {
  5803. if (!this.filter) {
  5804. this.p = n;
  5805. if (null === this.p.filter || void 0 === this.p.filter) this.p.filter = {
  5806. groupOp: this.p.groupOps[0].op,
  5807. rules: [],
  5808. groups: []
  5809. };
  5810. var d, q = this.p.columns.length,
  5811. f, w = /msie/i.test(navigator.userAgent) && !window.opera;
  5812. this.p.initFilter = a.extend(!0, {},
  5813. this.p.filter);
  5814. if (q) {
  5815. for (d = 0; d < q; d++) f = this.p.columns[d],
  5816. f.stype ? f.inputtype = f.stype : f.inputtype || (f.inputtype = "text"),
  5817. f.sorttype ? f.searchtype = f.sorttype : f.searchtype || (f.searchtype = "string"),
  5818. void 0 === f.hidden && (f.hidden = !1),
  5819. f.label || (f.label = f.name),
  5820. f.index && (f.name = f.index),
  5821. f.hasOwnProperty("searchoptions") || (f.searchoptions = {}),
  5822. f.hasOwnProperty("searchrules") || (f.searchrules = {});
  5823. this.p.showQuery && a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='" + this.p.direction + "'><tbody><tr><td class='query'></td></tr></tbody></table>");
  5824. var u = function (g, l) {
  5825. var b = [!0, ""],
  5826. c = a("#" + a.jgrid.jqID(n.id))[0] || null;
  5827. if (a.isFunction(l.searchrules)) b = l.searchrules.call(c, g, l);
  5828. else if (a.jgrid && a.jgrid.checkValues) try {
  5829. b = a.jgrid.checkValues.call(c, g, -1, l.searchrules, l.label)
  5830. } catch (m) { }
  5831. b && b.length && !1 === b[0] && (n.error = !b[0], n.errmsg = b[1])
  5832. };
  5833. this.onchange = function () {
  5834. this.p.error = !1;
  5835. this.p.errmsg = "";
  5836. return a.isFunction(this.p.onChange) ? this.p.onChange.call(this, this.p) : !1
  5837. };
  5838. this.reDraw = function () {
  5839. a("table.group:first", this).remove();
  5840. var g = this.createTableForGroup(n.filter, null);
  5841. a(this).append(g);
  5842. a.isFunction(this.p.afterRedraw) && this.p.afterRedraw.call(this, this.p)
  5843. };
  5844. this.createTableForGroup = function (g, l) {
  5845. var b = this,
  5846. c, m = a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),
  5847. e = "left";
  5848. "rtl" === this.p.direction && (e = "right", m.attr("dir", "rtl"));
  5849. null === l && m.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='" + e + "'></th></tr>");
  5850. var h = a("<tr></tr>");
  5851. m.append(h);
  5852. e = a("<th colspan='5' align='" + e + "'></th>");
  5853. h.append(e);
  5854. if (!0 === this.p.ruleButtons) {
  5855. var d = a("<select class='opsel'></select>");
  5856. e.append(d);
  5857. var h = "",
  5858. k;
  5859. for (c = 0; c < n.groupOps.length; c++) k = g.groupOp === b.p.groupOps[c].op ? " selected='selected'" : "",
  5860. h += "<option value='" + b.p.groupOps[c].op + "'" + k + ">" + b.p.groupOps[c].text + "</option>";
  5861. d.append(h).bind("change",
  5862. function () {
  5863. g.groupOp = a(d).val();
  5864. b.onchange()
  5865. })
  5866. }
  5867. h = "<span></span>";
  5868. this.p.groupButton && (h = a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"), h.bind("click",
  5869. function () {
  5870. void 0 === g.groups && (g.groups = []);
  5871. g.groups.push({
  5872. groupOp: n.groupOps[0].op,
  5873. rules: [],
  5874. groups: []
  5875. });
  5876. b.reDraw();
  5877. b.onchange();
  5878. return !1
  5879. }));
  5880. e.append(h);
  5881. if (!0 === this.p.ruleButtons) {
  5882. var h = a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),
  5883. f;
  5884. h.bind("click",
  5885. function () {
  5886. void 0 === g.rules && (g.rules = []);
  5887. for (c = 0; c < b.p.columns.length; c++) {
  5888. var e = void 0 === b.p.columns[c].search ? !0 : b.p.columns[c].search,
  5889. l = !0 === b.p.columns[c].hidden;
  5890. if (!0 === b.p.columns[c].searchoptions.searchhidden && e || e && !l) {
  5891. f = b.p.columns[c];
  5892. break
  5893. }
  5894. }
  5895. e = f.searchoptions.sopt ? f.searchoptions.sopt : b.p.sopt ? b.p.sopt : -1 !== a.inArray(f.searchtype, b.p.strarr) ? b.p.stropts : b.p.numopts;
  5896. g.rules.push({
  5897. field: f.name,
  5898. op: e[0],
  5899. data: ""
  5900. });
  5901. b.reDraw();
  5902. return !1
  5903. });
  5904. e.append(h)
  5905. }
  5906. null !== l && (h = a("<input type='button' value='-' title='Delete group' class='delete-group'/>"), e.append(h), h.bind("click",
  5907. function () {
  5908. for (c = 0; c < l.groups.length; c++) if (l.groups[c] === g) {
  5909. l.groups.splice(c, 1);
  5910. break
  5911. }
  5912. b.reDraw();
  5913. b.onchange();
  5914. return !1
  5915. }));
  5916. if (void 0 !== g.groups) for (c = 0; c < g.groups.length; c++) e = a("<tr></tr>"),
  5917. m.append(e),
  5918. h = a("<td class='first'></td>"),
  5919. e.append(h),
  5920. h = a("<td colspan='4'></td>"),
  5921. h.append(this.createTableForGroup(g.groups[c], g)),
  5922. e.append(h);
  5923. void 0 === g.groupOp && (g.groupOp = b.p.groupOps[0].op);
  5924. if (void 0 !== g.rules) for (c = 0; c < g.rules.length; c++) m.append(this.createTableRowForRule(g.rules[c], g));
  5925. return m
  5926. };
  5927. this.createTableRowForRule = function (g, l) {
  5928. var b = this,
  5929. c = a("#" + a.jgrid.jqID(n.id))[0] || null,
  5930. m = a("<tr></tr>"),
  5931. e,
  5932. h,
  5933. f,
  5934. k,
  5935. d = "",
  5936. s;
  5937. m.append("<td class='first'></td>");
  5938. var p = a("<td class='columns'></td>");
  5939. m.append(p);
  5940. var q = a("<select></select>"),
  5941. r,
  5942. t = [];
  5943. p.append(q);
  5944. q.bind("change",
  5945. function () {
  5946. g.field = a(q).val();
  5947. f = a(this).parents("tr:first");
  5948. for (e = 0; e < b.p.columns.length; e++) if (b.p.columns[e].name === g.field) {
  5949. k = b.p.columns[e];
  5950. break
  5951. }
  5952. if (k) {
  5953. k.searchoptions.id = a.jgrid.randId();
  5954. w && "text" === k.inputtype && !k.searchoptions.size && (k.searchoptions.size = 10);
  5955. var d = a.jgrid.createEl.call(c, k.inputtype, k.searchoptions, "", !0, b.p.ajaxSelectOptions || {},
  5956. !0);
  5957. a(d).addClass("input-elm");
  5958. h = k.searchoptions.sopt ? k.searchoptions.sopt : b.p.sopt ? b.p.sopt : -1 !== a.inArray(k.searchtype, b.p.strarr) ? b.p.stropts : b.p.numopts;
  5959. var l = "",
  5960. m = 0;
  5961. t = [];
  5962. a.each(b.p.ops,
  5963. function () {
  5964. t.push(this.oper)
  5965. });
  5966. for (e = 0; e < h.length; e++) r = a.inArray(h[e], t),
  5967. -1 !== r && (0 === m && (g.op = b.p.ops[r].oper), l += "<option value='" + b.p.ops[r].oper + "'>" + b.p.ops[r].text + "</option>", m++);
  5968. a(".selectopts", f).empty().append(l);
  5969. a(".selectopts", f)[0].selectedIndex = 0;
  5970. a.jgrid.msie && 9 > a.jgrid.msiever() && (l = parseInt(a("select.selectopts", f)[0].offsetWidth, 10) + 1, a(".selectopts", f).width(l), a(".selectopts", f).css("width", "auto"));
  5971. a(".data", f).empty().append(d);
  5972. a.jgrid.bindEv.call(c, d, k.searchoptions);
  5973. a(".input-elm", f).bind("change",
  5974. function (e) {
  5975. e = e.target;
  5976. g.data = "SPAN" === e.nodeName.toUpperCase() && k.searchoptions && a.isFunction(k.searchoptions.custom_value) ? k.searchoptions.custom_value.call(c, a(e).children(".customelement:first"), "get") : e.value;
  5977. b.onchange()
  5978. });
  5979. setTimeout(function () {
  5980. g.data = a(d).val();
  5981. b.onchange()
  5982. },
  5983. 0)
  5984. }
  5985. });
  5986. for (e = p = 0; e < b.p.columns.length; e++) {
  5987. s = void 0 === b.p.columns[e].search ? !0 : b.p.columns[e].search;
  5988. var u = !0 === b.p.columns[e].hidden;
  5989. if (!0 === b.p.columns[e].searchoptions.searchhidden && s || s && !u) s = "",
  5990. g.field === b.p.columns[e].name && (s = " selected='selected'", p = e),
  5991. d += "<option value='" + b.p.columns[e].name + "'" + s + ">" + b.p.columns[e].label + "</option>"
  5992. }
  5993. q.append(d);
  5994. d = a("<td class='operators'></td>");
  5995. m.append(d);
  5996. k = n.columns[p];
  5997. k.searchoptions.id = a.jgrid.randId();
  5998. w && "text" === k.inputtype && !k.searchoptions.size && (k.searchoptions.size = 10);
  5999. p = a.jgrid.createEl.call(c, k.inputtype, k.searchoptions, g.data, !0, b.p.ajaxSelectOptions || {},
  6000. !0);
  6001. if ("nu" === g.op || "nn" === g.op) a(p).attr("readonly", "true"),
  6002. a(p).attr("disabled", "true");
  6003. var v = a("<select class='selectopts'></select>");
  6004. d.append(v);
  6005. v.bind("change",
  6006. function () {
  6007. g.op = a(v).val();
  6008. f = a(this).parents("tr:first");
  6009. var c = a(".input-elm", f)[0];
  6010. "nu" === g.op || "nn" === g.op ? (g.data = "", "SELECT" !== c.tagName.toUpperCase() && (c.value = ""), c.setAttribute("readonly", "true"), c.setAttribute("disabled", "true")) : ("SELECT" === c.tagName.toUpperCase() && (g.data = c.value), c.removeAttribute("readonly"), c.removeAttribute("disabled"));
  6011. b.onchange()
  6012. });
  6013. h = k.searchoptions.sopt ? k.searchoptions.sopt : b.p.sopt ? b.p.sopt : -1 !== a.inArray(k.searchtype, b.p.strarr) ? b.p.stropts : b.p.numopts;
  6014. d = "";
  6015. a.each(b.p.ops,
  6016. function () {
  6017. t.push(this.oper)
  6018. });
  6019. for (e = 0; e < h.length; e++) r = a.inArray(h[e], t),
  6020. -1 !== r && (s = g.op === b.p.ops[r].oper ? " selected='selected'" : "", d += "<option value='" + b.p.ops[r].oper + "'" + s + ">" + b.p.ops[r].text + "</option>");
  6021. v.append(d);
  6022. d = a("<td class='data'></td>");
  6023. m.append(d);
  6024. d.append(p);
  6025. a.jgrid.bindEv.call(c, p, k.searchoptions);
  6026. a(p).addClass("input-elm").bind("change",
  6027. function () {
  6028. g.data = "custom" === k.inputtype ? k.searchoptions.custom_value.call(c, a(this).children(".customelement:first"), "get") : a(this).val();
  6029. b.onchange()
  6030. });
  6031. d = a("<td></td>");
  6032. m.append(d); !0 === this.p.ruleButtons && (p = a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"), d.append(p), p.bind("click",
  6033. function () {
  6034. for (e = 0; e < l.rules.length; e++) if (l.rules[e] === g) {
  6035. l.rules.splice(e, 1);
  6036. break
  6037. }
  6038. b.reDraw();
  6039. b.onchange();
  6040. return !1
  6041. }));
  6042. return m
  6043. };
  6044. this.getStringForGroup = function (a) {
  6045. var d = "(",
  6046. b;
  6047. if (void 0 !== a.groups) for (b = 0; b < a.groups.length; b++) {
  6048. 1 < d.length && (d += " " + a.groupOp + " ");
  6049. try {
  6050. d += this.getStringForGroup(a.groups[b])
  6051. } catch (c) {
  6052. alert(c)
  6053. }
  6054. }
  6055. if (void 0 !== a.rules) try {
  6056. for (b = 0; b < a.rules.length; b++) 1 < d.length && (d += " " + a.groupOp + " "),
  6057. d += this.getStringForRule(a.rules[b])
  6058. } catch (f) {
  6059. alert(f)
  6060. }
  6061. d += ")";
  6062. return "()" === d ? "" : d
  6063. };
  6064. this.getStringForRule = function (d) {
  6065. var f = "",
  6066. b = "",
  6067. c, m;
  6068. for (c = 0; c < this.p.ops.length; c++) if (this.p.ops[c].oper === d.op) {
  6069. f = this.p.operands.hasOwnProperty(d.op) ? this.p.operands[d.op] : "";
  6070. b = this.p.ops[c].oper;
  6071. break
  6072. }
  6073. for (c = 0; c < this.p.columns.length; c++) if (this.p.columns[c].name === d.field) {
  6074. m = this.p.columns[c];
  6075. break
  6076. }
  6077. if (void 0 == m) return "";
  6078. c = d.data;
  6079. if ("bw" === b || "bn" === b) c += "%";
  6080. if ("ew" === b || "en" === b) c = "%" + c;
  6081. if ("cn" === b || "nc" === b) c = "%" + c + "%";
  6082. if ("in" === b || "ni" === b) c = " (" + c + ")";
  6083. n.errorcheck && u(d.data, m);
  6084. return -1 !== a.inArray(m.searchtype, ["int", "integer", "float", "number", "currency"]) || "nn" === b || "nu" === b ? d.field + " " + f + " " + c : d.field + " " + f + ' "' + c + '"'
  6085. };
  6086. this.resetFilter = function () {
  6087. this.p.filter = a.extend(!0, {},
  6088. this.p.initFilter);
  6089. this.reDraw();
  6090. this.onchange()
  6091. };
  6092. this.hideError = function () {
  6093. a("th.ui-state-error", this).html("");
  6094. a("tr.error", this).hide()
  6095. };
  6096. this.showError = function () {
  6097. a("th.ui-state-error", this).html(this.p.errmsg);
  6098. a("tr.error", this).show()
  6099. };
  6100. this.toUserFriendlyString = function () {
  6101. return this.getStringForGroup(n.filter)
  6102. };
  6103. this.toString = function () {
  6104. function a(b) {
  6105. var c = "(",
  6106. f;
  6107. if (void 0 !== b.groups) for (f = 0; f < b.groups.length; f++) 1 < c.length && (c = "OR" === b.groupOp ? c + " || " : c + " && "),
  6108. c += a(b.groups[f]);
  6109. if (void 0 !== b.rules) for (f = 0; f < b.rules.length; f++) {
  6110. 1 < c.length && (c = "OR" === b.groupOp ? c + " || " : c + " && ");
  6111. var e = b.rules[f];
  6112. if (d.p.errorcheck) {
  6113. for (var h = void 0,
  6114. n = void 0,
  6115. h = 0; h < d.p.columns.length; h++) if (d.p.columns[h].name === e.field) {
  6116. n = d.p.columns[h];
  6117. break
  6118. }
  6119. n && u(e.data, n)
  6120. }
  6121. c += e.op + "(item." + e.field + ",'" + e.data + "')"
  6122. }
  6123. c += ")";
  6124. return "()" === c ? "" : c
  6125. }
  6126. var d = this;
  6127. return a(this.p.filter)
  6128. };
  6129. this.reDraw();
  6130. if (this.p.showQuery) this.onchange();
  6131. this.filter = !0
  6132. }
  6133. }
  6134. })
  6135. };
  6136. a.extend(a.fn.jqFilter, {
  6137. toSQLString: function () {
  6138. var a = "";
  6139. this.each(function () {
  6140. a = this.toUserFriendlyString()
  6141. });
  6142. return a
  6143. },
  6144. filterData: function () {
  6145. var a;
  6146. this.each(function () {
  6147. a = this.p.filter
  6148. });
  6149. return a
  6150. },
  6151. getParameter: function (a) {
  6152. return void 0 !== a && this.p.hasOwnProperty(a) ? this.p[a] : this.p
  6153. },
  6154. resetFilter: function () {
  6155. return this.each(function () {
  6156. this.resetFilter()
  6157. })
  6158. },
  6159. addFilter: function (d) {
  6160. "string" === typeof d && (d = a.jgrid.parse(d));
  6161. this.each(function () {
  6162. this.p.filter = d;
  6163. this.reDraw();
  6164. this.onchange()
  6165. })
  6166. }
  6167. })
  6168. })(jQuery); (function (a) {
  6169. a.jgrid.inlineEdit = a.jgrid.inlineEdit || {};
  6170. a.jgrid.extend({
  6171. editRow: function (c, e, b, l, h, n, p, g, f) {
  6172. var m = {},
  6173. d = a.makeArray(arguments).slice(1);
  6174. "object" === a.type(d[0]) ? m = d[0] : (void 0 !== e && (m.keys = e), a.isFunction(b) && (m.oneditfunc = b), a.isFunction(l) && (m.successfunc = l), void 0 !== h && (m.url = h), void 0 !== n && (m.extraparam = n), a.isFunction(p) && (m.aftersavefunc = p), a.isFunction(g) && (m.errorfunc = g), a.isFunction(f) && (m.afterrestorefunc = f));
  6175. m = a.extend(!0, {
  6176. keys: !1,
  6177. oneditfunc: null,
  6178. successfunc: null,
  6179. url: null,
  6180. extraparam: {},
  6181. aftersavefunc: null,
  6182. errorfunc: null,
  6183. afterrestorefunc: null,
  6184. restoreAfterError: !0,
  6185. mtype: "POST"
  6186. },
  6187. a.jgrid.inlineEdit, m);
  6188. return this.each(function () {
  6189. var d = this,
  6190. f, e, b, g = 0,
  6191. h = null,
  6192. n = {},
  6193. l, q;
  6194. d.grid && (l = a(d).jqGrid("getInd", c, !0), !1 !== l && (b = a.isFunction(m.beforeEditRow) ? m.beforeEditRow.call(d, m, c) : void 0, void 0 === b && (b = !0), b && (b = a(l).attr("editable") || "0", "0" !== b || a(l).hasClass("not-editable-row") || (q = d.p.colModel, a('td[role="gridcell"]', l).each(function (b) {
  6195. f = q[b].name;
  6196. var l = !0 === d.p.treeGrid && f === d.p.ExpandColumn;
  6197. if (l) e = a("span:first", this).html();
  6198. else try {
  6199. e = a.unformat.call(d, this, {
  6200. rowId: c,
  6201. colModel: q[b]
  6202. },
  6203. b)
  6204. } catch (m) {
  6205. e = q[b].edittype && "textarea" === q[b].edittype ? a(this).text() : a(this).html()
  6206. }
  6207. if ("cb" !== f && "subgrid" !== f && "rn" !== f && (d.p.autoencode && (e = a.jgrid.htmlDecode(e)), n[f] = e, !0 === q[b].editable)) {
  6208. null === h && (h = b);
  6209. l ? a("span:first", this).html("") : a(this).html("");
  6210. var p = a.extend({},
  6211. q[b].editoptions || {},
  6212. {
  6213. id: c + "_" + f,
  6214. name: f
  6215. });
  6216. q[b].edittype || (q[b].edittype = "text");
  6217. if ("&nbsp;" === e || "&#160;" === e || 1 === e.length && 160 === e.charCodeAt(0)) e = "";
  6218. var x = a.jgrid.createEl.call(d, q[b].edittype, p, e, !0, a.extend({},
  6219. a.jgrid.ajaxOptions, d.p.ajaxSelectOptions || {}));
  6220. a(x).addClass("editable");
  6221. l ? a("span:first", this).append(x) : a(this).append(x);
  6222. a.jgrid.bindEv.call(d, x, p);
  6223. "select" === q[b].edittype && void 0 !== q[b].editoptions && !0 === q[b].editoptions.multiple && void 0 === q[b].editoptions.dataUrl && a.jgrid.msie && a(x).width(a(x).width());
  6224. g++
  6225. }
  6226. }), 0 < g && (n.id = c, d.p.savedRow.push(n), a(l).attr("editable", "1"), setTimeout(function () {
  6227. a("td:eq(" + h + ") input", l).focus()
  6228. },
  6229. 0), !0 === m.keys && a(l).bind("keydown",
  6230. function (b) {
  6231. if (27 === b.keyCode) {
  6232. a(d).jqGrid("restoreRow", c, m.afterrestorefunc);
  6233. if (d.p._inlinenav) try {
  6234. a(d).jqGrid("showAddEditButtons")
  6235. } catch (f) { }
  6236. return !1
  6237. }
  6238. if (13 === b.keyCode) {
  6239. if ("TEXTAREA" === b.target.tagName) return !0;
  6240. if (a(d).jqGrid("saveRow", c, m) && d.p._inlinenav) try {
  6241. a(d).jqGrid("showAddEditButtons")
  6242. } catch (e) { }
  6243. return !1
  6244. }
  6245. }), a(d).triggerHandler("jqGridInlineEditRow", [c, m]), a.isFunction(m.oneditfunc) && m.oneditfunc.call(d, c))))))
  6246. })
  6247. },
  6248. saveRow: function (c, e, b, l, h, n, p) {
  6249. var g = a.makeArray(arguments).slice(1),
  6250. f = {};
  6251. "object" === a.type(g[0]) ? f = g[0] : (a.isFunction(e) && (f.successfunc = e), void 0 !== b && (f.url = b), void 0 !== l && (f.extraparam = l), a.isFunction(h) && (f.aftersavefunc = h), a.isFunction(n) && (f.errorfunc = n), a.isFunction(p) && (f.afterrestorefunc = p));
  6252. var f = a.extend(!0, {
  6253. successfunc: null,
  6254. url: null,
  6255. extraparam: {},
  6256. aftersavefunc: null,
  6257. errorfunc: null,
  6258. afterrestorefunc: null,
  6259. restoreAfterError: !0,
  6260. mtype: "POST"
  6261. },
  6262. a.jgrid.inlineEdit, f),
  6263. m = !1,
  6264. d = this[0],
  6265. r,
  6266. k = {},
  6267. y = {},
  6268. v = {},
  6269. w,
  6270. z,
  6271. u;
  6272. if (!d.grid) return m;
  6273. u = a(d).jqGrid("getInd", c, !0);
  6274. if (!1 === u) return m;
  6275. g = a.isFunction(f.beforeSaveRow) ? f.beforeSaveRow.call(d, f, c) : void 0;
  6276. void 0 === g && (g = !0);
  6277. if (g) {
  6278. g = a(u).attr("editable");
  6279. f.url = f.url || d.p.editurl;
  6280. if ("1" === g) {
  6281. var t;
  6282. a('td[role="gridcell"]', u).each(function (c) {
  6283. t = d.p.colModel[c];
  6284. r = t.name;
  6285. if ("cb" !== r && "subgrid" !== r && !0 === t.editable && "rn" !== r && !a(this).hasClass("not-editable-cell")) {
  6286. switch (t.edittype) {
  6287. case "checkbox":
  6288. var b = ["Yes", "No"];
  6289. t.editoptions && (b = t.editoptions.value.split(":"));
  6290. k[r] = a("input", this).is(":checked") ? b[0] : b[1];
  6291. break;
  6292. case "text":
  6293. case "password":
  6294. case "textarea":
  6295. case "button":
  6296. k[r] = a("input, textarea", this).val();
  6297. break;
  6298. case "select":
  6299. if (t.editoptions.multiple) {
  6300. var b = a("select", this),
  6301. e = [];
  6302. k[r] = a(b).val();
  6303. k[r] = k[r] ? k[r].join(",") : "";
  6304. a("select option:selected", this).each(function (d, b) {
  6305. e[d] = a(b).text()
  6306. });
  6307. y[r] = e.join(",")
  6308. } else k[r] = a("select option:selected", this).val(),
  6309. y[r] = a("select option:selected", this).text();
  6310. t.formatter && "select" === t.formatter && (y = {});
  6311. break;
  6312. case "custom":
  6313. try {
  6314. if (t.editoptions && a.isFunction(t.editoptions.custom_value)) {
  6315. if (k[r] = t.editoptions.custom_value.call(d, a(".customelement", this), "get"), void 0 === k[r]) throw "e2";
  6316. } else throw "e1";
  6317. } catch (g) {
  6318. "e1" === g && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  6319. "e2" === g ? a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.novalue, a.jgrid.edit.bClose) : a.jgrid.info_dialog(a.jgrid.errors.errcap, g.message, a.jgrid.edit.bClose)
  6320. }
  6321. }
  6322. z = a.jgrid.checkValues.call(d, k[r], c);
  6323. if (!1 === z[0]) return !1;
  6324. d.p.autoencode && (k[r] = a.jgrid.htmlEncode(k[r]));
  6325. "clientArray" !== f.url && t.editoptions && !0 === t.editoptions.NullIfEmpty && "" === k[r] && (v[r] = "null")
  6326. }
  6327. });
  6328. if (!1 === z[0]) {
  6329. try {
  6330. var q = a(d).jqGrid("getGridRowById", c),
  6331. s = a.jgrid.findPos(q);
  6332. a.jgrid.info_dialog(a.jgrid.errors.errcap, z[1], a.jgrid.edit.bClose, {
  6333. left: s[0],
  6334. top: s[1] + a(q).outerHeight()
  6335. })
  6336. } catch (A) {
  6337. alert(z[1])
  6338. }
  6339. return m
  6340. }
  6341. g = d.p.prmNames;
  6342. q = c;
  6343. s = !1 === d.p.keyIndex ? g.id : d.p.colModel[d.p.keyIndex + (!0 === d.p.rownumbers ? 1 : 0) + (!0 === d.p.multiselect ? 1 : 0) + (!0 === d.p.subGrid ? 1 : 0)].name;
  6344. k && (k[g.oper] = g.editoper, void 0 === k[s] || "" === k[s] ? k[s] = c : u.id !== d.p.idPrefix + k[s] && (g = a.jgrid.stripPref(d.p.idPrefix, c), void 0 !== d.p._index[g] && (d.p._index[k[s]] = d.p._index[g], delete d.p._index[g]), c = d.p.idPrefix + k[s], a(u).attr("id", c), d.p.selrow === q && (d.p.selrow = c), a.isArray(d.p.selarrrow) && (g = a.inArray(q, d.p.selarrrow), 0 <= g && (d.p.selarrrow[g] = c)), d.p.multiselect && (g = "jqg_" + d.p.id + "_" + c, a("input.cbox", u).attr("id", g).attr("name", g))), void 0 === d.p.inlineData && (d.p.inlineData = {}), k = a.extend({},
  6345. k, d.p.inlineData, f.extraparam));
  6346. if ("clientArray" === f.url) {
  6347. k = a.extend({},
  6348. k, y);
  6349. d.p.autoencode && a.each(k,
  6350. function (d, b) {
  6351. k[d] = a.jgrid.htmlDecode(b)
  6352. });
  6353. g = a(d).jqGrid("setRowData", c, k);
  6354. a(u).attr("editable", "0");
  6355. for (s = 0; s < d.p.savedRow.length; s++) if (String(d.p.savedRow[s].id) === String(q)) {
  6356. w = s;
  6357. break
  6358. }
  6359. 0 <= w && d.p.savedRow.splice(w, 1);
  6360. a(d).triggerHandler("jqGridInlineAfterSaveRow", [c, g, k, f]);
  6361. a.isFunction(f.aftersavefunc) && f.aftersavefunc.call(d, c, g, f);
  6362. m = !0;
  6363. a(u).removeClass("jqgrid-new-row").unbind("keydown")
  6364. } else a("#lui_" + a.jgrid.jqID(d.p.id)).show(),
  6365. v = a.extend({},
  6366. k, v),
  6367. v[s] = a.jgrid.stripPref(d.p.idPrefix, v[s]),
  6368. a.ajax(a.extend({
  6369. url: f.url,
  6370. data: a.isFunction(d.p.serializeRowData) ? d.p.serializeRowData.call(d, v) : v,
  6371. type: f.mtype,
  6372. async: !1,
  6373. complete: function (b, e) {
  6374. a("#lui_" + a.jgrid.jqID(d.p.id)).hide();
  6375. if ("success" === e) {
  6376. var g = !0,
  6377. h;
  6378. h = a(d).triggerHandler("jqGridInlineSuccessSaveRow", [b, c, f]);
  6379. a.isArray(h) || (h = [!0, k]);
  6380. h[0] && a.isFunction(f.successfunc) && (h = f.successfunc.call(d, b));
  6381. a.isArray(h) ? (g = h[0], k = h[1] || k) : g = h;
  6382. if (!0 === g) {
  6383. d.p.autoencode && a.each(k,
  6384. function (b, d) {
  6385. k[b] = a.jgrid.htmlDecode(d)
  6386. });
  6387. k = a.extend({},
  6388. k, y);
  6389. a(d).jqGrid("setRowData", c, k);
  6390. a(u).attr("editable", "0");
  6391. for (g = 0; g < d.p.savedRow.length; g++) if (String(d.p.savedRow[g].id) === String(c)) {
  6392. w = g;
  6393. break
  6394. }
  6395. 0 <= w && d.p.savedRow.splice(w, 1);
  6396. a(d).triggerHandler("jqGridInlineAfterSaveRow", [c, b, k, f]);
  6397. a.isFunction(f.aftersavefunc) && f.aftersavefunc.call(d, c, b);
  6398. m = !0;
  6399. a(u).removeClass("jqgrid-new-row").unbind("keydown")
  6400. } else a(d).triggerHandler("jqGridInlineErrorSaveRow", [c, b, e, null, f]),
  6401. a.isFunction(f.errorfunc) && f.errorfunc.call(d, c, b, e, null),
  6402. !0 === f.restoreAfterError && a(d).jqGrid("restoreRow", c, f.afterrestorefunc)
  6403. }
  6404. },
  6405. error: function (b, e, g) {
  6406. a("#lui_" + a.jgrid.jqID(d.p.id)).hide();
  6407. a(d).triggerHandler("jqGridInlineErrorSaveRow", [c, b, e, g, f]);
  6408. if (a.isFunction(f.errorfunc)) f.errorfunc.call(d, c, b, e, g);
  6409. else {
  6410. b = b.responseText || b.statusText;
  6411. try {
  6412. a.jgrid.info_dialog(a.jgrid.errors.errcap, '<div class="ui-state-error">' + b + "</div>", a.jgrid.edit.bClose, {
  6413. buttonalign: "right"
  6414. })
  6415. } catch (h) {
  6416. alert(b)
  6417. }
  6418. } !0 === f.restoreAfterError && a(d).jqGrid("restoreRow", c, f.afterrestorefunc)
  6419. }
  6420. },
  6421. a.jgrid.ajaxOptions, d.p.ajaxRowOptions || {}))
  6422. }
  6423. return m
  6424. }
  6425. },
  6426. restoreRow: function (c, e) {
  6427. var b = a.makeArray(arguments).slice(1),
  6428. l = {};
  6429. "object" === a.type(b[0]) ? l = b[0] : a.isFunction(e) && (l.afterrestorefunc = e);
  6430. l = a.extend(!0, {},
  6431. a.jgrid.inlineEdit, l);
  6432. return this.each(function () {
  6433. var b = this,
  6434. e = -1,
  6435. p, g = {},
  6436. f;
  6437. if (b.grid && (p = a(b).jqGrid("getInd", c, !0), !1 !== p && (f = a.isFunction(l.beforeCancelRow) ? l.beforeCancelRow.call(b, l, sr) : void 0, void 0 === f && (f = !0), f))) {
  6438. for (f = 0; f < b.p.savedRow.length; f++) if (String(b.p.savedRow[f].id) === String(c)) {
  6439. e = f;
  6440. break
  6441. }
  6442. if (0 <= e) {
  6443. if (a.isFunction(a.fn.datepicker)) try {
  6444. a("input.hasDatepicker", "#" + a.jgrid.jqID(p.id)).datepicker("hide")
  6445. } catch (m) { }
  6446. a.each(b.p.colModel,
  6447. function () {
  6448. !0 === this.editable && b.p.savedRow[e].hasOwnProperty(this.name) && (g[this.name] = b.p.savedRow[e][this.name])
  6449. });
  6450. a(b).jqGrid("setRowData", c, g);
  6451. a(p).attr("editable", "0").unbind("keydown");
  6452. b.p.savedRow.splice(e, 1);
  6453. a("#" + a.jgrid.jqID(c), "#" + a.jgrid.jqID(b.p.id)).hasClass("jqgrid-new-row") && setTimeout(function () {
  6454. a(b).jqGrid("delRowData", c);
  6455. a(b).jqGrid("showAddEditButtons")
  6456. },
  6457. 0)
  6458. }
  6459. a(b).triggerHandler("jqGridInlineAfterRestoreRow", [c]);
  6460. a.isFunction(l.afterrestorefunc) && l.afterrestorefunc.call(b, c)
  6461. }
  6462. })
  6463. },
  6464. addRow: function (c) {
  6465. c = a.extend(!0, {
  6466. rowID: null,
  6467. initdata: {},
  6468. position: "first",
  6469. useDefValues: !0,
  6470. useFormatter: !1,
  6471. addRowParams: {
  6472. extraparam: {}
  6473. }
  6474. },
  6475. c || {});
  6476. return this.each(function () {
  6477. if (this.grid) {
  6478. var e = this,
  6479. b = a.isFunction(c.beforeAddRow) ? c.beforeAddRow.call(e, c.addRowParams) : void 0;
  6480. void 0 === b && (b = !0);
  6481. b && (c.rowID = a.isFunction(c.rowID) ? c.rowID.call(e, c) : null != c.rowID ? c.rowID : a.jgrid.randId(), !0 === c.useDefValues && a(e.p.colModel).each(function () {
  6482. if (this.editoptions && this.editoptions.defaultValue) {
  6483. var b = this.editoptions.defaultValue,
  6484. b = a.isFunction(b) ? b.call(e) : b;
  6485. c.initdata[this.name] = b
  6486. }
  6487. }), a(e).jqGrid("addRowData", c.rowID, c.initdata, c.position), c.rowID = e.p.idPrefix + c.rowID, a("#" + a.jgrid.jqID(c.rowID), "#" + a.jgrid.jqID(e.p.id)).addClass("jqgrid-new-row"), c.useFormatter ? a("#" + a.jgrid.jqID(c.rowID) + " .ui-inline-edit", "#" + a.jgrid.jqID(e.p.id)).click() : (b = e.p.prmNames, c.addRowParams.extraparam[b.oper] = b.addoper, a(e).jqGrid("editRow", c.rowID, c.addRowParams), a(e).jqGrid("setSelection", c.rowID)))
  6488. }
  6489. })
  6490. },
  6491. inlineNav: function (c, e) {
  6492. e = a.extend(!0, {
  6493. edit: !0,
  6494. editicon: "ui-icon-pencil",
  6495. add: !0,
  6496. addicon: "ui-icon-plus",
  6497. save: !0,
  6498. saveicon: "ui-icon-disk",
  6499. cancel: !0,
  6500. cancelicon: "ui-icon-cancel",
  6501. addParams: {
  6502. addRowParams: {
  6503. extraparam: {}
  6504. }
  6505. },
  6506. editParams: {},
  6507. restoreAfterSelect: !0
  6508. },
  6509. a.jgrid.nav, e || {});
  6510. return this.each(function () {
  6511. if (this.grid) {
  6512. var b = this,
  6513. l, h = a.jgrid.jqID(b.p.id);
  6514. b.p._inlinenav = !0;
  6515. if (!0 === e.addParams.useFormatter) {
  6516. var n = b.p.colModel,
  6517. p;
  6518. for (p = 0; p < n.length; p++) if (n[p].formatter && "actions" === n[p].formatter) {
  6519. n[p].formatoptions && (n = a.extend({
  6520. keys: !1,
  6521. onEdit: null,
  6522. onSuccess: null,
  6523. afterSave: null,
  6524. onError: null,
  6525. afterRestore: null,
  6526. extraparam: {},
  6527. url: null
  6528. },
  6529. n[p].formatoptions), e.addParams.addRowParams = {
  6530. keys: n.keys,
  6531. oneditfunc: n.onEdit,
  6532. successfunc: n.onSuccess,
  6533. url: n.url,
  6534. extraparam: n.extraparam,
  6535. aftersavefunc: n.afterSave,
  6536. errorfunc: n.onError,
  6537. afterrestorefunc: n.afterRestore
  6538. });
  6539. break
  6540. }
  6541. }
  6542. e.add && a(b).jqGrid("navButtonAdd", c, {
  6543. caption: e.addtext,
  6544. title: e.addtitle,
  6545. buttonicon: e.addicon,
  6546. id: b.p.id + "_iladd",
  6547. onClickButton: function () {
  6548. a(b).jqGrid("addRow", e.addParams);
  6549. e.addParams.useFormatter || (a("#" + h + "_ilsave").removeClass("ui-state-disabled"), a("#" + h + "_ilcancel").removeClass("ui-state-disabled"), a("#" + h + "_iladd").addClass("ui-state-disabled"), a("#" + h + "_iledit").addClass("ui-state-disabled"))
  6550. }
  6551. });
  6552. e.edit && a(b).jqGrid("navButtonAdd", c, {
  6553. caption: e.edittext,
  6554. title: e.edittitle,
  6555. buttonicon: e.editicon,
  6556. id: b.p.id + "_iledit",
  6557. onClickButton: function () {
  6558. var c = a(b).jqGrid("getGridParam", "selrow");
  6559. c ? (a(b).jqGrid("editRow", c, e.editParams), a("#" + h + "_ilsave").removeClass("ui-state-disabled"), a("#" + h + "_ilcancel").removeClass("ui-state-disabled"), a("#" + h + "_iladd").addClass("ui-state-disabled"), a("#" + h + "_iledit").addClass("ui-state-disabled")) : (a.jgrid.viewModal("#alertmod", {
  6560. gbox: "#gbox_" + h,
  6561. jqm: !0
  6562. }), a("#jqg_alrt").focus())
  6563. }
  6564. });
  6565. e.save && (a(b).jqGrid("navButtonAdd", c, {
  6566. caption: e.savetext || "",
  6567. title: e.savetitle || "Save row",
  6568. buttonicon: e.saveicon,
  6569. id: b.p.id + "_ilsave",
  6570. onClickButton: function () {
  6571. var c = b.p.savedRow[0].id;
  6572. if (c) {
  6573. var f = b.p.prmNames,
  6574. m = f.oper,
  6575. d = e.editParams;
  6576. a("#" + a.jgrid.jqID(c), "#" + h).hasClass("jqgrid-new-row") ? (e.addParams.addRowParams.extraparam[m] = f.addoper, d = e.addParams.addRowParams) : (e.editParams.extraparam || (e.editParams.extraparam = {}), e.editParams.extraparam[m] = f.editoper);
  6577. a(b).jqGrid("saveRow", c, d) && a(b).jqGrid("showAddEditButtons")
  6578. } else a.jgrid.viewModal("#alertmod", {
  6579. gbox: "#gbox_" + h,
  6580. jqm: !0
  6581. }),
  6582. a("#jqg_alrt").focus()
  6583. }
  6584. }), a("#" + h + "_ilsave").addClass("ui-state-disabled"));
  6585. e.cancel && (a(b).jqGrid("navButtonAdd", c, {
  6586. caption: e.canceltext || "",
  6587. title: e.canceltitle || "Cancel row editing",
  6588. buttonicon: e.cancelicon,
  6589. id: b.p.id + "_ilcancel",
  6590. onClickButton: function () {
  6591. var c = b.p.savedRow[0].id,
  6592. f = e.editParams;
  6593. c ? (a("#" + a.jgrid.jqID(c), "#" + h).hasClass("jqgrid-new-row") && (f = e.addParams.addRowParams), a(b).jqGrid("restoreRow", c, f), a(b).jqGrid("showAddEditButtons")) : (a.jgrid.viewModal("#alertmod", {
  6594. gbox: "#gbox_" + h,
  6595. jqm: !0
  6596. }), a("#jqg_alrt").focus())
  6597. }
  6598. }), a("#" + h + "_ilcancel").addClass("ui-state-disabled")); !0 === e.restoreAfterSelect && (l = a.isFunction(b.p.beforeSelectRow) ? b.p.beforeSelectRow : !1, b.p.beforeSelectRow = function (c, f) {
  6599. var h = !0;
  6600. 0 < b.p.savedRow.length && !0 === b.p._inlinenav && c !== b.p.selrow && null !== b.p.selrow && (b.p.selrow === e.addParams.rowID ? a(b).jqGrid("delRowData", b.p.selrow) : a(b).jqGrid("restoreRow", b.p.selrow, e.editParams), a(b).jqGrid("showAddEditButtons"));
  6601. l && (h = l.call(b, c, f));
  6602. return h
  6603. })
  6604. }
  6605. })
  6606. },
  6607. showAddEditButtons: function () {
  6608. return this.each(function () {
  6609. if (this.grid) {
  6610. var c = a.jgrid.jqID(this.p.id);
  6611. a("#" + c + "_ilsave").addClass("ui-state-disabled");
  6612. a("#" + c + "_ilcancel").addClass("ui-state-disabled");
  6613. a("#" + c + "_iladd").removeClass("ui-state-disabled");
  6614. a("#" + c + "_iledit").removeClass("ui-state-disabled")
  6615. }
  6616. })
  6617. }
  6618. })
  6619. })(jQuery); (function (b) {
  6620. b.jgrid.extend({
  6621. editCell: function (d, f, a) {
  6622. return this.each(function () {
  6623. var c = this,
  6624. g, e, h, k;
  6625. if (c.grid && !0 === c.p.cellEdit) {
  6626. f = parseInt(f, 10);
  6627. c.p.selrow = c.rows[d].id;
  6628. c.p.knv || b(c).jqGrid("GridNav");
  6629. if (0 < c.p.savedRow.length) {
  6630. if (!0 === a && d == c.p.iRow && f == c.p.iCol) return;
  6631. b(c).jqGrid("saveCell", c.p.savedRow[0].id, c.p.savedRow[0].ic)
  6632. } else window.setTimeout(function () {
  6633. b("#" + b.jgrid.jqID(c.p.knv)).attr("tabindex", "-1").focus()
  6634. },
  6635. 0);
  6636. k = c.p.colModel[f];
  6637. g = k.name;
  6638. if ("subgrid" !== g && "cb" !== g && "rn" !== g) {
  6639. h = b("td:eq(" + f + ")", c.rows[d]);
  6640. if (!0 !== k.editable || !0 !== a || h.hasClass("not-editable-cell")) 0 <= parseInt(c.p.iCol, 10) && 0 <= parseInt(c.p.iRow, 10) && (b("td:eq(" + c.p.iCol + ")", c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"), b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover")),
  6641. h.addClass("edit-cell ui-state-highlight"),
  6642. b(c.rows[d]).addClass("selected-row ui-state-hover"),
  6643. e = h.html().replace(/\&#160\;/ig, ""),
  6644. b(c).triggerHandler("jqGridSelectCell", [c.rows[d].id, g, e, d, f]),
  6645. b.isFunction(c.p.onSelectCell) && c.p.onSelectCell.call(c, c.rows[d].id, g, e, d, f);
  6646. else {
  6647. 0 <= parseInt(c.p.iCol, 10) && 0 <= parseInt(c.p.iRow, 10) && (b("td:eq(" + c.p.iCol + ")", c.rows[c.p.iRow]).removeClass("edit-cell ui-state-highlight"), b(c.rows[c.p.iRow]).removeClass("selected-row ui-state-hover"));
  6648. b(h).addClass("edit-cell ui-state-highlight");
  6649. b(c.rows[d]).addClass("selected-row ui-state-hover");
  6650. try {
  6651. e = b.unformat.call(c, h, {
  6652. rowId: c.rows[d].id,
  6653. colModel: k
  6654. },
  6655. f)
  6656. } catch (m) {
  6657. e = k.edittype && "textarea" === k.edittype ? b(h).text() : b(h).html()
  6658. }
  6659. c.p.autoencode && (e = b.jgrid.htmlDecode(e));
  6660. k.edittype || (k.edittype = "text");
  6661. c.p.savedRow.push({
  6662. id: d,
  6663. ic: f,
  6664. name: g,
  6665. v: e
  6666. });
  6667. if ("&nbsp;" === e || "&#160;" === e || 1 === e.length && 160 === e.charCodeAt(0)) e = "";
  6668. if (b.isFunction(c.p.formatCell)) {
  6669. var l = c.p.formatCell.call(c, c.rows[d].id, g, e, d, f);
  6670. void 0 !== l && (e = l)
  6671. }
  6672. b(c).triggerHandler("jqGridBeforeEditCell", [c.rows[d].id, g, e, d, f]);
  6673. b.isFunction(c.p.beforeEditCell) && c.p.beforeEditCell.call(c, c.rows[d].id, g, e, d, f);
  6674. var l = b.extend({},
  6675. k.editoptions || {},
  6676. {
  6677. id: d + "_" + g,
  6678. name: g
  6679. }),
  6680. q = b.jgrid.createEl.call(c, k.edittype, l, e, !0, b.extend({},
  6681. b.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
  6682. b(h).html("").append(q).attr("tabindex", "0");
  6683. b.jgrid.bindEv.call(c, q, l);
  6684. window.setTimeout(function () {
  6685. b(q).focus()
  6686. },
  6687. 0);
  6688. b("input, select, textarea", h).bind("keydown",
  6689. function (a) {
  6690. 27 === a.keyCode && (0 < b("input.hasDatepicker", h).length ? b(".ui-datepicker").is(":hidden") ? b(c).jqGrid("restoreCell", d, f) : b("input.hasDatepicker", h).datepicker("hide") : b(c).jqGrid("restoreCell", d, f));
  6691. if (13 === a.keyCode) return b(c).jqGrid("saveCell", d, f),
  6692. !1;
  6693. if (9 === a.keyCode) {
  6694. if (c.grid.hDiv.loading) return !1;
  6695. a.shiftKey ? b(c).jqGrid("prevCell", d, f) : b(c).jqGrid("nextCell", d, f)
  6696. }
  6697. a.stopPropagation()
  6698. });
  6699. b(c).triggerHandler("jqGridAfterEditCell", [c.rows[d].id, g, e, d, f]);
  6700. b.isFunction(c.p.afterEditCell) && c.p.afterEditCell.call(c, c.rows[d].id, g, e, d, f)
  6701. }
  6702. c.p.iCol = f;
  6703. c.p.iRow = d
  6704. }
  6705. }
  6706. })
  6707. },
  6708. saveCell: function (d, f) {
  6709. return this.each(function () {
  6710. var a = this,
  6711. c;
  6712. if (a.grid && !0 === a.p.cellEdit) {
  6713. c = 1 <= a.p.savedRow.length ? 0 : null;
  6714. if (null !== c) {
  6715. var g = b("td:eq(" + f + ")", a.rows[d]),
  6716. e,
  6717. h,
  6718. k = a.p.colModel[f],
  6719. m = k.name,
  6720. l = b.jgrid.jqID(m);
  6721. switch (k.edittype) {
  6722. case "select":
  6723. if (k.editoptions.multiple) {
  6724. var l = b("#" + d + "_" + l, a.rows[d]),
  6725. q = []; (e = b(l).val()) ? e.join(",") : e = "";
  6726. b("option:selected", l).each(function (a, c) {
  6727. q[a] = b(c).text()
  6728. });
  6729. h = q.join(",")
  6730. } else e = b("#" + d + "_" + l + " option:selected", a.rows[d]).val(),
  6731. h = b("#" + d + "_" + l + " option:selected", a.rows[d]).text();
  6732. k.formatter && (h = e);
  6733. break;
  6734. case "checkbox":
  6735. var n = ["Yes", "No"];
  6736. k.editoptions && (n = k.editoptions.value.split(":"));
  6737. h = e = b("#" + d + "_" + l, a.rows[d]).is(":checked") ? n[0] : n[1];
  6738. break;
  6739. case "password":
  6740. case "text":
  6741. case "textarea":
  6742. case "button":
  6743. h = e = b("#" + d + "_" + l, a.rows[d]).val();
  6744. break;
  6745. case "custom":
  6746. try {
  6747. if (k.editoptions && b.isFunction(k.editoptions.custom_value)) {
  6748. e = k.editoptions.custom_value.call(a, b(".customelement", g), "get");
  6749. if (void 0 === e) throw "e2";
  6750. h = e
  6751. } else throw "e1";
  6752. } catch (r) {
  6753. "e1" === r && b.jgrid.info_dialog(b.jgrid.errors.errcap, "function 'custom_value' " + b.jgrid.edit.msg.nodefined, b.jgrid.edit.bClose),
  6754. "e2" === r ? b.jgrid.info_dialog(b.jgrid.errors.errcap, "function 'custom_value' " + b.jgrid.edit.msg.novalue, b.jgrid.edit.bClose) : b.jgrid.info_dialog(b.jgrid.errors.errcap, r.message, b.jgrid.edit.bClose)
  6755. }
  6756. }
  6757. if (h !== a.p.savedRow[c].v) {
  6758. if (c = b(a).triggerHandler("jqGridBeforeSaveCell", [a.rows[d].id, m, e, d, f])) h = e = c;
  6759. b.isFunction(a.p.beforeSaveCell) && (c = a.p.beforeSaveCell.call(a, a.rows[d].id, m, e, d, f)) && (h = e = c);
  6760. var s = b.jgrid.checkValues.call(a, e, f);
  6761. if (!0 === s[0]) {
  6762. c = b(a).triggerHandler("jqGridBeforeSubmitCell", [a.rows[d].id, m, e, d, f]) || {};
  6763. b.isFunction(a.p.beforeSubmitCell) && ((c = a.p.beforeSubmitCell.call(a, a.rows[d].id, m, e, d, f)) || (c = {}));
  6764. 0 < b("input.hasDatepicker", g).length && b("input.hasDatepicker", g).datepicker("hide");
  6765. if ("remote" === a.p.cellsubmit) if (a.p.cellurl) {
  6766. var p = {};
  6767. a.p.autoencode && (e = b.jgrid.htmlEncode(e));
  6768. p[m] = e;
  6769. n = a.p.prmNames;
  6770. k = n.id;
  6771. l = n.oper;
  6772. p[k] = b.jgrid.stripPref(a.p.idPrefix, a.rows[d].id);
  6773. p[l] = n.editoper;
  6774. p = b.extend(c, p);
  6775. b("#lui_" + b.jgrid.jqID(a.p.id)).show();
  6776. a.grid.hDiv.loading = !0;
  6777. b.ajax(b.extend({
  6778. url: a.p.cellurl,
  6779. data: b.isFunction(a.p.serializeCellData) ? a.p.serializeCellData.call(a, p) : p,
  6780. type: "POST",
  6781. complete: function (c, k) {
  6782. b("#lui_" + a.p.id).hide();
  6783. a.grid.hDiv.loading = !1;
  6784. if ("success" === k) {
  6785. var l = b(a).triggerHandler("jqGridAfterSubmitCell", [a, c, p.id, m, e, d, f]) || [!0, ""]; !0 === l[0] && b.isFunction(a.p.afterSubmitCell) && (l = a.p.afterSubmitCell.call(a, c, p.id, m, e, d, f)); !0 === l[0] ? (b(g).empty(), b(a).jqGrid("setCell", a.rows[d].id, f, h, !1, !1, !0), b(g).addClass("dirty-cell"), b(a.rows[d]).addClass("edited"), b(a).triggerHandler("jqGridAfterSaveCell", [a.rows[d].id, m, e, d, f]), b.isFunction(a.p.afterSaveCell) && a.p.afterSaveCell.call(a, a.rows[d].id, m, e, d, f), a.p.savedRow.splice(0, 1)) : (b.jgrid.info_dialog(b.jgrid.errors.errcap, l[1], b.jgrid.edit.bClose), b(a).jqGrid("restoreCell", d, f))
  6786. }
  6787. },
  6788. error: function (c, e, h) {
  6789. b("#lui_" + b.jgrid.jqID(a.p.id)).hide();
  6790. a.grid.hDiv.loading = !1;
  6791. b(a).triggerHandler("jqGridErrorCell", [c, e, h]);
  6792. b.isFunction(a.p.errorCell) ? a.p.errorCell.call(a, c, e, h) : b.jgrid.info_dialog(b.jgrid.errors.errcap, c.status + " : " + c.statusText + "<br/>" + e, b.jgrid.edit.bClose);
  6793. b(a).jqGrid("restoreCell", d, f)
  6794. }
  6795. },
  6796. b.jgrid.ajaxOptions, a.p.ajaxCellOptions || {}))
  6797. } else try {
  6798. b.jgrid.info_dialog(b.jgrid.errors.errcap, b.jgrid.errors.nourl, b.jgrid.edit.bClose),
  6799. b(a).jqGrid("restoreCell", d, f)
  6800. } catch (t) { }
  6801. "clientArray" === a.p.cellsubmit && (b(g).empty(), b(a).jqGrid("setCell", a.rows[d].id, f, h, !1, !1, !0), b(g).addClass("dirty-cell"), b(a.rows[d]).addClass("edited"), b(a).triggerHandler("jqGridAfterSaveCell", [a.rows[d].id, m, e, d, f]), b.isFunction(a.p.afterSaveCell) && a.p.afterSaveCell.call(a, a.rows[d].id, m, e, d, f), a.p.savedRow.splice(0, 1))
  6802. } else try {
  6803. window.setTimeout(function () {
  6804. b.jgrid.info_dialog(b.jgrid.errors.errcap, e + " " + s[1], b.jgrid.edit.bClose)
  6805. },
  6806. 100),
  6807. b(a).jqGrid("restoreCell", d, f)
  6808. } catch (u) { }
  6809. } else b(a).jqGrid("restoreCell", d, f)
  6810. }
  6811. window.setTimeout(function () {
  6812. b("#" + b.jgrid.jqID(a.p.knv)).attr("tabindex", "-1").focus()
  6813. },
  6814. 0)
  6815. }
  6816. })
  6817. },
  6818. restoreCell: function (d, f) {
  6819. return this.each(function () {
  6820. var a = this,
  6821. c;
  6822. if (a.grid && !0 === a.p.cellEdit) {
  6823. c = 1 <= a.p.savedRow.length ? 0 : null;
  6824. if (null !== c) {
  6825. var g = b("td:eq(" + f + ")", a.rows[d]);
  6826. if (b.isFunction(b.fn.datepicker)) try {
  6827. b("input.hasDatepicker", g).datepicker("hide")
  6828. } catch (e) { }
  6829. b(g).empty().attr("tabindex", "-1");
  6830. b(a).jqGrid("setCell", a.rows[d].id, f, a.p.savedRow[c].v, !1, !1, !0);
  6831. b(a).triggerHandler("jqGridAfterRestoreCell", [a.rows[d].id, a.p.savedRow[c].v, d, f]);
  6832. b.isFunction(a.p.afterRestoreCell) && a.p.afterRestoreCell.call(a, a.rows[d].id, a.p.savedRow[c].v, d, f);
  6833. a.p.savedRow.splice(0, 1)
  6834. }
  6835. window.setTimeout(function () {
  6836. b("#" + a.p.knv).attr("tabindex", "-1").focus()
  6837. },
  6838. 0)
  6839. }
  6840. })
  6841. },
  6842. nextCell: function (d, f) {
  6843. return this.each(function () {
  6844. var a = !1,
  6845. c;
  6846. if (this.grid && !0 === this.p.cellEdit) {
  6847. for (c = f + 1; c < this.p.colModel.length; c++) if (!0 === this.p.colModel[c].editable) {
  6848. a = c;
  6849. break
  6850. } !1 !== a ? b(this).jqGrid("editCell", d, a, !0) : 0 < this.p.savedRow.length && b(this).jqGrid("saveCell", d, f)
  6851. }
  6852. })
  6853. },
  6854. prevCell: function (d, f) {
  6855. return this.each(function () {
  6856. var a = !1,
  6857. c;
  6858. if (this.grid && !0 === this.p.cellEdit) {
  6859. for (c = f - 1; 0 <= c; c--) if (!0 === this.p.colModel[c].editable) {
  6860. a = c;
  6861. break
  6862. } !1 !== a ? b(this).jqGrid("editCell", d, a, !0) : 0 < this.p.savedRow.length && b(this).jqGrid("saveCell", d, f)
  6863. }
  6864. })
  6865. },
  6866. GridNav: function () {
  6867. return this.each(function () {
  6868. function d(c, d, e) {
  6869. if ("v" === e.substr(0, 1)) {
  6870. var f = b(a.grid.bDiv)[0].clientHeight,
  6871. g = b(a.grid.bDiv)[0].scrollTop,
  6872. n = a.rows[c].offsetTop + a.rows[c].clientHeight,
  6873. r = a.rows[c].offsetTop;
  6874. "vd" === e && n >= f && (b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop + a.rows[c].clientHeight);
  6875. "vu" === e && r < g && (b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop - a.rows[c].clientHeight)
  6876. }
  6877. "h" === e && (e = b(a.grid.bDiv)[0].clientWidth, f = b(a.grid.bDiv)[0].scrollLeft, g = a.rows[c].cells[d].offsetLeft, a.rows[c].cells[d].offsetLeft + a.rows[c].cells[d].clientWidth >= e + parseInt(f, 10) ? b(a.grid.bDiv)[0].scrollLeft = b(a.grid.bDiv)[0].scrollLeft + a.rows[c].cells[d].clientWidth : g < f && (b(a.grid.bDiv)[0].scrollLeft = b(a.grid.bDiv)[0].scrollLeft - a.rows[c].cells[d].clientWidth))
  6878. }
  6879. function f(b, c) {
  6880. var d, e;
  6881. if ("lft" === c) for (d = b + 1, e = b; 0 <= e; e--) if (!0 !== a.p.colModel[e].hidden) {
  6882. d = e;
  6883. break
  6884. }
  6885. if ("rgt" === c) for (d = b - 1, e = b; e < a.p.colModel.length; e++) if (!0 !== a.p.colModel[e].hidden) {
  6886. d = e;
  6887. break
  6888. }
  6889. return d
  6890. }
  6891. var a = this;
  6892. if (a.grid && !0 === a.p.cellEdit) {
  6893. a.p.knv = a.p.id + "_kn";
  6894. var c = b("<div style='position:fixed;top:0px;width:1px;height:1px;' tabindex='0'><div tabindex='-1' style='width:1px;height:1px;' id='" + a.p.knv + "'></div></div>"),
  6895. g,
  6896. e;
  6897. b(c).insertBefore(a.grid.cDiv);
  6898. b("#" + a.p.knv).focus().keydown(function (c) {
  6899. e = c.keyCode;
  6900. "rtl" === a.p.direction && (37 === e ? e = 39 : 39 === e && (e = 37));
  6901. switch (e) {
  6902. case 38:
  6903. 0 < a.p.iRow - 1 && (d(a.p.iRow - 1, a.p.iCol, "vu"), b(a).jqGrid("editCell", a.p.iRow - 1, a.p.iCol, !1));
  6904. break;
  6905. case 40:
  6906. a.p.iRow + 1 <= a.rows.length - 1 && (d(a.p.iRow + 1, a.p.iCol, "vd"), b(a).jqGrid("editCell", a.p.iRow + 1, a.p.iCol, !1));
  6907. break;
  6908. case 37:
  6909. 0 <= a.p.iCol - 1 && (g = f(a.p.iCol - 1, "lft"), d(a.p.iRow, g, "h"), b(a).jqGrid("editCell", a.p.iRow, g, !1));
  6910. break;
  6911. case 39:
  6912. a.p.iCol + 1 <= a.p.colModel.length - 1 && (g = f(a.p.iCol + 1, "rgt"), d(a.p.iRow, g, "h"), b(a).jqGrid("editCell", a.p.iRow, g, !1));
  6913. break;
  6914. case 13:
  6915. 0 <= parseInt(a.p.iCol, 10) && 0 <= parseInt(a.p.iRow, 10) && b(a).jqGrid("editCell", a.p.iRow, a.p.iCol, !0);
  6916. break;
  6917. default:
  6918. return !0
  6919. }
  6920. return !1
  6921. })
  6922. }
  6923. })
  6924. },
  6925. getChangedCells: function (d) {
  6926. var f = [];
  6927. d || (d = "all");
  6928. this.each(function () {
  6929. var a = this,
  6930. c;
  6931. a.grid && !0 === a.p.cellEdit && b(a.rows).each(function (g) {
  6932. var e = {};
  6933. b(this).hasClass("edited") && (b("td", this).each(function (f) {
  6934. c = a.p.colModel[f].name;
  6935. if ("cb" !== c && "subgrid" !== c) if ("dirty" === d) {
  6936. if (b(this).hasClass("dirty-cell")) try {
  6937. e[c] = b.unformat.call(a, this, {
  6938. rowId: a.rows[g].id,
  6939. colModel: a.p.colModel[f]
  6940. },
  6941. f)
  6942. } catch (k) {
  6943. e[c] = b.jgrid.htmlDecode(b(this).html())
  6944. }
  6945. } else try {
  6946. e[c] = b.unformat.call(a, this, {
  6947. rowId: a.rows[g].id,
  6948. colModel: a.p.colModel[f]
  6949. },
  6950. f)
  6951. } catch (m) {
  6952. e[c] = b.jgrid.htmlDecode(b(this).html())
  6953. }
  6954. }), e.id = this.id, f.push(e))
  6955. })
  6956. });
  6957. return f
  6958. }
  6959. })
  6960. })(jQuery); (function (c) {
  6961. c.fn.jqm = function (a) {
  6962. var k = {
  6963. overlay: 50,
  6964. closeoverlay: !0,
  6965. overlayClass: "jqmOverlay",
  6966. closeClass: "jqmClose",
  6967. trigger: ".jqModal",
  6968. ajax: d,
  6969. ajaxText: "",
  6970. target: d,
  6971. modal: d,
  6972. toTop: d,
  6973. onShow: d,
  6974. onHide: d,
  6975. onLoad: d
  6976. };
  6977. return this.each(function () {
  6978. if (this._jqm) return l[this._jqm].c = c.extend({},
  6979. l[this._jqm].c, a);
  6980. n++;
  6981. this._jqm = n;
  6982. l[n] = {
  6983. c: c.extend(k, c.jqm.params, a),
  6984. a: d,
  6985. w: c(this).addClass("jqmID" + n),
  6986. s: n
  6987. };
  6988. k.trigger && c(this).jqmAddTrigger(k.trigger)
  6989. })
  6990. };
  6991. c.fn.jqmAddClose = function (a) {
  6992. return r(this, a, "jqmHide")
  6993. };
  6994. c.fn.jqmAddTrigger = function (a) {
  6995. return r(this, a, "jqmShow")
  6996. };
  6997. c.fn.jqmShow = function (a) {
  6998. return this.each(function () {
  6999. c.jqm.open(this._jqm, a)
  7000. })
  7001. };
  7002. c.fn.jqmHide = function (a) {
  7003. return this.each(function () {
  7004. c.jqm.close(this._jqm, a)
  7005. })
  7006. };
  7007. c.jqm = {
  7008. hash: {},
  7009. open: function (a, k) {
  7010. var b = l[a],
  7011. e = b.c,
  7012. h = "." + e.closeClass,
  7013. f = parseInt(b.w.css("z-index")),
  7014. f = 0 < f ? f : 3E3,
  7015. g = c("<div></div>").css({
  7016. height: "100%",
  7017. width: "100%",
  7018. position: "fixed",
  7019. left: 0,
  7020. top: 0,
  7021. "z-index": f - 1,
  7022. opacity: e.overlay / 100
  7023. });
  7024. if (b.a) return d;
  7025. b.t = k;
  7026. b.a = !0;
  7027. b.w.css("z-index", f);
  7028. e.modal ? (m[0] || setTimeout(function () {
  7029. s("bind")
  7030. },
  7031. 1), m.push(a)) : 0 < e.overlay ? e.closeoverlay && b.w.jqmAddClose(g) : g = d;
  7032. b.o = g ? g.addClass(e.overlayClass).prependTo("body") : d;
  7033. e.ajax ? (f = e.target || b.w, g = e.ajax, f = "string" == typeof f ? c(f, b.w) : c(f), g = "@" == g.substr(0, 1) ? c(k).attr(g.substring(1)) : g, f.html(e.ajaxText).load(g,
  7034. function () {
  7035. e.onLoad && e.onLoad.call(this, b);
  7036. h && b.w.jqmAddClose(c(h, b.w));
  7037. p(b)
  7038. })) : h && b.w.jqmAddClose(c(h, b.w));
  7039. e.toTop && b.o && b.w.before('<span id="jqmP' + b.w[0]._jqm + '"></span>').insertAfter(b.o);
  7040. e.onShow ? e.onShow(b) : b.w.show();
  7041. p(b);
  7042. return d
  7043. },
  7044. close: function (a) {
  7045. a = l[a];
  7046. if (!a.a) return d;
  7047. a.a = d;
  7048. m[0] && (m.pop(), m[0] || s("unbind"));
  7049. a.c.toTop && a.o && c("#jqmP" + a.w[0]._jqm).after(a.w).remove();
  7050. if (a.c.onHide) a.c.onHide(a);
  7051. else a.w.hide(),
  7052. a.o && a.o.remove();
  7053. return d
  7054. },
  7055. params: {}
  7056. };
  7057. var n = 0,
  7058. l = c.jqm.hash,
  7059. m = [],
  7060. d = !1,
  7061. p = function (a) {
  7062. try {
  7063. c(":input:visible", a.w)[0].focus()
  7064. } catch (d) { }
  7065. },
  7066. s = function (a) {
  7067. c(document)[a]("keypress", q)[a]("keydown", q)[a]("mousedown", q)
  7068. },
  7069. q = function (a) {
  7070. var d = l[m[m.length - 1]],
  7071. b = !c(a.target).parents(".jqmID" + d.s)[0];
  7072. b && (c(".jqmID" + d.s).each(function () {
  7073. var d = c(this),
  7074. h = d.offset();
  7075. if (h.top <= a.pageY && a.pageY <= h.top + d.height() && h.left <= a.pageX && a.pageX <= h.left + d.width()) return b = !1
  7076. }), p(d));
  7077. return !b
  7078. },
  7079. r = function (a, k, b) {
  7080. return a.each(function () {
  7081. var a = this._jqm;
  7082. c(k).each(function () {
  7083. this[b] || (this[b] = [], c(this).click(function () {
  7084. for (var a in {
  7085. jqmShow: 1,
  7086. jqmHide: 1
  7087. }) for (var b in this[a]) if (l[this[a][b]]) l[this[a][b]].w[a](this);
  7088. return d
  7089. }));
  7090. this[b].push(a)
  7091. })
  7092. })
  7093. }
  7094. })(jQuery); (function (b) {
  7095. b.fn.jqDrag = function (a) {
  7096. return h(this, a, "d")
  7097. };
  7098. b.fn.jqResize = function (a, b) {
  7099. return h(this, a, "r", b)
  7100. };
  7101. b.jqDnR = {
  7102. dnr: {},
  7103. e: 0,
  7104. drag: function (a) {
  7105. "d" == d.k ? e.css({
  7106. left: d.X + a.pageX - d.pX,
  7107. top: d.Y + a.pageY - d.pY
  7108. }) : (e.css({
  7109. width: Math.max(a.pageX - d.pX + d.W, 0),
  7110. height: Math.max(a.pageY - d.pY + d.H, 0)
  7111. }), f && g.css({
  7112. width: Math.max(a.pageX - f.pX + f.W, 0),
  7113. height: Math.max(a.pageY - f.pY + f.H, 0)
  7114. }));
  7115. return !1
  7116. },
  7117. stop: function () {
  7118. b(document).unbind("mousemove", c.drag).unbind("mouseup", c.stop)
  7119. }
  7120. };
  7121. var c = b.jqDnR,
  7122. d = c.dnr,
  7123. e = c.e,
  7124. g, f, h = function (a, c, h, n) {
  7125. return a.each(function () {
  7126. c = c ? b(c, a) : a;
  7127. c.bind("mousedown", {
  7128. e: a,
  7129. k: h
  7130. },
  7131. function (a) {
  7132. var c = a.data,
  7133. k = {};
  7134. e = c.e;
  7135. g = n ? b(n) : !1;
  7136. if ("relative" != e.css("position")) try {
  7137. e.position(k)
  7138. } catch (h) { }
  7139. d = {
  7140. X: k.left || l("left") || 0,
  7141. Y: k.top || l("top") || 0,
  7142. W: l("width") || e[0].scrollWidth || 0,
  7143. H: l("height") || e[0].scrollHeight || 0,
  7144. pX: a.pageX,
  7145. pY: a.pageY,
  7146. k: c.k
  7147. };
  7148. f = g && "d" != c.k ? {
  7149. X: k.left || m("left") || 0,
  7150. Y: k.top || m("top") || 0,
  7151. W: g[0].offsetWidth || m("width") || 0,
  7152. H: g[0].offsetHeight || m("height") || 0,
  7153. pX: a.pageX,
  7154. pY: a.pageY,
  7155. k: c.k
  7156. } : !1;
  7157. if (b("input.hasDatepicker", e[0])[0]) try {
  7158. b("input.hasDatepicker", e[0]).datepicker("hide")
  7159. } catch (p) { }
  7160. b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);
  7161. return !1
  7162. })
  7163. })
  7164. },
  7165. l = function (a) {
  7166. return parseInt(e.css(a), 10) || !1
  7167. },
  7168. m = function (a) {
  7169. return parseInt(g.css(a), 10) || !1
  7170. }
  7171. })(jQuery); (function (b) {
  7172. b.jgrid.extend({
  7173. setSubGrid: function () {
  7174. return this.each(function () {
  7175. var d, c;
  7176. this.p.subGridOptions = b.extend({
  7177. plusicon: "ui-icon-plus",
  7178. minusicon: "ui-icon-minus",
  7179. openicon: "ui-icon-carat-1-sw",
  7180. expandOnLoad: !1,
  7181. delayOnLoad: 50,
  7182. selectOnExpand: !1,
  7183. selectOnCollapse: !1,
  7184. reloadOnExpand: !0
  7185. },
  7186. this.p.subGridOptions || {});
  7187. this.p.colNames.unshift("");
  7188. this.p.colModel.unshift({
  7189. name: "subgrid",
  7190. width: b.jgrid.cell_width ? this.p.subGridWidth + this.p.cellLayout : this.p.subGridWidth,
  7191. sortable: !1,
  7192. resizable: !1,
  7193. hidedlg: !0,
  7194. search: !1,
  7195. fixed: !0
  7196. });
  7197. d = this.p.subGridModel;
  7198. if (d[0]) for (d[0].align = b.extend([], d[0].align || []), c = 0; c < d[0].name.length; c++) d[0].align[c] = d[0].align[c] || "left"
  7199. })
  7200. },
  7201. addSubGridCell: function (b, c) {
  7202. var a = "",
  7203. p, n;
  7204. this.each(function () {
  7205. a = this.formatCol(b, c);
  7206. n = this.p.id;
  7207. p = this.p.subGridOptions.plusicon
  7208. });
  7209. return '<td role="gridcell" aria-describedby="' + n + '_subgrid" class="ui-sgcollapsed sgcollapsed" ' + a + "><a style='cursor:pointer;'><span class='ui-icon " + p + "'></span></a></td>"
  7210. },
  7211. addSubGrid: function (d, c) {
  7212. return this.each(function () {
  7213. var a = this;
  7214. if (a.grid) {
  7215. var p = function (c, d, h) {
  7216. d = b("<td align='" + a.p.subGridModel[0].align[h] + "'></td>").html(d);
  7217. b(c).append(d)
  7218. },
  7219. n = function (c, d) {
  7220. var h, f, e, g = b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  7221. k = b("<tr></tr>");
  7222. for (f = 0; f < a.p.subGridModel[0].name.length; f++) h = b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-" + a.p.direction + "'></th>"),
  7223. b(h).html(a.p.subGridModel[0].name[f]),
  7224. b(h).width(a.p.subGridModel[0].width[f]),
  7225. b(k).append(h);
  7226. b(g).append(k);
  7227. c && (e = a.p.xmlReader.subgrid, b(e.root + " " + e.row, c).each(function () {
  7228. k = b("<tr class='ui-widget-content ui-subtblcell'></tr>");
  7229. if (!0 === e.repeatitems) b(e.cell, this).each(function (a) {
  7230. p(k, b(this).text() || "&#160;", a)
  7231. });
  7232. else {
  7233. var c = a.p.subGridModel[0].mapping || a.p.subGridModel[0].name;
  7234. if (c) for (f = 0; f < c.length; f++) p(k, b(c[f], this).text() || "&#160;", f)
  7235. }
  7236. b(g).append(k)
  7237. }));
  7238. h = b("table:first", a.grid.bDiv).attr("id") + "_";
  7239. b("#" + b.jgrid.jqID(h + d)).append(g);
  7240. a.grid.hDiv.loading = !1;
  7241. b("#load_" + b.jgrid.jqID(a.p.id)).hide();
  7242. return !1
  7243. },
  7244. r = function (c, d) {
  7245. var h, f, e, g, k, m = b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  7246. l = b("<tr></tr>");
  7247. for (f = 0; f < a.p.subGridModel[0].name.length; f++) h = b("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-" + a.p.direction + "'></th>"),
  7248. b(h).html(a.p.subGridModel[0].name[f]),
  7249. b(h).width(a.p.subGridModel[0].width[f]),
  7250. b(l).append(h);
  7251. b(m).append(l);
  7252. if (c && (g = a.p.jsonReader.subgrid, h = b.jgrid.getAccessor(c, g.root), void 0 !== h)) for (f = 0; f < h.length; f++) {
  7253. e = h[f];
  7254. l = b("<tr class='ui-widget-content ui-subtblcell'></tr>");
  7255. if (!0 === g.repeatitems) for (g.cell && (e = e[g.cell]), k = 0; k < e.length; k++) p(l, e[k] || "&#160;", k);
  7256. else {
  7257. var n = a.p.subGridModel[0].mapping || a.p.subGridModel[0].name;
  7258. if (n.length) for (k = 0; k < n.length; k++) p(l, e[n[k]] || "&#160;", k)
  7259. }
  7260. b(m).append(l)
  7261. }
  7262. f = b("table:first", a.grid.bDiv).attr("id") + "_";
  7263. b("#" + b.jgrid.jqID(f + d)).append(m);
  7264. a.grid.hDiv.loading = !1;
  7265. b("#load_" + b.jgrid.jqID(a.p.id)).hide();
  7266. return !1
  7267. },
  7268. v = function (c) {
  7269. var e, d, f, g;
  7270. e = b(c).attr("id");
  7271. d = {
  7272. nd_: (new Date).getTime()
  7273. };
  7274. d[a.p.prmNames.subgridid] = e;
  7275. if (!a.p.subGridModel[0]) return !1;
  7276. if (a.p.subGridModel[0].params) for (g = 0; g < a.p.subGridModel[0].params.length; g++) for (f = 0; f < a.p.colModel.length; f++) a.p.colModel[f].name === a.p.subGridModel[0].params[g] && (d[a.p.colModel[f].name] = b("td:eq(" + f + ")", c).text().replace(/\&#160\;/ig, ""));
  7277. if (!a.grid.hDiv.loading) switch (a.grid.hDiv.loading = !0, b("#load_" + b.jgrid.jqID(a.p.id)).show(), a.p.subgridtype || (a.p.subgridtype = a.p.datatype), b.isFunction(a.p.subgridtype) ? a.p.subgridtype.call(a, d) : a.p.subgridtype = a.p.subgridtype.toLowerCase(), a.p.subgridtype) {
  7278. case "xml":
  7279. case "json":
  7280. b.ajax(b.extend({
  7281. type:
  7282. a.p.mtype,
  7283. url: a.p.subGridUrl,
  7284. dataType: a.p.subgridtype,
  7285. data: b.isFunction(a.p.serializeSubGridData) ? a.p.serializeSubGridData.call(a, d) : d,
  7286. complete: function (c) {
  7287. "xml" === a.p.subgridtype ? n(c.responseXML, e) : r(b.jgrid.parse(c.responseText), e)
  7288. }
  7289. },
  7290. b.jgrid.ajaxOptions, a.p.ajaxSubgridOptions || {}))
  7291. }
  7292. return !1
  7293. },
  7294. e,
  7295. m,
  7296. s,
  7297. t = 0,
  7298. g,
  7299. l;
  7300. b.each(a.p.colModel,
  7301. function () {
  7302. !0 !== this.hidden && "rn" !== this.name && "cb" !== this.name || t++
  7303. });
  7304. var u = a.rows.length,
  7305. q = 1;
  7306. void 0 !== c && 0 < c && (q = c, u = c + 1);
  7307. for (; q < u;) b(a.rows[q]).hasClass("jqgrow") && b(a.rows[q].cells[d]).bind("click",
  7308. function () {
  7309. var c = b(this).parent("tr")[0];
  7310. l = c.nextSibling;
  7311. if (b(this).hasClass("sgcollapsed")) {
  7312. m = a.p.id;
  7313. e = c.id;
  7314. if (!0 === a.p.subGridOptions.reloadOnExpand || !1 === a.p.subGridOptions.reloadOnExpand && !b(l).hasClass("ui-subgrid")) {
  7315. s = 1 <= d ? "<td colspan='" + d + "'>&#160;</td>" : "";
  7316. g = b(a).triggerHandler("jqGridSubGridBeforeExpand", [m + "_" + e, e]); (g = !1 === g || "stop" === g ? !1 : !0) && b.isFunction(a.p.subGridBeforeExpand) && (g = a.p.subGridBeforeExpand.call(a, m + "_" + e, e));
  7317. if (!1 === g) return !1;
  7318. b(c).after("<tr role='row' class='ui-subgrid'>" + s + "<td class='ui-widget-content subgrid-cell'><span class='ui-icon " + a.p.subGridOptions.openicon + "'></span></td><td colspan='" + parseInt(a.p.colNames.length - 1 - t, 10) + "' class='ui-widget-content subgrid-data'><div id=" + m + "_" + e + " class='tablediv'></div></td></tr>");
  7319. b(a).triggerHandler("jqGridSubGridRowExpanded", [m + "_" + e, e]);
  7320. b.isFunction(a.p.subGridRowExpanded) ? a.p.subGridRowExpanded.call(a, m + "_" + e, e) : v(c)
  7321. } else b(l).show();
  7322. b(this).html("<a style='cursor:pointer;'><span class='ui-icon " + a.p.subGridOptions.minusicon + "'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
  7323. a.p.subGridOptions.selectOnExpand && b(a).jqGrid("setSelection", e)
  7324. } else if (b(this).hasClass("sgexpanded")) {
  7325. g = b(a).triggerHandler("jqGridSubGridRowColapsed", [m + "_" + e, e]);
  7326. g = !1 === g || "stop" === g ? !1 : !0;
  7327. e = c.id;
  7328. g && b.isFunction(a.p.subGridRowColapsed) && (g = a.p.subGridRowColapsed.call(a, m + "_" + e, e));
  7329. if (!1 === g) return !1; !0 === a.p.subGridOptions.reloadOnExpand ? b(l).remove(".ui-subgrid") : b(l).hasClass("ui-subgrid") && b(l).hide();
  7330. b(this).html("<a style='cursor:pointer;'><span class='ui-icon " + a.p.subGridOptions.plusicon + "'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
  7331. a.p.subGridOptions.selectOnCollapse && b(a).jqGrid("setSelection", e)
  7332. }
  7333. return !1
  7334. }),
  7335. q++; !0 === a.p.subGridOptions.expandOnLoad && b(a.rows).filter(".jqgrow").each(function (a, c) {
  7336. b(c.cells[0]).click()
  7337. });
  7338. a.subGridXml = function (a, b) {
  7339. n(a, b)
  7340. };
  7341. a.subGridJson = function (a, b) {
  7342. r(a, b)
  7343. }
  7344. }
  7345. })
  7346. },
  7347. expandSubGridRow: function (d) {
  7348. return this.each(function () {
  7349. if ((this.grid || d) && !0 === this.p.subGrid) {
  7350. var c = b(this).jqGrid("getInd", d, !0);
  7351. c && (c = b("td.sgcollapsed", c)[0]) && b(c).trigger("click")
  7352. }
  7353. })
  7354. },
  7355. collapseSubGridRow: function (d) {
  7356. return this.each(function () {
  7357. if ((this.grid || d) && !0 === this.p.subGrid) {
  7358. var c = b(this).jqGrid("getInd", d, !0);
  7359. c && (c = b("td.sgexpanded", c)[0]) && b(c).trigger("click")
  7360. }
  7361. })
  7362. },
  7363. toggleSubGridRow: function (d) {
  7364. return this.each(function () {
  7365. if ((this.grid || d) && !0 === this.p.subGrid) {
  7366. var c = b(this).jqGrid("getInd", d, !0);
  7367. if (c) {
  7368. var a = b("td.sgcollapsed", c)[0];
  7369. a ? b(a).trigger("click") : (a = b("td.sgexpanded", c)[0]) && b(a).trigger("click")
  7370. }
  7371. }
  7372. })
  7373. }
  7374. })
  7375. })(jQuery); (function (d) {
  7376. d.extend(d.jgrid, {
  7377. template: function (b) {
  7378. var k = d.makeArray(arguments).slice(1),
  7379. a,
  7380. c = k.length;
  7381. null == b && (b = "");
  7382. return b.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
  7383. function (b, m) {
  7384. if (!isNaN(parseInt(m, 10))) return k[parseInt(m, 10)];
  7385. for (a = 0; a < c; a++) if (d.isArray(k[a])) for (var e = k[a], f = e.length; f--;) if (m === e[f].nm) return e[f].v
  7386. })
  7387. }
  7388. });
  7389. d.jgrid.extend({
  7390. groupingSetup: function () {
  7391. return this.each(function () {
  7392. var b, k, a = this.p.colModel,
  7393. c = this.p.groupingView;
  7394. if (null === c || "object" !== typeof c && !d.isFunction(c)) this.p.grouping = !1;
  7395. else if (c.groupField.length) {
  7396. void 0 === c.visibiltyOnNextGrouping && (c.visibiltyOnNextGrouping = []);
  7397. c.lastvalues = [];
  7398. c._locgr || (c.groups = []);
  7399. c.counters = [];
  7400. for (b = 0; b < c.groupField.length; b++) c.groupOrder[b] || (c.groupOrder[b] = "asc"),
  7401. c.groupText[b] || (c.groupText[b] = "{0}"),
  7402. "boolean" !== typeof c.groupColumnShow[b] && (c.groupColumnShow[b] = !0),
  7403. "boolean" !== typeof c.groupSummary[b] && (c.groupSummary[b] = !1),
  7404. c.groupSummaryPos[b] || (c.groupSummaryPos[b] = "footer"),
  7405. !0 === c.groupColumnShow[b] ? (c.visibiltyOnNextGrouping[b] = !0, d(this).jqGrid("showCol", c.groupField[b])) : (c.visibiltyOnNextGrouping[b] = d("#" + d.jgrid.jqID(this.p.id + "_" + c.groupField[b])).is(":visible"), d(this).jqGrid("hideCol", c.groupField[b]));
  7406. c.summary = [];
  7407. c.hideFirstGroupCol && (c.formatDisplayField[0] = function (a) {
  7408. return a
  7409. });
  7410. b = 0;
  7411. for (k = a.length; b < k; b++) c.hideFirstGroupCol && !a[b].hidden && c.groupField[0] === a[b].name && (a[b].formatter = function () {
  7412. return ""
  7413. }),
  7414. a[b].summaryType && (a[b].summaryDivider ? c.summary.push({
  7415. nm: a[b].name,
  7416. st: a[b].summaryType,
  7417. v: "",
  7418. sd: a[b].summaryDivider,
  7419. vd: "",
  7420. sr: a[b].summaryRound,
  7421. srt: a[b].summaryRoundType || "round"
  7422. }) : c.summary.push({
  7423. nm: a[b].name,
  7424. st: a[b].summaryType,
  7425. v: "",
  7426. sr: a[b].summaryRound,
  7427. srt: a[b].summaryRoundType || "round"
  7428. }))
  7429. } else this.p.grouping = !1
  7430. })
  7431. },
  7432. groupingPrepare: function (b, k) {
  7433. this.each(function () {
  7434. var a = this.p.groupingView,
  7435. c = this,
  7436. g, m = a.groupField.length,
  7437. e, f, h, p = 0;
  7438. for (g = 0; g < m; g++) e = a.groupField[g],
  7439. h = a.displayField[g],
  7440. f = b[e],
  7441. h = null == h ? null : b[h],
  7442. null == h && (h = f),
  7443. void 0 !== f && (0 === k ? (a.groups.push({
  7444. idx: g,
  7445. dataIndex: e,
  7446. value: f,
  7447. displayValue: h,
  7448. startRow: k,
  7449. cnt: 1,
  7450. summary: []
  7451. }), a.lastvalues[g] = f, a.counters[g] = {
  7452. cnt: 1,
  7453. pos: a.groups.length - 1,
  7454. summary: d.extend(!0, [], a.summary)
  7455. }) : "object" === typeof f || (d.isArray(a.isInTheSameGroup) && d.isFunction(a.isInTheSameGroup[g]) ? a.isInTheSameGroup[g].call(c, a.lastvalues[g], f, g, a) : a.lastvalues[g] === f) ? 1 === p ? (a.groups.push({
  7456. idx: g,
  7457. dataIndex: e,
  7458. value: f,
  7459. displayValue: h,
  7460. startRow: k,
  7461. cnt: 1,
  7462. summary: []
  7463. }), a.lastvalues[g] = f, a.counters[g] = {
  7464. cnt: 1,
  7465. pos: a.groups.length - 1,
  7466. summary: d.extend(!0, [], a.summary)
  7467. }) : (a.counters[g].cnt += 1, a.groups[a.counters[g].pos].cnt = a.counters[g].cnt) : (a.groups.push({
  7468. idx: g,
  7469. dataIndex: e,
  7470. value: f,
  7471. displayValue: h,
  7472. startRow: k,
  7473. cnt: 1,
  7474. summary: []
  7475. }), a.lastvalues[g] = f, p = 1, a.counters[g] = {
  7476. cnt: 1,
  7477. pos: a.groups.length - 1,
  7478. summary: d.extend(!0, [], a.summary)
  7479. }), d.each(a.counters[g].summary,
  7480. function () {
  7481. d.isFunction(this.st) ? this.v = this.st.call(c, this.v, this.nm, b) : (this.v = d(c).jqGrid("groupingCalculations.handler", this.st, this.v, this.nm, this.sr, this.srt, b), "avg" === this.st.toLowerCase() && this.sd && (this.vd = d(c).jqGrid("groupingCalculations.handler", this.st, this.vd, this.sd, this.sr, this.srt, b)))
  7482. }), a.groups[a.counters[g].pos].summary = a.counters[g].summary)
  7483. });
  7484. return this
  7485. },
  7486. groupingToggle: function (b) {
  7487. this.each(function () {
  7488. var k = this.p.groupingView,
  7489. a = b.split("_"),
  7490. c = parseInt(a[a.length - 2], 10);
  7491. a.splice(a.length - 2, 2);
  7492. var g = a.join("_"),
  7493. a = k.minusicon,
  7494. m = k.plusicon,
  7495. e = d("#" + d.jgrid.jqID(b)),
  7496. e = e.length ? e[0].nextSibling : null,
  7497. f = d("#" + d.jgrid.jqID(b) + " span.tree-wrap-" + this.p.direction),
  7498. h = function (a) {
  7499. a = d.map(a.split(" "),
  7500. function (a) {
  7501. if (a.substring(0, g.length + 1) === g + "_") return parseInt(a.substring(g.length + 1), 10)
  7502. });
  7503. return 0 < a.length ? a[0] : void 0
  7504. },
  7505. p,
  7506. r = !1,
  7507. q = this.p.frozenColumns ? this.p.id + "_frozen" : !1,
  7508. n = q ? d("#" + d.jgrid.jqID(b), "#" + d.jgrid.jqID(q)) : !1,
  7509. n = n && n.length ? n[0].nextSibling : null;
  7510. if (f.hasClass(a)) {
  7511. if (k.showSummaryOnHide) {
  7512. if (e) for (; e && !(d(e).hasClass("jqfoot") && parseInt(d(e).attr("jqfootlevel"), 10) <= c) ;) d(e).hide(),
  7513. e = e.nextSibling,
  7514. q && (d(n).hide(), n = n.nextSibling)
  7515. } else if (e) for (; e;) {
  7516. k = h(e.className);
  7517. if (void 0 !== k && k <= c) break;
  7518. d(e).hide();
  7519. e = e.nextSibling;
  7520. q && (d(n).hide(), n = n.nextSibling)
  7521. }
  7522. f.removeClass(a).addClass(m);
  7523. r = !0
  7524. } else {
  7525. if (e) for (p = void 0; e;) {
  7526. k = h(e.className);
  7527. void 0 === p && (p = void 0 === k);
  7528. if (void 0 !== k) {
  7529. if (k <= c) break;
  7530. k === c + 1 && (d(e).show().find(">td>span.tree-wrap-" + this.p.direction).removeClass(a).addClass(m), q && d(n).show().find(">td>span.tree-wrap-" + this.p.direction).removeClass(a).addClass(m))
  7531. } else p && (d(e).show(), q && d(n).show());
  7532. e = e.nextSibling;
  7533. q && (n = n.nextSibling)
  7534. }
  7535. f.removeClass(m).addClass(a)
  7536. }
  7537. d(this).triggerHandler("jqGridGroupingClickGroup", [b, r]);
  7538. d.isFunction(this.p.onClickGroup) && this.p.onClickGroup.call(this, b, r)
  7539. });
  7540. return !1
  7541. },
  7542. groupingRender: function (b, k, a, c) {
  7543. return this.each(function () {
  7544. function g(a, b, c) {
  7545. var d = !1;
  7546. if (0 === b) d = c[a];
  7547. else {
  7548. var e = c[a].idx;
  7549. if (0 === e) d = c[a];
  7550. else for (; 0 <= a; a--) if (c[a].idx === e - b) {
  7551. d = c[a];
  7552. break
  7553. }
  7554. }
  7555. return d
  7556. }
  7557. function m(a, b, c, f) {
  7558. var h = g(a, b, c),
  7559. m = e.p.colModel,
  7560. n,
  7561. q = h.cnt;
  7562. a = "";
  7563. var p;
  7564. for (p = f; p < k; p++) {
  7565. var r = "<td " + e.formatCol(p, 1, "") + ">&#160;</td>",
  7566. t = "{0}";
  7567. d.each(h.summary,
  7568. function () {
  7569. if (this.nm === m[p].name) {
  7570. m[p].summaryTpl && (t = m[p].summaryTpl);
  7571. "string" === typeof this.st && "avg" === this.st.toLowerCase() && (this.sd && this.vd ? this.v /= this.vd : this.v && 0 < q && (this.v /= q));
  7572. try {
  7573. this.groupCount = h.cnt,
  7574. this.groupIndex = h.dataIndex,
  7575. this.groupValue = h.value,
  7576. n = e.formatter("", this.v, p, this)
  7577. } catch (a) {
  7578. n = this.v
  7579. }
  7580. r = "<td " + e.formatCol(p, 1, "") + ">" + d.jgrid.format(t, n) + "</td>";
  7581. return !1
  7582. }
  7583. });
  7584. a += r
  7585. }
  7586. return a
  7587. }
  7588. var e = this,
  7589. f = e.p.groupingView,
  7590. h = "",
  7591. p = "",
  7592. r, q, n = f.groupCollapse ? f.plusicon : f.minusicon,
  7593. t,
  7594. y = [],
  7595. z = f.groupField.length,
  7596. n = n + (" tree-wrap-" + e.p.direction);
  7597. d.each(e.p.colModel,
  7598. function (a, b) {
  7599. var c;
  7600. for (c = 0; c < z; c++) if (f.groupField[c] === b.name) {
  7601. y[c] = a;
  7602. break
  7603. }
  7604. });
  7605. var x = 0,
  7606. A = d.makeArray(f.groupSummary);
  7607. A.reverse();
  7608. d.each(f.groups,
  7609. function (g, l) {
  7610. if (f._locgr && !(l.startRow + l.cnt > (a - 1) * c && l.startRow < a * c)) return !0;
  7611. x++;
  7612. q = e.p.id + "ghead_" + l.idx;
  7613. r = q + "_" + g;
  7614. p = "<span style='cursor:pointer;' class='ui-icon " + n + "' onclick=\"jQuery('#" + d.jgrid.jqID(e.p.id) + "').jqGrid('groupingToggle','" + r + "');return false;\"></span>";
  7615. try {
  7616. d.isArray(f.formatDisplayField) && d.isFunction(f.formatDisplayField[l.idx]) ? (l.displayValue = f.formatDisplayField[l.idx].call(e, l.displayValue, l.value, e.p.colModel[y[l.idx]], l.idx, f), t = l.displayValue) : t = e.formatter(r, l.displayValue, y[l.idx], l.value)
  7617. } catch (C) {
  7618. t = l.displayValue
  7619. }
  7620. "header" === f.groupSummaryPos[l.idx] ? (h += '<tr id="' + r + '"' + (f.groupCollapse && 0 < l.idx ? ' style="display:none;" ' : " ") + 'role="row" class= "ui-widget-content jqgroup ui-row-' + e.p.direction + " " + q + '"><td style="padding-left:' + 12 * l.idx + 'px;">' + p + d.jgrid.template(f.groupText[l.idx], t, l.cnt, l.summary) + "</td>", h += m(g, l.idx - 1, f.groups, 1), h += "</tr>") : h += '<tr id="' + r + '"' + (f.groupCollapse && 0 < l.idx ? ' style="display:none;" ' : " ") + 'role="row" class= "ui-widget-content jqgroup ui-row-' + e.p.direction + " " + q + '"><td style="padding-left:' + 12 * l.idx + 'px;" colspan="' + k + '">' + p + d.jgrid.template(f.groupText[l.idx], t, l.cnt, l.summary) + "</td></tr>";
  7621. if (z - 1 === l.idx) {
  7622. var s = f.groups[g + 1],
  7623. v,
  7624. u = 0;
  7625. v = l.startRow;
  7626. var B = void 0 !== s ? f.groups[g + 1].startRow : b.length;
  7627. f._locgr && (u = (a - 1) * c, u > l.startRow && (v = u));
  7628. for (; v < B && b[v - u]; v++) h += b[v - u].join("");
  7629. if ("header" !== f.groupSummaryPos[l.idx]) {
  7630. var w;
  7631. if (void 0 !== s) {
  7632. for (w = 0; w < f.groupField.length && s.dataIndex !== f.groupField[w]; w++);
  7633. x = f.groupField.length - w
  7634. }
  7635. for (s = 0; s < x; s++) A[s] && (u = "", f.groupCollapse && !f.showSummaryOnHide && (u = ' style="display:none;"'), h += "<tr" + u + ' jqfootlevel="' + (l.idx - s) + '" role="row" class="ui-widget-content jqfoot ui-row-' + e.p.direction + '">', h += m(g, s, f.groups, 0), h += "</tr>");
  7636. x = w
  7637. }
  7638. }
  7639. });
  7640. d("#" + d.jgrid.jqID(e.p.id) + " tbody:first").append(h);
  7641. h = null
  7642. })
  7643. },
  7644. groupingGroupBy: function (b, k) {
  7645. return this.each(function () {
  7646. "string" === typeof b && (b = [b]);
  7647. var a = this.p.groupingView;
  7648. this.p.grouping = !0;
  7649. void 0 === a.visibiltyOnNextGrouping && (a.visibiltyOnNextGrouping = []);
  7650. var c;
  7651. for (c = 0; c < a.groupField.length; c++) !a.groupColumnShow[c] && a.visibiltyOnNextGrouping[c] && d(this).jqGrid("showCol", a.groupField[c]);
  7652. for (c = 0; c < b.length; c++) a.visibiltyOnNextGrouping[c] = d("#" + d.jgrid.jqID(this.p.id) + "_" + d.jgrid.jqID(b[c])).is(":visible");
  7653. this.p.groupingView = d.extend(this.p.groupingView, k || {});
  7654. a.groupField = b;
  7655. d(this).trigger("reloadGrid")
  7656. })
  7657. },
  7658. groupingRemove: function (b) {
  7659. return this.each(function () {
  7660. void 0 === b && (b = !0);
  7661. this.p.grouping = !1;
  7662. if (!0 === b) {
  7663. var k = this.p.groupingView,
  7664. a;
  7665. for (a = 0; a < k.groupField.length; a++) !k.groupColumnShow[a] && k.visibiltyOnNextGrouping[a] && d(this).jqGrid("showCol", k.groupField);
  7666. d("tr.jqgroup, tr.jqfoot", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").remove();
  7667. d("tr.jqgrow:hidden", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").show()
  7668. } else d(this).trigger("reloadGrid")
  7669. })
  7670. },
  7671. groupingCalculations: {
  7672. handler: function (b, d, a, c, g, m) {
  7673. var e = {
  7674. sum: function () {
  7675. return parseFloat(d || 0) + parseFloat(m[a] || 0)
  7676. },
  7677. min: function () {
  7678. return "" === d ? parseFloat(m[a] || 0) : Math.min(parseFloat(d), parseFloat(m[a] || 0))
  7679. },
  7680. max: function () {
  7681. return "" === d ? parseFloat(m[a] || 0) : Math.max(parseFloat(d), parseFloat(m[a] || 0))
  7682. },
  7683. count: function () {
  7684. "" === d && (d = 0);
  7685. return m.hasOwnProperty(a) ? d + 1 : 0
  7686. },
  7687. avg: function () {
  7688. return e.sum()
  7689. }
  7690. };
  7691. if (!e[b]) throw "jqGrid Grouping No such method: " + b;
  7692. b = e[b]();
  7693. null != c && ("fixed" === g ? b = b.toFixed(c) : (c = Math.pow(10, c), b = Math.round(b * c) / c));
  7694. return b
  7695. }
  7696. }
  7697. })
  7698. })(jQuery); (function (d) {
  7699. d.jgrid.extend({
  7700. setTreeNode: function (b, c) {
  7701. return this.each(function () {
  7702. var a = this;
  7703. if (a.grid && a.p.treeGrid) for (var h = a.p.expColInd,
  7704. e = a.p.treeReader.expanded_field,
  7705. k = a.p.treeReader.leaf_field,
  7706. g = a.p.treeReader.level_field,
  7707. f = a.p.treeReader.icon_field,
  7708. n = a.p.treeReader.loaded,
  7709. m, p, q, l; b < c;) l = d.jgrid.stripPref(a.p.idPrefix, a.rows[b].id),
  7710. l = a.p.data[a.p._index[l]],
  7711. "nested" !== a.p.treeGridModel || l[k] || (m = parseInt(l[a.p.treeReader.left_field], 10), p = parseInt(l[a.p.treeReader.right_field], 10), l[k] = p === m + 1 ? "true" : "false", a.rows[b].cells[a.p._treeleafpos].innerHTML = l[k]),
  7712. m = parseInt(l[g], 10),
  7713. 0 === a.p.tree_root_level ? (q = m + 1, p = m) : (q = m, p = m - 1),
  7714. q = "<div class='tree-wrap tree-wrap-" + a.p.direction + "' style='width:" + 18 * q + "px;'>",
  7715. q += "<div style='" + ("rtl" === a.p.direction ? "right:" : "left:") + 18 * p + "px;' class='ui-icon ",
  7716. void 0 !== l[n] && (l[n] = "true" === l[n] || !0 === l[n] ? !0 : !1),
  7717. "true" === l[k] || !0 === l[k] ? (q += (void 0 !== l[f] && "" !== l[f] ? l[f] : a.p.treeIcons.leaf) + " tree-leaf treeclick", l[k] = !0, p = "leaf") : (l[k] = !1, p = ""),
  7718. l[e] = ("true" === l[e] || !0 === l[e] ? !0 : !1) && (l[n] || void 0 === l[n]),
  7719. q = !1 === l[e] ? q + (!0 === l[k] ? "'" : a.p.treeIcons.plus + " tree-plus treeclick'") : q + (!0 === l[k] ? "'" : a.p.treeIcons.minus + " tree-minus treeclick'"),
  7720. q += "></div></div>",
  7721. d(a.rows[b].cells[h]).wrapInner("<span class='cell-wrapper" + p + "'></span>").prepend(q),
  7722. m !== parseInt(a.p.tree_root_level, 10) && ((l = (l = d(a).jqGrid("getNodeParent", l)) && l.hasOwnProperty(e) ? l[e] : !0) || d(a.rows[b]).css("display", "none")),
  7723. d(a.rows[b].cells[h]).find("div.treeclick").bind("click",
  7724. function (b) {
  7725. b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
  7726. b = a.p._index[b];
  7727. a.p.data[b][k] || (a.p.data[b][e] ? (d(a).jqGrid("collapseRow", a.p.data[b]), d(a).jqGrid("collapseNode", a.p.data[b])) : (d(a).jqGrid("expandRow", a.p.data[b]), d(a).jqGrid("expandNode", a.p.data[b])));
  7728. return !1
  7729. }),
  7730. !0 === a.p.ExpandColClick && d(a.rows[b].cells[h]).find("span.cell-wrapper").css("cursor", "pointer").bind("click",
  7731. function (b) {
  7732. b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
  7733. var c = a.p._index[b];
  7734. a.p.data[c][k] || (a.p.data[c][e] ? (d(a).jqGrid("collapseRow", a.p.data[c]), d(a).jqGrid("collapseNode", a.p.data[c])) : (d(a).jqGrid("expandRow", a.p.data[c]), d(a).jqGrid("expandNode", a.p.data[c])));
  7735. d(a).jqGrid("setSelection", b);
  7736. return !1
  7737. }),
  7738. b++
  7739. })
  7740. },
  7741. setTreeGrid: function () {
  7742. return this.each(function () {
  7743. var b = this,
  7744. c = 0,
  7745. a, h = !1,
  7746. e, k, g = [];
  7747. if (b.p.treeGrid) {
  7748. b.p.treedatatype || d.extend(b.p, {
  7749. treedatatype: b.p.datatype
  7750. });
  7751. b.p.subGrid = !1;
  7752. b.p.altRows = !1;
  7753. b.p.pgbuttons = !1;
  7754. b.p.pginput = !1;
  7755. b.p.gridview = !0;
  7756. null === b.p.rowTotal && (b.p.rowNum = 1E4);
  7757. b.p.multiselect = !1;
  7758. b.p.rowList = [];
  7759. b.p.expColInd = 0;
  7760. a = "ui-icon-triangle-1-" + ("rtl" === b.p.direction ? "w" : "e");
  7761. b.p.treeIcons = d.extend({
  7762. plus: a,
  7763. minus: "ui-icon-triangle-1-s",
  7764. leaf: "ui-icon-radio-off"
  7765. },
  7766. b.p.treeIcons || {});
  7767. "nested" === b.p.treeGridModel ? b.p.treeReader = d.extend({
  7768. level_field: "level",
  7769. left_field: "lft",
  7770. right_field: "rgt",
  7771. leaf_field: "isLeaf",
  7772. expanded_field: "expanded",
  7773. loaded: "loaded",
  7774. icon_field: "icon"
  7775. },
  7776. b.p.treeReader) : "adjacency" === b.p.treeGridModel && (b.p.treeReader = d.extend({
  7777. level_field: "level",
  7778. parent_id_field: "parent",
  7779. leaf_field: "isLeaf",
  7780. expanded_field: "expanded",
  7781. loaded: "loaded",
  7782. icon_field: "icon"
  7783. },
  7784. b.p.treeReader));
  7785. for (e in b.p.colModel) if (b.p.colModel.hasOwnProperty(e)) for (k in a = b.p.colModel[e].name, a !== b.p.ExpandColumn || h || (h = !0, b.p.expColInd = c), c++, b.p.treeReader) b.p.treeReader.hasOwnProperty(k) && b.p.treeReader[k] === a && g.push(a);
  7786. d.each(b.p.treeReader,
  7787. function (a, e) {
  7788. e && -1 === d.inArray(e, g) && ("leaf_field" === a && (b.p._treeleafpos = c), c++, b.p.colNames.push(e), b.p.colModel.push({
  7789. name: e,
  7790. width: 1,
  7791. hidden: !0,
  7792. sortable: !1,
  7793. resizable: !1,
  7794. hidedlg: !0,
  7795. editable: !0,
  7796. search: !1
  7797. }))
  7798. })
  7799. }
  7800. })
  7801. },
  7802. expandRow: function (b) {
  7803. this.each(function () {
  7804. var c = this;
  7805. if (c.grid && c.p.treeGrid) {
  7806. var a = d(c).jqGrid("getNodeChildren", b),
  7807. h = c.p.treeReader.expanded_field;
  7808. d(a).each(function () {
  7809. var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
  7810. d(d(c).jqGrid("getGridRowById", a)).css("display", "");
  7811. this[h] && d(c).jqGrid("expandRow", this)
  7812. })
  7813. }
  7814. })
  7815. },
  7816. collapseRow: function (b) {
  7817. this.each(function () {
  7818. var c = this;
  7819. if (c.grid && c.p.treeGrid) {
  7820. var a = d(c).jqGrid("getNodeChildren", b),
  7821. h = c.p.treeReader.expanded_field;
  7822. d(a).each(function () {
  7823. var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
  7824. d(d(c).jqGrid("getGridRowById", a)).css("display", "none");
  7825. this[h] && d(c).jqGrid("collapseRow", this)
  7826. })
  7827. }
  7828. })
  7829. },
  7830. getRootNodes: function () {
  7831. var b = [];
  7832. this.each(function () {
  7833. var c = this;
  7834. if (c.grid && c.p.treeGrid) switch (c.p.treeGridModel) {
  7835. case "nested":
  7836. var a = c.p.treeReader.level_field;
  7837. d(c.p.data).each(function () {
  7838. parseInt(this[a], 10) === parseInt(c.p.tree_root_level, 10) && b.push(this)
  7839. });
  7840. break;
  7841. case "adjacency":
  7842. var h = c.p.treeReader.parent_id_field;
  7843. d(c.p.data).each(function () {
  7844. null !== this[h] && "null" !== String(this[h]).toLowerCase() || b.push(this)
  7845. })
  7846. }
  7847. });
  7848. return b
  7849. },
  7850. getNodeDepth: function (b) {
  7851. var c = null;
  7852. this.each(function () {
  7853. if (this.grid && this.p.treeGrid) switch (this.p.treeGridModel) {
  7854. case "nested":
  7855. c = parseInt(b[this.p.treeReader.level_field], 10) - parseInt(this.p.tree_root_level, 10);
  7856. break;
  7857. case "adjacency":
  7858. c = d(this).jqGrid("getNodeAncestors", b).length
  7859. }
  7860. });
  7861. return c
  7862. },
  7863. getNodeParent: function (b) {
  7864. var c = null;
  7865. this.each(function () {
  7866. var a = this;
  7867. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7868. case "nested":
  7869. var h = a.p.treeReader.left_field,
  7870. e = a.p.treeReader.right_field,
  7871. k = a.p.treeReader.level_field,
  7872. g = parseInt(b[h], 10),
  7873. f = parseInt(b[e], 10),
  7874. n = parseInt(b[k], 10);
  7875. d(this.p.data).each(function () {
  7876. if (parseInt(this[k], 10) === n - 1 && parseInt(this[h], 10) < g && parseInt(this[e], 10) > f) return c = this,
  7877. !1
  7878. });
  7879. break;
  7880. case "adjacency":
  7881. var m = a.p.treeReader.parent_id_field,
  7882. p = a.p.localReader.id;
  7883. d(this.p.data).each(function () {
  7884. if (this[p] === d.jgrid.stripPref(a.p.idPrefix, b[m])) return c = this,
  7885. !1
  7886. })
  7887. }
  7888. });
  7889. return c
  7890. },
  7891. getNodeChildren: function (b) {
  7892. var c = [];
  7893. this.each(function () {
  7894. var a = this;
  7895. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7896. case "nested":
  7897. var h = a.p.treeReader.left_field,
  7898. e = a.p.treeReader.right_field,
  7899. k = a.p.treeReader.level_field,
  7900. g = parseInt(b[h], 10),
  7901. f = parseInt(b[e], 10),
  7902. n = parseInt(b[k], 10);
  7903. d(this.p.data).each(function () {
  7904. parseInt(this[k], 10) === n + 1 && parseInt(this[h], 10) > g && parseInt(this[e], 10) < f && c.push(this)
  7905. });
  7906. break;
  7907. case "adjacency":
  7908. var m = a.p.treeReader.parent_id_field,
  7909. p = a.p.localReader.id;
  7910. d(this.p.data).each(function () {
  7911. this[m] == d.jgrid.stripPref(a.p.idPrefix, b[p]) && c.push(this)
  7912. })
  7913. }
  7914. });
  7915. return c
  7916. },
  7917. getFullTreeNode: function (b) {
  7918. var c = [];
  7919. this.each(function () {
  7920. var a = this,
  7921. h;
  7922. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7923. case "nested":
  7924. var e = a.p.treeReader.left_field,
  7925. k = a.p.treeReader.right_field,
  7926. g = a.p.treeReader.level_field,
  7927. f = parseInt(b[e], 10),
  7928. n = parseInt(b[k], 10),
  7929. m = parseInt(b[g], 10);
  7930. d(this.p.data).each(function () {
  7931. parseInt(this[g], 10) >= m && parseInt(this[e], 10) >= f && parseInt(this[e], 10) <= n && c.push(this)
  7932. });
  7933. break;
  7934. case "adjacency":
  7935. if (b) {
  7936. c.push(b);
  7937. var p = a.p.treeReader.parent_id_field,
  7938. q = a.p.localReader.id;
  7939. d(this.p.data).each(function (b) {
  7940. h = c.length;
  7941. for (b = 0; b < h; b++) if (d.jgrid.stripPref(a.p.idPrefix, c[b][q]) === this[p]) {
  7942. c.push(this);
  7943. break
  7944. }
  7945. })
  7946. }
  7947. }
  7948. });
  7949. return c
  7950. },
  7951. getNodeAncestors: function (b) {
  7952. var c = [];
  7953. this.each(function () {
  7954. if (this.grid && this.p.treeGrid) for (var a = d(this).jqGrid("getNodeParent", b) ; a;) c.push(a),
  7955. a = d(this).jqGrid("getNodeParent", a)
  7956. });
  7957. return c
  7958. },
  7959. isVisibleNode: function (b) {
  7960. var c = !0;
  7961. this.each(function () {
  7962. if (this.grid && this.p.treeGrid) {
  7963. var a = d(this).jqGrid("getNodeAncestors", b),
  7964. h = this.p.treeReader.expanded_field;
  7965. d(a).each(function () {
  7966. c = c && this[h];
  7967. if (!c) return !1
  7968. })
  7969. }
  7970. });
  7971. return c
  7972. },
  7973. isNodeLoaded: function (b) {
  7974. var c;
  7975. this.each(function () {
  7976. if (this.grid && this.p.treeGrid) {
  7977. var a = this.p.treeReader.leaf_field,
  7978. h = this.p.treeReader.loaded;
  7979. c = void 0 !== b ? void 0 !== b[h] ? b[h] : b[a] || 0 < d(this).jqGrid("getNodeChildren", b).length ? !0 : !1 : !1
  7980. }
  7981. });
  7982. return c
  7983. },
  7984. expandNode: function (b) {
  7985. return this.each(function () {
  7986. if (this.grid && this.p.treeGrid) {
  7987. var c = this.p.treeReader.expanded_field,
  7988. a = this.p.treeReader.parent_id_field,
  7989. h = this.p.treeReader.loaded,
  7990. e = this.p.treeReader.level_field,
  7991. k = this.p.treeReader.left_field,
  7992. g = this.p.treeReader.right_field;
  7993. if (!b[c]) {
  7994. var f = d.jgrid.getAccessor(b, this.p.localReader.id),
  7995. n = d("#" + this.p.idPrefix + d.jgrid.jqID(f), this.grid.bDiv)[0],
  7996. m = this.p._index[f];
  7997. d(this).jqGrid("isNodeLoaded", this.p.data[m]) ? (b[c] = !0, d("div.treeclick", n).removeClass(this.p.treeIcons.plus + " tree-plus").addClass(this.p.treeIcons.minus + " tree-minus")) : this.grid.hDiv.loading || (b[c] = !0, d("div.treeclick", n).removeClass(this.p.treeIcons.plus + " tree-plus").addClass(this.p.treeIcons.minus + " tree-minus"), this.p.treeANode = n.rowIndex, this.p.datatype = this.p.treedatatype, "nested" === this.p.treeGridModel ? d(this).jqGrid("setGridParam", {
  7998. postData: {
  7999. nodeid: f,
  8000. n_left: b[k],
  8001. n_right: b[g],
  8002. n_level: b[e]
  8003. }
  8004. }) : d(this).jqGrid("setGridParam", {
  8005. postData: {
  8006. nodeid: f,
  8007. parentid: b[a],
  8008. n_level: b[e]
  8009. }
  8010. }), d(this).trigger("reloadGrid"), b[h] = !0, "nested" === this.p.treeGridModel ? d(this).jqGrid("setGridParam", {
  8011. postData: {
  8012. nodeid: "",
  8013. n_left: "",
  8014. n_right: "",
  8015. n_level: ""
  8016. }
  8017. }) : d(this).jqGrid("setGridParam", {
  8018. postData: {
  8019. nodeid: "",
  8020. parentid: "",
  8021. n_level: ""
  8022. }
  8023. }))
  8024. }
  8025. }
  8026. })
  8027. },
  8028. collapseNode: function (b) {
  8029. return this.each(function () {
  8030. if (this.grid && this.p.treeGrid) {
  8031. var c = this.p.treeReader.expanded_field;
  8032. b[c] && (b[c] = !1, c = d.jgrid.getAccessor(b, this.p.localReader.id), c = d("#" + this.p.idPrefix + d.jgrid.jqID(c), this.grid.bDiv)[0], d("div.treeclick", c).removeClass(this.p.treeIcons.minus + " tree-minus").addClass(this.p.treeIcons.plus + " tree-plus"))
  8033. }
  8034. })
  8035. },
  8036. SortTree: function (b, c, a, h) {
  8037. return this.each(function () {
  8038. if (this.grid && this.p.treeGrid) {
  8039. var e, k, g, f = [],
  8040. n = this,
  8041. m;
  8042. e = d(this).jqGrid("getRootNodes");
  8043. e = d.jgrid.from(e);
  8044. e.orderBy(b, c, a, h);
  8045. m = e.select();
  8046. e = 0;
  8047. for (k = m.length; e < k; e++) g = m[e],
  8048. f.push(g),
  8049. d(this).jqGrid("collectChildrenSortTree", f, g, b, c, a, h);
  8050. d.each(f,
  8051. function (a) {
  8052. var b = d.jgrid.getAccessor(this, n.p.localReader.id);
  8053. d("#" + d.jgrid.jqID(n.p.id) + " tbody tr:eq(" + a + ")").after(d("tr#" + d.jgrid.jqID(b), n.grid.bDiv))
  8054. });
  8055. f = m = e = null
  8056. }
  8057. })
  8058. },
  8059. collectChildrenSortTree: function (b, c, a, h, e, k) {
  8060. return this.each(function () {
  8061. if (this.grid && this.p.treeGrid) {
  8062. var g, f, n, m;
  8063. g = d(this).jqGrid("getNodeChildren", c);
  8064. g = d.jgrid.from(g);
  8065. g.orderBy(a, h, e, k);
  8066. m = g.select();
  8067. g = 0;
  8068. for (f = m.length; g < f; g++) n = m[g],
  8069. b.push(n),
  8070. d(this).jqGrid("collectChildrenSortTree", b, n, a, h, e, k)
  8071. }
  8072. })
  8073. },
  8074. setTreeRow: function (b, c) {
  8075. var a = !1;
  8076. this.each(function () {
  8077. this.grid && this.p.treeGrid && (a = d(this).jqGrid("setRowData", b, c))
  8078. });
  8079. return a
  8080. },
  8081. delTreeNode: function (b) {
  8082. return this.each(function () {
  8083. var c = this.p.localReader.id,
  8084. a, h = this.p.treeReader.left_field,
  8085. e = this.p.treeReader.right_field,
  8086. k, g, f;
  8087. if (this.grid && this.p.treeGrid && (a = this.p._index[b], void 0 !== a)) {
  8088. k = parseInt(this.p.data[a][e], 10);
  8089. g = k - parseInt(this.p.data[a][h], 10) + 1;
  8090. var n = d(this).jqGrid("getFullTreeNode", this.p.data[a]);
  8091. if (0 < n.length) for (a = 0; a < n.length; a++) d(this).jqGrid("delRowData", n[a][c]);
  8092. if ("nested" === this.p.treeGridModel) {
  8093. c = d.jgrid.from(this.p.data).greater(h, k, {
  8094. stype: "integer"
  8095. }).select();
  8096. if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][h] = parseInt(c[f][h], 10) - g);
  8097. c = d.jgrid.from(this.p.data).greater(e, k, {
  8098. stype: "integer"
  8099. }).select();
  8100. if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][e] = parseInt(c[f][e], 10) - g)
  8101. }
  8102. }
  8103. })
  8104. },
  8105. addChildNode: function (b, c, a, h) {
  8106. var e = this[0];
  8107. if (a) {
  8108. var k = e.p.treeReader.expanded_field,
  8109. g = e.p.treeReader.leaf_field,
  8110. f = e.p.treeReader.level_field,
  8111. n = e.p.treeReader.parent_id_field,
  8112. m = e.p.treeReader.left_field,
  8113. p = e.p.treeReader.right_field,
  8114. q = e.p.treeReader.loaded,
  8115. l, u, t, w, s;
  8116. l = 0;
  8117. var v = c,
  8118. x;
  8119. void 0 === h && (h = !1);
  8120. if (void 0 === b || null === b) {
  8121. s = e.p.data.length - 1;
  8122. if (0 <= s) for (; 0 <= s;) l = Math.max(l, parseInt(e.p.data[s][e.p.localReader.id], 10)),
  8123. s--;
  8124. b = l + 1
  8125. }
  8126. var y = d(e).jqGrid("getInd", c);
  8127. x = !1;
  8128. void 0 === c || null === c || "" === c ? (v = c = null, l = "last", w = e.p.tree_root_level, s = e.p.data.length + 1) : (l = "after", u = e.p._index[c], t = e.p.data[u], c = t[e.p.localReader.id], w = parseInt(t[f], 10) + 1, s = d(e).jqGrid("getFullTreeNode", t), s.length ? (v = s = s[s.length - 1][e.p.localReader.id], s = d(e).jqGrid("getInd", v) + 1) : s = d(e).jqGrid("getInd", c) + 1, t[g] && (x = !0, t[k] = !0, d(e.rows[y]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(e.p.treeIcons.leaf + " tree-leaf").addClass(e.p.treeIcons.minus + " tree-minus"), e.p.data[u][g] = !1, t[q] = !0));
  8129. u = s + 1;
  8130. void 0 === a[k] && (a[k] = !1);
  8131. void 0 === a[q] && (a[q] = !1);
  8132. a[f] = w;
  8133. void 0 === a[g] && (a[g] = !0);
  8134. "adjacency" === e.p.treeGridModel && (a[n] = c);
  8135. if ("nested" === e.p.treeGridModel) {
  8136. var r;
  8137. if (null !== c) {
  8138. g = parseInt(t[p], 10);
  8139. f = d.jgrid.from(e.p.data);
  8140. f = f.greaterOrEquals(p, g, {
  8141. stype: "integer"
  8142. });
  8143. f = f.select();
  8144. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][m] = f[r][m] > g ? parseInt(f[r][m], 10) + 2 : f[r][m], f[r][p] = f[r][p] >= g ? parseInt(f[r][p], 10) + 2 : f[r][p]);
  8145. a[m] = g;
  8146. a[p] = g + 1
  8147. } else {
  8148. g = parseInt(d(e).jqGrid("getCol", p, !1, "max"), 10);
  8149. f = d.jgrid.from(e.p.data).greater(m, g, {
  8150. stype: "integer"
  8151. }).select();
  8152. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][m] = parseInt(f[r][m], 10) + 2);
  8153. f = d.jgrid.from(e.p.data).greater(p, g, {
  8154. stype: "integer"
  8155. }).select();
  8156. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][p] = parseInt(f[r][p], 10) + 2);
  8157. a[m] = g + 1;
  8158. a[p] = g + 2
  8159. }
  8160. }
  8161. if (null === c || d(e).jqGrid("isNodeLoaded", t) || x) d(e).jqGrid("addRowData", b, a, l, v),
  8162. d(e).jqGrid("setTreeNode", s, u);
  8163. t && !t[k] && h && d(e.rows[y]).find("div.treeclick").click()
  8164. }
  8165. }
  8166. })
  8167. })(jQuery); (function (d) {
  8168. function I(d, n) {
  8169. var h, e, v = [],
  8170. r;
  8171. if (!this || "function" !== typeof d || d instanceof RegExp) throw new TypeError;
  8172. r = this.length;
  8173. for (h = 0; h < r; h++) if (this.hasOwnProperty(h) && (e = this[h], d.call(n, e, h, this))) {
  8174. v.push(e);
  8175. break
  8176. }
  8177. return v
  8178. }
  8179. d.assocArraySize = function (d) {
  8180. var n = 0,
  8181. h;
  8182. for (h in d) d.hasOwnProperty(h) && n++;
  8183. return n
  8184. };
  8185. d.jgrid.extend({
  8186. pivotSetup: function (q, n) {
  8187. var h = [],
  8188. e = [],
  8189. v = [],
  8190. r = [],
  8191. b = {
  8192. grouping: !0,
  8193. groupingView: {
  8194. groupField: [],
  8195. groupSummary: [],
  8196. groupSummaryPos: []
  8197. }
  8198. },
  8199. f = [],
  8200. c = d.extend({
  8201. rowTotals: !1,
  8202. rowTotalsText: "Total",
  8203. colTotals: !1,
  8204. groupSummary: !0,
  8205. groupSummaryPos: "header",
  8206. frozenStaticCols: !1
  8207. },
  8208. n || {});
  8209. this.each(function () {
  8210. function n(C, c, a) {
  8211. C = I.call(C, c, a);
  8212. return 0 < C.length ? C[0] : null
  8213. }
  8214. function J(c, a) {
  8215. var d = 0,
  8216. f = !0,
  8217. h;
  8218. for (h in c) {
  8219. if (c[h] != this[d]) {
  8220. f = !1;
  8221. break
  8222. }
  8223. d++;
  8224. if (d >= this.length) break
  8225. }
  8226. f && (D = a);
  8227. return f
  8228. }
  8229. function E(c, a, f, h) {
  8230. var g = a.length,
  8231. b, k, e, l;
  8232. l = d.isArray(f) ? f.length : 1;
  8233. r = [];
  8234. for (e = r.root = 0; e < l; e++) {
  8235. var n = [],
  8236. m;
  8237. for (b = 0; b < g; b++) {
  8238. if (null == f) m = k = d.trim(a[b].member) + "_" + a[b].aggregator;
  8239. else {
  8240. m = f[e].replace(/\s+/g, "");
  8241. try {
  8242. k = 1 === g ? m : m + "_" + a[b].aggregator + "_" + b
  8243. } catch (v) { }
  8244. }
  8245. var t = h,
  8246. u = k,
  8247. x = n,
  8248. y = k,
  8249. w = h[k],
  8250. p = a[b].member,
  8251. q = c,
  8252. s = void 0;
  8253. switch (a[b].aggregator) {
  8254. case "sum":
  8255. s = parseFloat(w || 0) + parseFloat(q[p] || 0);
  8256. break;
  8257. case "count":
  8258. if ("" === w || null == w) w = 0;
  8259. s = q.hasOwnProperty(p) ? w + 1 : 0;
  8260. break;
  8261. case "min":
  8262. s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.min(parseFloat(w), parseFloat(q[p] || 0));
  8263. break;
  8264. case "max":
  8265. s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.max(parseFloat(w), parseFloat(q[p] || 0))
  8266. }
  8267. t[u] = x[y] = s
  8268. }
  8269. r[m] = n
  8270. }
  8271. return h
  8272. }
  8273. function H(a) {
  8274. var d, b, g, k, e;
  8275. for (g in a) if (a.hasOwnProperty(g)) {
  8276. if ("object" !== typeof a[g] && ("level" === g && (void 0 === F[a.level] && (F[a.level] = "", 0 < a.level && "_r_Totals" !== a.text && (f[a.level - 1] = {
  8277. useColSpanStyle: !1,
  8278. groupHeaders: []
  8279. })), F[a.level] !== a.text && a.children.length && "_r_Totals" !== a.text && 0 < a.level && (f[a.level - 1].groupHeaders.push({
  8280. titleText: a.text
  8281. }), b = f[a.level - 1].groupHeaders.length, e = 1 === b ? K : G + (b - 1) * z, f[a.level - 1].groupHeaders[b - 1].startColumnName = h[e].name, f[a.level - 1].groupHeaders[b - 1].numberOfColumns = h.length - e, G = h.length), F[a.level] = a.text), a.level === l && "level" === g && 0 < l)) if (1 < z) {
  8282. b = 1;
  8283. for (d in a.fields) 1 === b && f[l - 1].groupHeaders.push({
  8284. startColumnName: d,
  8285. numberOfColumns: 1,
  8286. titleText: a.text
  8287. }),
  8288. b++;
  8289. f[l - 1].groupHeaders[f[l - 1].groupHeaders.length - 1].numberOfColumns = b - 1
  8290. } else f.splice(l - 1, 1);
  8291. null != a[g] && "object" === typeof a[g] && H(a[g]);
  8292. if ("level" === g && 0 < a.level) for (d in b = 0, a.fields) {
  8293. e = {};
  8294. for (k in c.aggregates[b]) if (c.aggregates[b].hasOwnProperty(k)) switch (k) {
  8295. case "member":
  8296. case "label":
  8297. case "aggregator":
  8298. break;
  8299. default:
  8300. e[k] = c.aggregates[b][k]
  8301. }
  8302. 1 < z ? (e.name = d, e.label = c.aggregates[b].label || d) : (e.name = a.text, e.label = "_r_Totals" === a.text ? c.rowTotalsText : a.text);
  8303. h.push(e);
  8304. b++
  8305. }
  8306. }
  8307. }
  8308. var m, D, a, y = q.length,
  8309. s, l, z, k, p = 0;
  8310. c.rowTotals && 0 < c.yDimension.length && (c.yDimension.splice(0, 0, {
  8311. dataName: c.yDimension[0].dataName
  8312. }), c.yDimension[0].converter = function () {
  8313. return "_r_Totals"
  8314. });
  8315. s = d.isArray(c.xDimension) ? c.xDimension.length : 0;
  8316. l = c.yDimension.length;
  8317. z = d.isArray(c.aggregates) ? c.aggregates.length : 0;
  8318. if (0 === s || 0 === z) throw "xDimension or aggregates optiona are not set!";
  8319. var x;
  8320. for (a = 0; a < s; a++) x = {
  8321. name: c.xDimension[a].dataName,
  8322. frozen: c.frozenStaticCols
  8323. },
  8324. x = d.extend(!0, x, c.xDimension[a]),
  8325. h.push(x);
  8326. x = s - 1;
  8327. for (var A = {}; p < y;) {
  8328. m = q[p];
  8329. var t = [],
  8330. u = [];
  8331. k = {};
  8332. a = 0;
  8333. do t[a] = d.trim(m[c.xDimension[a].dataName]),
  8334. k[c.xDimension[a].dataName] = t[a],
  8335. a++;
  8336. while (a < s);
  8337. var g = 0;
  8338. D = -1;
  8339. a = n(e, J, t);
  8340. if (!a) {
  8341. g = 0;
  8342. if (1 <= l) {
  8343. for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
  8344. c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
  8345. k = E(m, c.aggregates, u, k)
  8346. } else 0 === l && (k = E(m, c.aggregates, null, k));
  8347. e.push(k)
  8348. } else if (0 <= D) {
  8349. g = 0;
  8350. if (1 <= l) {
  8351. for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
  8352. c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
  8353. a = E(m, c.aggregates, u, a)
  8354. } else 0 === l && (a = E(m, c.aggregates, null, a));
  8355. e[D] = a
  8356. }
  8357. m = 0;
  8358. var t = k = null,
  8359. B;
  8360. for (B in r) {
  8361. if (0 === m) A.children && void 0 !== A.children || (A = {
  8362. text: B,
  8363. level: 0,
  8364. children: []
  8365. }),
  8366. k = A.children;
  8367. else {
  8368. t = null;
  8369. for (a = 0; a < k.length; a++) if (k[a].text === B) {
  8370. t = k[a];
  8371. break
  8372. }
  8373. t ? k = t.children : (k.push({
  8374. children: [],
  8375. text: B,
  8376. level: m,
  8377. fields: r[B]
  8378. }), k = k[k.length - 1].children)
  8379. }
  8380. m++
  8381. }
  8382. p++
  8383. }
  8384. var F = [],
  8385. G = h.length,
  8386. K = G;
  8387. 0 < l && (f[l - 1] = {
  8388. useColSpanStyle: !1,
  8389. groupHeaders: []
  8390. });
  8391. H(A, 0);
  8392. if (c.colTotals) for (p = e.length; p--;) for (a = s; a < h.length; a++) y = h[a].name,
  8393. v[y] = v[y] ? v[y] + parseFloat(e[p][y] || 0) : parseFloat(e[p][y] || 0);
  8394. if (0 < x) for (a = 0; a < x; a++) b.groupingView.groupField[a] = h[a].name,
  8395. b.groupingView.groupSummary[a] = c.groupSummary,
  8396. b.groupingView.groupSummaryPos[a] = c.groupSummaryPos;
  8397. else b.grouping = !1;
  8398. b.sortname = h[x].name;
  8399. b.groupingView.hideFirstGroupCol = !0
  8400. });
  8401. return {
  8402. colModel: h,
  8403. rows: e,
  8404. groupOptions: b,
  8405. groupHeaders: f,
  8406. summary: v
  8407. }
  8408. },
  8409. jqPivot: function (q, n, h, e) {
  8410. return this.each(function () {
  8411. function v(b) {
  8412. var f = jQuery(r).jqGrid("pivotSetup", b, n),
  8413. c = 0 < d.assocArraySize(f.summary) ? !0 : !1,
  8414. e = d.jgrid.from(f.rows);
  8415. for (b = 0; b < f.groupOptions.groupingView.groupField.length; b++) e.orderBy(f.groupOptions.groupingView.groupField[b], "a", "text", "");
  8416. jQuery(r).jqGrid(d.extend({
  8417. datastr: d.extend(e.select(), c ? {
  8418. userdata: f.summary
  8419. } : {}),
  8420. datatype: "jsonstring",
  8421. footerrow: c,
  8422. userDataOnFooter: c,
  8423. colModel: f.colModel,
  8424. viewrecords: !0,
  8425. sortname: n.xDimension[0].dataName
  8426. },
  8427. h || {},
  8428. f.groupOptions));
  8429. f = f.groupHeaders;
  8430. if (f.length) for (b = 0; b < f.length; b++) f[b] && f[b].groupHeaders.length && jQuery(r).jqGrid("setGroupHeaders", f[b]);
  8431. n.frozenStaticCols && jQuery(r).jqGrid("setFrozenColumns")
  8432. }
  8433. var r = this;
  8434. "string" === typeof q ? d.ajax(d.extend({
  8435. url: q,
  8436. dataType: "json",
  8437. success: function (b) {
  8438. v(d.jgrid.getAccessor(b, e && e.reader ? e.reader : "rows"))
  8439. }
  8440. },
  8441. e || {})) : v(q)
  8442. })
  8443. }
  8444. })
  8445. })(jQuery); (function (c) {
  8446. c.jgrid.extend({
  8447. jqGridImport: function (a) {
  8448. a = c.extend({
  8449. imptype: "xml",
  8450. impstring: "",
  8451. impurl: "",
  8452. mtype: "GET",
  8453. impData: {},
  8454. xmlGrid: {
  8455. config: "roots>grid",
  8456. data: "roots>rows"
  8457. },
  8458. jsonGrid: {
  8459. config: "grid",
  8460. data: "data"
  8461. },
  8462. ajaxOptions: {}
  8463. },
  8464. a || {});
  8465. return this.each(function () {
  8466. var d = this,
  8467. f = function (a, b) {
  8468. var e = c(b.xmlGrid.config, a)[0],
  8469. h = c(b.xmlGrid.data, a)[0],
  8470. f,
  8471. g;
  8472. if (xmlJsonClass.xml2json && c.jgrid.parse) {
  8473. e = xmlJsonClass.xml2json(e, " ");
  8474. e = c.jgrid.parse(e);
  8475. for (g in e) e.hasOwnProperty(g) && (f = e[g]);
  8476. h ? (h = e.grid.datatype, e.grid.datatype = "xmlstring", e.grid.datastr = a, c(d).jqGrid(f).jqGrid("setGridParam", {
  8477. datatype: h
  8478. })) : c(d).jqGrid(f)
  8479. } else alert("xml2json or parse are not present")
  8480. },
  8481. b = function (a, b) {
  8482. if (a && "string" === typeof a) {
  8483. var e = !1;
  8484. c.jgrid.useJSON && (c.jgrid.useJSON = !1, e = !0);
  8485. var f = c.jgrid.parse(a);
  8486. e && (c.jgrid.useJSON = !0);
  8487. e = f[b.jsonGrid.config];
  8488. if (f = f[b.jsonGrid.data]) {
  8489. var g = e.datatype;
  8490. e.datatype = "jsonstring";
  8491. e.datastr = f;
  8492. c(d).jqGrid(e).jqGrid("setGridParam", {
  8493. datatype: g
  8494. })
  8495. } else c(d).jqGrid(e)
  8496. }
  8497. };
  8498. switch (a.imptype) {
  8499. case "xml":
  8500. c.ajax(c.extend({
  8501. url:
  8502. a.impurl,
  8503. type: a.mtype,
  8504. data: a.impData,
  8505. dataType: "xml",
  8506. complete: function (b, g) {
  8507. "success" === g && (f(b.responseXML, a), c(d).triggerHandler("jqGridImportComplete", [b, a]), c.isFunction(a.importComplete) && a.importComplete(b))
  8508. }
  8509. },
  8510. a.ajaxOptions));
  8511. break;
  8512. case "xmlstring":
  8513. if (a.impstring && "string" === typeof a.impstring) {
  8514. var g = c.parseXML(a.impstring);
  8515. g && (f(g, a), c(d).triggerHandler("jqGridImportComplete", [g, a]), c.isFunction(a.importComplete) && a.importComplete(g), a.impstring = null);
  8516. g = null
  8517. }
  8518. break;
  8519. case "json":
  8520. c.ajax(c.extend({
  8521. url:
  8522. a.impurl,
  8523. type: a.mtype,
  8524. data: a.impData,
  8525. dataType: "json",
  8526. complete: function (f) {
  8527. try {
  8528. b(f.responseText, a),
  8529. c(d).triggerHandler("jqGridImportComplete", [f, a]),
  8530. c.isFunction(a.importComplete) && a.importComplete(f)
  8531. } catch (g) { }
  8532. }
  8533. },
  8534. a.ajaxOptions));
  8535. break;
  8536. case "jsonstring":
  8537. a.impstring && "string" === typeof a.impstring && (b(a.impstring, a), c(d).triggerHandler("jqGridImportComplete", [a.impstring, a]), c.isFunction(a.importComplete) && a.importComplete(a.impstring), a.impstring = null)
  8538. }
  8539. })
  8540. },
  8541. jqGridExport: function (a) {
  8542. a = c.extend({
  8543. exptype: "xmlstring",
  8544. root: "grid",
  8545. ident: "\t"
  8546. },
  8547. a || {});
  8548. var d = null;
  8549. this.each(function () {
  8550. if (this.grid) {
  8551. var f, b = c.extend(!0, {},
  8552. c(this).jqGrid("getGridParam"));
  8553. b.rownumbers && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8554. b.multiselect && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8555. b.subGrid && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8556. b.knv = null;
  8557. if (b.treeGrid) for (f in b.treeReader) b.treeReader.hasOwnProperty(f) && (b.colNames.splice(b.colNames.length - 1), b.colModel.splice(b.colModel.length - 1));
  8558. switch (a.exptype) {
  8559. case "xmlstring":
  8560. d = "<" + a.root + ">" + xmlJsonClass.json2xml(b, a.ident) + "</" + a.root + ">";
  8561. break;
  8562. case "jsonstring":
  8563. d = "{" + xmlJsonClass.toJson(b, a.root, a.ident, !1) + "}",
  8564. void 0 !== b.postData.filters && (d = d.replace(/filters":"/, 'filters":'), d = d.replace(/}]}"/, "}]}"))
  8565. }
  8566. }
  8567. });
  8568. return d
  8569. },
  8570. excelExport: function (a) {
  8571. a = c.extend({
  8572. exptype: "remote",
  8573. url: null,
  8574. oper: "oper",
  8575. tag: "excel",
  8576. exportOptions: {}
  8577. },
  8578. a || {});
  8579. return this.each(function () {
  8580. if (this.grid) {
  8581. var d;
  8582. "remote" === a.exptype && (d = c.extend({},
  8583. this.p.postData), d[a.oper] = a.tag, d = jQuery.param(d), d = -1 !== a.url.indexOf("?") ? a.url + "&" + d : a.url + "?" + d, window.location = d)
  8584. }
  8585. })
  8586. }
  8587. })
  8588. })(jQuery);
  8589. var xmlJsonClass = {
  8590. xml2json: function (a, b) {
  8591. 9 === a.nodeType && (a = a.documentElement);
  8592. var g = this.removeWhite(a),
  8593. g = this.toObj(g),
  8594. g = this.toJson(g, a.nodeName, "\t");
  8595. return "{\n" + b + (b ? g.replace(/\t/g, b) : g.replace(/\t|\n/g, "")) + "\n}"
  8596. },
  8597. json2xml: function (a, b) {
  8598. var g = function (a, b, e) {
  8599. var d = "",
  8600. f, k;
  8601. if (a instanceof Array) if (0 === a.length) d += e + "<" + b + ">__EMPTY_ARRAY_</" + b + ">\n";
  8602. else for (f = 0, k = a.length; f < k; f += 1) var n = e + g(a[f], b, e + "\t") + "\n",
  8603. d = d + n;
  8604. else if ("object" === typeof a) {
  8605. f = !1;
  8606. d += e + "<" + b;
  8607. for (k in a) a.hasOwnProperty(k) && ("@" === k.charAt(0) ? d += " " + k.substr(1) + '="' + a[k].toString() + '"' : f = !0);
  8608. d += f ? ">" : "/>";
  8609. if (f) {
  8610. for (k in a) a.hasOwnProperty(k) && ("#text" === k ? d += a[k] : "#cdata" === k ? d += "<![CDATA[" + a[k] + "]]\x3e" : "@" !== k.charAt(0) && (d += g(a[k], k, e + "\t")));
  8611. d += ("\n" === d.charAt(d.length - 1) ? e : "") + "</" + b + ">"
  8612. }
  8613. } else "function" === typeof a ? d += e + "<" + b + "><![CDATA[" + a + "]]\x3e</" + b + ">" : (void 0 === a && (a = ""), d = '""' === a.toString() || 0 === a.toString().length ? d + (e + "<" + b + ">__EMPTY_STRING_</" + b + ">") : d + (e + "<" + b + ">" + a.toString() + "</" + b + ">"));
  8614. return d
  8615. },
  8616. f = "",
  8617. e;
  8618. for (e in a) a.hasOwnProperty(e) && (f += g(a[e], e, ""));
  8619. return b ? f.replace(/\t/g, b) : f.replace(/\t|\n/g, "")
  8620. },
  8621. toObj: function (a) {
  8622. var b = {},
  8623. g = /function/i;
  8624. if (1 === a.nodeType) {
  8625. if (a.attributes.length) {
  8626. var f;
  8627. for (f = 0; f < a.attributes.length; f += 1) b["@" + a.attributes[f].nodeName] = (a.attributes[f].nodeValue || "").toString()
  8628. }
  8629. if (a.firstChild) {
  8630. var e = f = 0,
  8631. h = !1,
  8632. c;
  8633. for (c = a.firstChild; c; c = c.nextSibling) 1 === c.nodeType ? h = !0 : 3 === c.nodeType && c.nodeValue.match(/[^ \f\n\r\t\v]/) ? f += 1 : 4 === c.nodeType && (e += 1);
  8634. if (h) if (2 > f && 2 > e) for (this.removeWhite(a), c = a.firstChild; c; c = c.nextSibling) 3 === c.nodeType ? b["#text"] = this.escape(c.nodeValue) : 4 === c.nodeType ? g.test(c.nodeValue) ? b[c.nodeName] = [b[c.nodeName], c.nodeValue] : b["#cdata"] = this.escape(c.nodeValue) : b[c.nodeName] ? b[c.nodeName] instanceof Array ? b[c.nodeName][b[c.nodeName].length] = this.toObj(c) : b[c.nodeName] = [b[c.nodeName], this.toObj(c)] : b[c.nodeName] = this.toObj(c);
  8635. else a.attributes.length ? b["#text"] = this.escape(this.innerXml(a)) : b = this.escape(this.innerXml(a));
  8636. else if (f) a.attributes.length ? b["#text"] = this.escape(this.innerXml(a)) : (b = this.escape(this.innerXml(a)), "__EMPTY_ARRAY_" === b ? b = "[]" : "__EMPTY_STRING_" === b && (b = ""));
  8637. else if (e) if (1 < e) b = this.escape(this.innerXml(a));
  8638. else for (c = a.firstChild; c; c = c.nextSibling) if (g.test(a.firstChild.nodeValue)) {
  8639. b = a.firstChild.nodeValue;
  8640. break
  8641. } else b["#cdata"] = this.escape(c.nodeValue)
  8642. }
  8643. a.attributes.length || a.firstChild || (b = null)
  8644. } else 9 === a.nodeType ? b = this.toObj(a.documentElement) : alert("unhandled node type: " + a.nodeType);
  8645. return b
  8646. },
  8647. toJson: function (a, b, g, f) {
  8648. void 0 === f && (f = !0);
  8649. var e = b ? '"' + b + '"' : "",
  8650. h = "\t",
  8651. c = "\n";
  8652. f || (c = h = "");
  8653. if ("[]" === a) e += b ? ":[]" : "[]";
  8654. else if (a instanceof Array) {
  8655. var l, d, m = [];
  8656. d = 0;
  8657. for (l = a.length; d < l; d += 1) m[d] = this.toJson(a[d], "", g + h, f);
  8658. e += (b ? ":[" : "[") + (1 < m.length ? c + g + h + m.join("," + c + g + h) + c + g : m.join("")) + "]"
  8659. } else if (null === a) e += (b && ":") + "null";
  8660. else if ("object" === typeof a) {
  8661. l = [];
  8662. for (d in a) a.hasOwnProperty(d) && (l[l.length] = this.toJson(a[d], d, g + h, f));
  8663. e += (b ? ":{" : "{") + (1 < l.length ? c + g + h + l.join("," + c + g + h) + c + g : l.join("")) + "}"
  8664. } else e = "string" === typeof a ? e + ((b && ":") + '"' + a.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"') : e + ((b && ":") + a.toString());
  8665. return e
  8666. },
  8667. innerXml: function (a) {
  8668. var b = "";
  8669. if ("innerHTML" in a) b = a.innerHTML;
  8670. else {
  8671. var g = function (a) {
  8672. var b = "",
  8673. h;
  8674. if (1 === a.nodeType) {
  8675. b += "<" + a.nodeName;
  8676. for (h = 0; h < a.attributes.length; h += 1) b += " " + a.attributes[h].nodeName + '="' + (a.attributes[h].nodeValue || "").toString() + '"';
  8677. if (a.firstChild) {
  8678. b += ">";
  8679. for (h = a.firstChild; h; h = h.nextSibling) b += g(h);
  8680. b += "</" + a.nodeName + ">"
  8681. } else b += "/>"
  8682. } else 3 === a.nodeType ? b += a.nodeValue : 4 === a.nodeType && (b += "<![CDATA[" + a.nodeValue + "]]\x3e");
  8683. return b
  8684. };
  8685. for (a = a.firstChild; a; a = a.nextSibling) b += g(a)
  8686. }
  8687. return b
  8688. },
  8689. escape: function (a) {
  8690. return a.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, "\\n").replace(/[\r]/g, "\\r")
  8691. },
  8692. removeWhite: function (a) {
  8693. a.normalize();
  8694. var b;
  8695. for (b = a.firstChild; b;) if (3 === b.nodeType) if (b.nodeValue.match(/[^ \f\n\r\t\v]/)) b = b.nextSibling;
  8696. else {
  8697. var g = b.nextSibling;
  8698. a.removeChild(b);
  8699. b = g
  8700. } else 1 === b.nodeType && this.removeWhite(b),
  8701. b = b.nextSibling;
  8702. return a
  8703. }
  8704. };
  8705. function tableToGrid(l, m) {
  8706. jQuery(l).each(function () {
  8707. if (!this.grid) {
  8708. jQuery(this).width("99%");
  8709. var b = jQuery(this).width(),
  8710. c = jQuery("tr td:first-child input[type=checkbox]:first", jQuery(this)),
  8711. a = jQuery("tr td:first-child input[type=radio]:first", jQuery(this)),
  8712. c = 0 < c.length,
  8713. a = !c && 0 < a.length,
  8714. k = c || a,
  8715. d = [],
  8716. e = [];
  8717. jQuery("th", jQuery(this)).each(function () {
  8718. 0 === d.length && k ? (d.push({
  8719. name: "__selection__",
  8720. index: "__selection__",
  8721. width: 0,
  8722. hidden: !0
  8723. }), e.push("__selection__")) : (d.push({
  8724. name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  8725. index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  8726. width: jQuery(this).width() || 150
  8727. }), e.push(jQuery(this).html()))
  8728. });
  8729. var f = [],
  8730. g = [],
  8731. h = [];
  8732. jQuery("tbody > tr", jQuery(this)).each(function () {
  8733. var b = {},
  8734. a = 0;
  8735. jQuery("td", jQuery(this)).each(function () {
  8736. if (0 === a && k) {
  8737. var c = jQuery("input", jQuery(this)),
  8738. e = c.attr("value");
  8739. g.push(e || f.length);
  8740. c.is(":checked") && h.push(e);
  8741. b[d[a].name] = c.attr("value")
  8742. } else b[d[a].name] = jQuery(this).html();
  8743. a++
  8744. });
  8745. 0 < a && f.push(b)
  8746. });
  8747. jQuery(this).empty();
  8748. jQuery(this).addClass("scroll");
  8749. jQuery(this).jqGrid(jQuery.extend({
  8750. datatype: "local",
  8751. width: b,
  8752. colNames: e,
  8753. colModel: d,
  8754. multiselect: c
  8755. },
  8756. m || {}));
  8757. for (b = 0; b < f.length; b++) a = null,
  8758. 0 < g.length && (a = g[b]) && a.replace && (a = encodeURIComponent(a).replace(/[.\-%]/g, "_")),
  8759. null === a && (a = b + 1),
  8760. jQuery(this).jqGrid("addRowData", a, f[b]);
  8761. for (b = 0; b < h.length; b++) jQuery(this).jqGrid("setSelection", h[b])
  8762. }
  8763. })
  8764. }; (function (b) {
  8765. b.jgrid.msie && 8 === b.jgrid.msiever() && (b.expr[":"].hidden = function (b) {
  8766. return 0 === b.offsetWidth || 0 === b.offsetHeight || "none" === b.style.display
  8767. });
  8768. b.jgrid._multiselect = !1;
  8769. if (b.ui && b.ui.multiselect) {
  8770. if (b.ui.multiselect.prototype._setSelected) {
  8771. var r = b.ui.multiselect.prototype._setSelected;
  8772. b.ui.multiselect.prototype._setSelected = function (a, d) {
  8773. var c = r.call(this, a, d);
  8774. if (d && this.selectedList) {
  8775. var e = this.element;
  8776. this.selectedList.find("li").each(function () {
  8777. b(this).data("optionLink") && b(this).data("optionLink").remove().appendTo(e)
  8778. })
  8779. }
  8780. return c
  8781. }
  8782. }
  8783. b.ui.multiselect.prototype.destroy && (b.ui.multiselect.prototype.destroy = function () {
  8784. this.element.show();
  8785. this.container.remove();
  8786. void 0 === b.Widget ? b.widget.prototype.destroy.apply(this, arguments) : b.Widget.prototype.destroy.apply(this, arguments)
  8787. });
  8788. b.jgrid._multiselect = !0
  8789. }
  8790. b.jgrid.extend({
  8791. sortableColumns: function (a) {
  8792. return this.each(function () {
  8793. function d() {
  8794. c.p.disableClick = !0
  8795. }
  8796. var c = this,
  8797. e = b.jgrid.jqID(c.p.id),
  8798. e = {
  8799. tolerance: "pointer",
  8800. axis: "x",
  8801. scrollSensitivity: "1",
  8802. items: ">th:not(:has(#jqgh_" + e + "_cb,#jqgh_" + e + "_rn,#jqgh_" + e + "_subgrid),:hidden)",
  8803. placeholder: {
  8804. element: function (a) {
  8805. return b(document.createElement(a[0].nodeName)).addClass(a[0].className + " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]
  8806. },
  8807. update: function (b, a) {
  8808. a.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10));
  8809. a.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10))
  8810. }
  8811. },
  8812. update: function (a, e) {
  8813. var d = b(e.item).parent(),
  8814. d = b(">th", d),
  8815. f = {},
  8816. g = c.p.id + "_";
  8817. b.each(c.p.colModel,
  8818. function (b) {
  8819. f[this.name] = b
  8820. });
  8821. var l = [];
  8822. d.each(function () {
  8823. var a = b(">div", this).get(0).id.replace(/^jqgh_/, "").replace(g, "");
  8824. f.hasOwnProperty(a) && l.push(f[a])
  8825. });
  8826. b(c).jqGrid("remapColumns", l, !0, !0);
  8827. b.isFunction(c.p.sortable.update) && c.p.sortable.update(l);
  8828. setTimeout(function () {
  8829. c.p.disableClick = !1
  8830. },
  8831. 50)
  8832. }
  8833. };
  8834. c.p.sortable.options ? b.extend(e, c.p.sortable.options) : b.isFunction(c.p.sortable) && (c.p.sortable = {
  8835. update: c.p.sortable
  8836. });
  8837. if (e.start) {
  8838. var g = e.start;
  8839. e.start = function (b, a) {
  8840. d();
  8841. g.call(this, b, a)
  8842. }
  8843. } else e.start = d;
  8844. c.p.sortable.exclude && (e.items += ":not(" + c.p.sortable.exclude + ")");
  8845. a.sortable(e).data("sortable").floating = !0
  8846. })
  8847. },
  8848. columnChooser: function (a) {
  8849. function d(a, c) {
  8850. a && ("string" === typeof a ? b.fn[a] && b.fn[a].apply(c, b.makeArray(arguments).slice(2)) : b.isFunction(a) && a.apply(c, b.makeArray(arguments).slice(2)))
  8851. }
  8852. var c = this;
  8853. if (!b("#colchooser_" + b.jgrid.jqID(c[0].p.id)).length) {
  8854. var e = b('<div id="colchooser_' + c[0].p.id + '" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
  8855. g = b("select", e);
  8856. a = b.extend({
  8857. width: 420,
  8858. height: 240,
  8859. classname: null,
  8860. done: function (b) {
  8861. b && c.jqGrid("remapColumns", b, !0)
  8862. },
  8863. msel: "multiselect",
  8864. dlog: "dialog",
  8865. dialog_opts: {
  8866. minWidth: 470
  8867. },
  8868. dlog_opts: function (a) {
  8869. var c = {};
  8870. c[a.bSubmit] = function () {
  8871. a.apply_perm();
  8872. a.cleanup(!1)
  8873. };
  8874. c[a.bCancel] = function () {
  8875. a.cleanup(!0)
  8876. };
  8877. return b.extend(!0, {
  8878. buttons: c,
  8879. close: function () {
  8880. a.cleanup(!0)
  8881. },
  8882. modal: a.modal || !1,
  8883. resizable: a.resizable || !0,
  8884. width: a.width + 20
  8885. },
  8886. a.dialog_opts || {})
  8887. },
  8888. apply_perm: function () {
  8889. b("option", g).each(function () {
  8890. this.selected ? c.jqGrid("showCol", k[this.value].name) : c.jqGrid("hideCol", k[this.value].name)
  8891. });
  8892. var e = [];
  8893. b("option:selected", g).each(function () {
  8894. e.push(parseInt(this.value, 10))
  8895. });
  8896. b.each(e,
  8897. function () {
  8898. delete p[k[parseInt(this, 10)].name]
  8899. });
  8900. b.each(p,
  8901. function () {
  8902. var b = parseInt(this, 10);
  8903. var a = e,
  8904. c = b;
  8905. if (0 <= c) {
  8906. var d = a.slice(),
  8907. k = d.splice(c, Math.max(a.length - c, c));
  8908. c > a.length && (c = a.length);
  8909. d[c] = b;
  8910. e = d.concat(k)
  8911. } else e = void 0
  8912. });
  8913. a.done && a.done.call(c, e)
  8914. },
  8915. cleanup: function (b) {
  8916. d(a.dlog, e, "destroy");
  8917. d(a.msel, g, "destroy");
  8918. e.remove();
  8919. b && a.done && a.done.call(c)
  8920. },
  8921. msel_opts: {}
  8922. },
  8923. b.jgrid.col, a || {});
  8924. if (b.ui && b.ui.multiselect && "multiselect" === a.msel) {
  8925. if (!b.jgrid._multiselect) {
  8926. alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
  8927. return
  8928. }
  8929. a.msel_opts = b.extend(b.ui.multiselect.defaults, a.msel_opts)
  8930. }
  8931. a.caption && e.attr("title", a.caption);
  8932. a.classname && (e.addClass(a.classname), g.addClass(a.classname));
  8933. a.width && (b(">div", e).css({
  8934. width: a.width,
  8935. margin: "0 auto"
  8936. }), g.css("width", a.width));
  8937. a.height && (b(">div", e).css("height", a.height), g.css("height", a.height - 10));
  8938. var k = c.jqGrid("getGridParam", "colModel"),
  8939. t = c.jqGrid("getGridParam", "colNames"),
  8940. p = {},
  8941. f = [];
  8942. g.empty();
  8943. b.each(k,
  8944. function (a) {
  8945. p[this.name] = a;
  8946. this.hidedlg ? this.hidden || f.push(a) : g.append("<option value='" + a + "' " + (this.hidden ? "" : "selected='selected'") + ">" + b.jgrid.stripHtml(t[a]) + "</option>")
  8947. });
  8948. var q = b.isFunction(a.dlog_opts) ? a.dlog_opts.call(c, a) : a.dlog_opts;
  8949. d(a.dlog, e, q);
  8950. q = b.isFunction(a.msel_opts) ? a.msel_opts.call(c, a) : a.msel_opts;
  8951. d(a.msel, g, q)
  8952. }
  8953. },
  8954. sortableRows: function (a) {
  8955. return this.each(function () {
  8956. var d = this;
  8957. d.grid && !d.p.treeGrid && b.fn.sortable && (a = b.extend({
  8958. cursor: "move",
  8959. axis: "y",
  8960. items: ".jqgrow"
  8961. },
  8962. a || {}), a.start && b.isFunction(a.start) ? (a._start_ = a.start, delete a.start) : a._start_ = !1, a.update && b.isFunction(a.update) ? (a._update_ = a.update, delete a.update) : a._update_ = !1, a.start = function (c, e) {
  8963. b(e.item).css("border-width", "0");
  8964. b("td", e.item).each(function (b) {
  8965. this.style.width = d.grid.cols[b].style.width
  8966. });
  8967. if (d.p.subGrid) {
  8968. var g = b(e.item).attr("id");
  8969. try {
  8970. b(d).jqGrid("collapseSubGridRow", g)
  8971. } catch (k) { }
  8972. }
  8973. a._start_ && a._start_.apply(this, [c, e])
  8974. },
  8975. a.update = function (c, e) {
  8976. b(e.item).css("border-width", ""); !0 === d.p.rownumbers && b("td.jqgrid-rownum", d.rows).each(function (a) {
  8977. b(this).html(a + 1 + (parseInt(d.p.page, 10) - 1) * parseInt(d.p.rowNum, 10))
  8978. });
  8979. a._update_ && a._update_.apply(this, [c, e])
  8980. },
  8981. b("tbody:first", d).sortable(a), b("tbody:first", d).disableSelection())
  8982. })
  8983. },
  8984. gridDnD: function (a) {
  8985. return this.each(function () {
  8986. function d() {
  8987. var a = b.data(c, "dnd");
  8988. b("tr.jqgrow:not(.ui-draggable)", c).draggable(b.isFunction(a.drag) ? a.drag.call(b(c), a) : a.drag)
  8989. }
  8990. var c = this,
  8991. e, g;
  8992. if (c.grid && !c.p.treeGrid && b.fn.draggable && b.fn.droppable) if (void 0 === b("#jqgrid_dnd")[0] && b("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"), "string" === typeof a && "updateDnD" === a && !0 === c.p.jqgdnd) d();
  8993. else if (a = b.extend({
  8994. drag: function (a) {
  8995. return b.extend({
  8996. start: function (e, d) {
  8997. var f;
  8998. if (c.p.subGrid) {
  8999. f = b(d.helper).attr("id");
  9000. try {
  9001. b(c).jqGrid("collapseSubGridRow", f)
  9002. } catch (g) { }
  9003. }
  9004. for (f = 0; f < b.data(c, "dnd").connectWith.length; f++) 0 === b(b.data(c, "dnd").connectWith[f]).jqGrid("getGridParam", "reccount") && b(b.data(c, "dnd").connectWith[f]).jqGrid("addRowData", "jqg_empty_row", {});
  9005. d.helper.addClass("ui-state-highlight");
  9006. b("td", d.helper).each(function (b) {
  9007. this.style.width = c.grid.headers[b].width + "px"
  9008. });
  9009. a.onstart && b.isFunction(a.onstart) && a.onstart.call(b(c), e, d)
  9010. },
  9011. stop: function (e, d) {
  9012. var f;
  9013. d.helper.dropped && !a.dragcopy && (f = b(d.helper).attr("id"), void 0 === f && (f = b(this).attr("id")), b(c).jqGrid("delRowData", f));
  9014. for (f = 0; f < b.data(c, "dnd").connectWith.length; f++) b(b.data(c, "dnd").connectWith[f]).jqGrid("delRowData", "jqg_empty_row");
  9015. a.onstop && b.isFunction(a.onstop) && a.onstop.call(b(c), e, d)
  9016. }
  9017. },
  9018. a.drag_opts || {})
  9019. },
  9020. drop: function (a) {
  9021. return b.extend({
  9022. accept: function (a) {
  9023. if (!b(a).hasClass("jqgrow")) return a;
  9024. a = b(a).closest("table.ui-jqgrid-btable");
  9025. return 0 < a.length && void 0 !== b.data(a[0], "dnd") ? (a = b.data(a[0], "dnd").connectWith, -1 !== b.inArray("#" + b.jgrid.jqID(this.id), a) ? !0 : !1) : !1
  9026. },
  9027. drop: function (e, d) {
  9028. if (b(d.draggable).hasClass("jqgrow")) {
  9029. var f = b(d.draggable).attr("id"),
  9030. f = d.draggable.parent().parent().jqGrid("getRowData", f);
  9031. if (!a.dropbyname) {
  9032. var g = 0,
  9033. l = {},
  9034. h, n, s = b("#" + b.jgrid.jqID(this.id)).jqGrid("getGridParam", "colModel");
  9035. try {
  9036. for (n in f) f.hasOwnProperty(n) && (h = s[g].name, "cb" !== h && "rn" !== h && "subgrid" !== h && f.hasOwnProperty(n) && s[g] && (l[h] = f[n]), g++);
  9037. f = l
  9038. } catch (r) { }
  9039. }
  9040. d.helper.dropped = !0;
  9041. a.beforedrop && b.isFunction(a.beforedrop) && (h = a.beforedrop.call(this, e, d, f, b("#" + b.jgrid.jqID(c.p.id)), b(this)), void 0 !== h && null !== h && "object" === typeof h && (f = h));
  9042. if (d.helper.dropped) {
  9043. var m;
  9044. a.autoid && (b.isFunction(a.autoid) ? m = a.autoid.call(this, f) : (m = Math.ceil(1E3 * Math.random()), m = a.autoidprefix + m));
  9045. b("#" + b.jgrid.jqID(this.id)).jqGrid("addRowData", m, f, a.droppos)
  9046. }
  9047. a.ondrop && b.isFunction(a.ondrop) && a.ondrop.call(this, e, d, f)
  9048. }
  9049. }
  9050. },
  9051. a.drop_opts || {})
  9052. },
  9053. onstart: null,
  9054. onstop: null,
  9055. beforedrop: null,
  9056. ondrop: null,
  9057. drop_opts: {
  9058. activeClass: "ui-state-active",
  9059. hoverClass: "ui-state-hover"
  9060. },
  9061. drag_opts: {
  9062. revert: "invalid",
  9063. helper: "clone",
  9064. cursor: "move",
  9065. appendTo: "#jqgrid_dnd",
  9066. zIndex: 5E3
  9067. },
  9068. dragcopy: !1,
  9069. dropbyname: !1,
  9070. droppos: "first",
  9071. autoid: !0,
  9072. autoidprefix: "dnd_"
  9073. },
  9074. a || {}), a.connectWith) for (a.connectWith = a.connectWith.split(","), a.connectWith = b.map(a.connectWith,
  9075. function (a) {
  9076. return b.trim(a)
  9077. }), b.data(c, "dnd", a), 0 === c.p.reccount || c.p.jqgdnd || d(), c.p.jqgdnd = !0, e = 0; e < a.connectWith.length; e++) g = a.connectWith[e],
  9078. b(g).droppable(b.isFunction(a.drop) ? a.drop.call(b(c), a) : a.drop)
  9079. })
  9080. },
  9081. gridResize: function (a) {
  9082. return this.each(function () {
  9083. var d = this,
  9084. c = b.jgrid.jqID(d.p.id);
  9085. d.grid && b.fn.resizable && (a = b.extend({},
  9086. a || {}), a.alsoResize ? (a._alsoResize_ = a.alsoResize, delete a.alsoResize) : a._alsoResize_ = !1, a.stop && b.isFunction(a.stop) ? (a._stop_ = a.stop, delete a.stop) : a._stop_ = !1, a.stop = function (e, g) {
  9087. b(d).jqGrid("setGridParam", {
  9088. height: b("#gview_" + c + " .ui-jqgrid-bdiv").height()
  9089. });
  9090. b(d).jqGrid("setGridWidth", g.size.width, a.shrinkToFit);
  9091. a._stop_ && a._stop_.call(d, e, g)
  9092. },
  9093. a.alsoResize = a._alsoResize_ ? eval("(" + ("{'#gview_" + c + " .ui-jqgrid-bdiv':true,'" + a._alsoResize_ + "':true}") + ")") : b(".ui-jqgrid-bdiv", "#gview_" + c), delete a._alsoResize_, b("#gbox_" + c).resizable(a))
  9094. })
  9095. }
  9096. })
  9097. })(jQuery);