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. top.$("#loading_manage").attr('isTableLoading', 'true')
  1378. },
  1379. 0);
  1380. b("#load_" + b.jgrid.jqID(a.p.id)).next().find('.ui-jqgrid-bdiv').find("span").remove();
  1381. break;
  1382. case "block":
  1383. b("#lui_" + b.jgrid.jqID(a.p.id)).show(),
  1384. b("#load_" + b.jgrid.jqID(a.p.id)).show()
  1385. }
  1386. },
  1387. T = function () {
  1388. a.grid.hDiv.loading = !1;
  1389. switch (a.p.loadui) {
  1390. case "enable":
  1391. window.setTimeout(function () {
  1392. top.$("#loading_manage").removeAttr('isTableLoading');
  1393. Loading(false)
  1394. },
  1395. 100);
  1396. if (a.p.unwritten) {
  1397. var c = b.jgrid.jqID(a.p.id);
  1398. b("#load_" + c).next().find('.ui-jqgrid-bdiv').find(".unwritten").remove();
  1399. var d = b("#load_" + c).next().find('.ui-jqgrid-bdiv').find('table tr').length;
  1400. if (d == 1) {
  1401. b("#load_" + c).next().find('.ui-jqgrid-bdiv').append('<div class="unwritten" style="color:red;padding:4px;border-bottom:#ccc 1px solid;">没有找到您要的相关数据!</div>')
  1402. }
  1403. }
  1404. break;
  1405. case "block":
  1406. b("#lui_" + b.jgrid.jqID(a.p.id)).hide(),
  1407. b("#load_" + b.jgrid.jqID(a.p.id)).hide()
  1408. }
  1409. },
  1410. Q = function (c) {
  1411. if (!a.grid.hDiv.loading) {
  1412. var d = a.p.scroll && !1 === c,
  1413. e = {},
  1414. g, f = a.p.prmNames;
  1415. 0 >= a.p.page && (a.p.page = Math.min(1, a.p.lastpage));
  1416. null !== f.search && (e[f.search] = a.p.search);
  1417. null !== f.nd && (e[f.nd] = (new Date).getTime());
  1418. null !== f.rows && (e[f.rows] = a.p.rowNum);
  1419. null !== f.page && (e[f.page] = a.p.page);
  1420. null !== f.sort && (e[f.sort] = a.p.sortname);
  1421. null !== f.order && (e[f.order] = a.p.sortorder);
  1422. null !== a.p.rowTotal && null !== f.totalrows && (e[f.totalrows] = a.p.rowTotal);
  1423. var h = b.isFunction(a.p.loadComplete),
  1424. k = h ? a.p.loadComplete : null,
  1425. l = 0;
  1426. c = c || 1;
  1427. 1 < c ? null !== f.npage ? (e[f.npage] = c, l = c - 1, c = 1) : k = function (b) {
  1428. a.p.page++;
  1429. a.grid.hDiv.loading = !1;
  1430. h && a.p.loadComplete.call(a, b);
  1431. Q(c - 1)
  1432. } : null !== f.npage && delete a.p.postData[f.npage];
  1433. if (a.p.grouping) {
  1434. b(a).jqGrid("groupingSetup");
  1435. var m = a.p.groupingView,
  1436. n, p = "";
  1437. for (n = 0; n < m.groupField.length; n++) {
  1438. var r = m.groupField[n];
  1439. b.each(a.p.colModel,
  1440. function (a, b) {
  1441. b.name === r && b.index && (r = b.index)
  1442. });
  1443. p += r + " " + m.groupOrder[n] + ", "
  1444. }
  1445. e[f.sort] = p + e[f.sort]
  1446. }
  1447. b.extend(a.p.postData, e);
  1448. var q = a.p.scroll ? a.rows.length - 1 : 1,
  1449. e = b(a).triggerHandler("jqGridBeforeRequest");
  1450. 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);
  1451. else {
  1452. if (b.isFunction(a.p.beforeRequest) && (e = a.p.beforeRequest.call(a), void 0 === e && (e = !0), !1 === e)) return;
  1453. g = a.p.datatype.toLowerCase();
  1454. switch (g) {
  1455. case "json":
  1456. case "jsonp":
  1457. case "xml":
  1458. case "script":
  1459. b.ajax(b.extend({
  1460. url:
  1461. a.p.url,
  1462. type: a.p.mtype,
  1463. dataType: g,
  1464. data: b.isFunction(a.p.serializeGridData) ? a.p.serializeGridData.call(a, a.p.postData) : a.p.postData,
  1465. success: function (e, f, h) {
  1466. if (e != null && e.costtime != null) {
  1467. a.p.costtime = e.costtime
  1468. }
  1469. if (b.isFunction(a.p.beforeProcessing) && !1 === a.p.beforeProcessing.call(a, e, f, h)) T();
  1470. else {
  1471. "xml" === g ? K(e, a.grid.bDiv, q, 1 < c, l) : Y(e, a.grid.bDiv, q, 1 < c, l);
  1472. b(a).triggerHandler("jqGridLoadComplete", [e]);
  1473. k && k.call(a, e);
  1474. b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
  1475. d && a.grid.populateVisible();
  1476. if (a.p.loadonce || a.p.treeGrid) a.p.datatype = "local";
  1477. 1 === c && T()
  1478. }
  1479. },
  1480. error: function (d, e, f) {
  1481. b.isFunction(a.p.loadError) && a.p.loadError.call(a, d, e, f);
  1482. 1 === c && T()
  1483. },
  1484. beforeSend: function (c, d) {
  1485. var e = !0;
  1486. b.isFunction(a.p.loadBeforeSend) && (e = a.p.loadBeforeSend.call(a, c, d));
  1487. void 0 === e && (e = !0);
  1488. if (!1 === e) return !1;
  1489. P()
  1490. }
  1491. },
  1492. b.jgrid.ajaxOptions, a.p.ajaxGridOptions));
  1493. break;
  1494. case "xmlstring":
  1495. P();
  1496. e = "string" !== typeof a.p.datastr ? a.p.datastr : b.parseXML(a.p.datastr);
  1497. K(e, a.grid.bDiv);
  1498. b(a).triggerHandler("jqGridLoadComplete", [e]);
  1499. h && a.p.loadComplete.call(a, e);
  1500. b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
  1501. a.p.datatype = "local";
  1502. a.p.datastr = null;
  1503. T();
  1504. break;
  1505. case "jsonstring":
  1506. P();
  1507. e = "string" === typeof a.p.datastr ? b.jgrid.parse(a.p.datastr) : a.p.datastr;
  1508. Y(e, a.grid.bDiv);
  1509. b(a).triggerHandler("jqGridLoadComplete", [e]);
  1510. h && a.p.loadComplete.call(a, e);
  1511. b(a).triggerHandler("jqGridAfterLoadComplete", [e]);
  1512. a.p.datatype = "local";
  1513. a.p.datastr = null;
  1514. T();
  1515. break;
  1516. case "local":
  1517. case "clientside":
  1518. P(),
  1519. a.p.datatype = "local",
  1520. e = oa(),
  1521. Y(e, a.grid.bDiv, q, 1 < c, l),
  1522. b(a).triggerHandler("jqGridLoadComplete", [e]),
  1523. k && k.call(a, e),
  1524. b(a).triggerHandler("jqGridAfterLoadComplete", [e]),
  1525. d && a.grid.populateVisible(),
  1526. T()
  1527. }
  1528. }
  1529. }
  1530. },
  1531. ha = function (c) {
  1532. b("#cb_" + b.jgrid.jqID(a.p.id), a.grid.hDiv)[a.p.useProp ? "prop" : "attr"]("checked", c);
  1533. 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)
  1534. },
  1535. qa = function (c, e) {
  1536. var d = "",
  1537. g = "<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
  1538. k = "",
  1539. l, m, n, p, q = function (c) {
  1540. var e;
  1541. b.isFunction(a.p.onPaging) && (e = a.p.onPaging.call(a, c));
  1542. if ("stop" === e) return !1;
  1543. a.p.selrow = null;
  1544. a.p.multiselect && (a.p.selarrrow = [], ha(!1));
  1545. a.p.savedRow = [];
  1546. return !0
  1547. };
  1548. c = c.substr(1);
  1549. e += "_" + c;
  1550. l = "pg_" + c;
  1551. m = c + "_left";
  1552. n = c + "_center";
  1553. p = c + "_right";
  1554. 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");
  1555. if (0 < a.p.rowList.length) {
  1556. k = "<td dir='" + f + "'>";
  1557. k += "<select class='ui-pg-selbox' role='listbox'>";
  1558. 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>";
  1559. k += "</select></td>"
  1560. }
  1561. "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);
  1562. "ltr" === f && (g += k);
  1563. 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>");
  1564. b("td#" + c + "_" + a.p.pagerpos, "#" + l).append(g);
  1565. k = b(".ui-jqgrid").css("font-size") || "11px";
  1566. b(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + k + ";visibility:hidden;' ></div>");
  1567. g = b(g).clone().appendTo("#testpg").width();
  1568. b("#testpg").remove();
  1569. 0 < g && ("" !== d && (g += 50), b("td#" + c + "_" + a.p.pagerpos, "#" + l).width(g - 25));
  1570. a.p._nvtd = [];
  1571. a.p._nvtd[0] = g ? Math.floor((a.p.width - g) / 2) : Math.floor(a.p.width / 3);
  1572. a.p._nvtd[1] = 0;
  1573. g = null;
  1574. b(".ui-pg-selbox", "#" + l).bind("change",
  1575. function () {
  1576. if (!q("records")) return !1;
  1577. a.p.page = Math.round(a.p.rowNum * (a.p.page - 1) / this.value - 0.5) + 1;
  1578. a.p.rowNum = this.value;
  1579. a.p.pager && b(".ui-pg-selbox", a.p.pager).val(this.value);
  1580. a.p.toppager && b(".ui-pg-selbox", a.p.toppager).val(this.value);
  1581. Q();
  1582. return !1
  1583. }); !0 === a.p.pgbuttons && (b(".ui-pg-button", "#" + l).hover(function () {
  1584. b(this).hasClass("ui-state-disabled") ? this.style.cursor = "default" : (b(this).addClass("ui-state-hover"), this.style.cursor = "pointer")
  1585. },
  1586. function () {
  1587. b(this).hasClass("ui-state-disabled") || (b(this).removeClass("ui-state-hover"), this.style.cursor = "default")
  1588. }), b("#first" + b.jgrid.jqID(e) + ", #prev" + b.jgrid.jqID(e) + ", #next" + b.jgrid.jqID(e) + ", #last" + b.jgrid.jqID(e)).click(function () {
  1589. if (b(this).hasClass("ui-state-disabled")) return !1;
  1590. var c = r(a.p.page, 1),
  1591. d = r(a.p.lastpage, 1),
  1592. g = !1,
  1593. f = !0,
  1594. h = !0,
  1595. k = !0,
  1596. l = !0;
  1597. 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);
  1598. if (!q(this.id)) return !1;
  1599. this.id === "first" + e && f && (a.p.page = 1, g = !0);
  1600. this.id === "prev" + e && h && (a.p.page = c - 1, g = !0);
  1601. this.id === "next" + e && k && (a.p.page = c + 1, g = !0);
  1602. this.id === "last" + e && l && (a.p.page = d, g = !0);
  1603. g && Q();
  1604. return !1
  1605. })); !0 === a.p.pginput && b("input.ui-pg-input", "#" + l).keypress(function (c) {
  1606. if (13 === (c.charCode || c.keyCode || 0)) {
  1607. if (!q("user")) return !1;
  1608. b(this).val(r(b(this).val(), 1));
  1609. a.p.page = 0 < b(this).val() ? b(this).val() : a.p.page;
  1610. Q();
  1611. return !1
  1612. }
  1613. return this
  1614. })
  1615. },
  1616. wa = function (c, e) {
  1617. var d, g = "",
  1618. f = a.p.colModel,
  1619. h = !1,
  1620. k;
  1621. k = a.p.frozenColumns ? e : a.grid.headers[c].el;
  1622. var l = "";
  1623. b("span.ui-grid-ico-sort", k).addClass("ui-state-disabled");
  1624. b(k).attr("aria-selected", "false");
  1625. if (f[c].lso) if ("asc" === f[c].lso) f[c].lso += "-desc",
  1626. l = "desc";
  1627. else if ("desc" === f[c].lso) f[c].lso += "-asc",
  1628. l = "asc";
  1629. else {
  1630. if ("asc-desc" === f[c].lso || "desc-asc" === f[c].lso) f[c].lso = ""
  1631. } else f[c].lso = l = f[c].firstsortorder || "asc";
  1632. 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();
  1633. a.p.sortorder = "";
  1634. b.each(f,
  1635. function (b) {
  1636. 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])
  1637. });
  1638. k = g.lastIndexOf(a.p.sortorder);
  1639. g = g.substring(0, k);
  1640. a.p.sortname = g
  1641. },
  1642. ra = function (c, d, e, g, f) {
  1643. if (a.p.colModel[d].sortable && !(0 < a.p.savedRow.length)) {
  1644. 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);
  1645. if (a.p.multiSort) wa(d, f);
  1646. else {
  1647. if (g) {
  1648. if (a.p.lastsort === d && a.p.sortorder === g && !e) return;
  1649. a.p.sortorder = g
  1650. }
  1651. e = a.grid.headers[a.p.lastsort].el;
  1652. f = a.p.frozenColumns ? f : a.grid.headers[d].el;
  1653. b("span.ui-grid-ico-sort", e).addClass("ui-state-disabled");
  1654. b(e).attr("aria-selected", "false");
  1655. 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"));
  1656. b("span.ui-icon-" + a.p.sortorder, f).removeClass("ui-state-disabled");
  1657. b(f).attr("aria-selected", "true");
  1658. 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());
  1659. c = c.substring(5 + a.p.id.length + 1);
  1660. a.p.sortname = a.p.colModel[d].index || c
  1661. }
  1662. "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 () {
  1663. b(this).trigger("click")
  1664. }), Q(), a.p.lastsort = d, a.p.sortname !== c && d && (a.p.lastsort = d))
  1665. }
  1666. },
  1667. xa = function (c) {
  1668. c = b(a.grid.headers[c].el);
  1669. c = [c.position().left + c.outerWidth()];
  1670. "rtl" === a.p.direction && (c[0] = a.p.width - c[0]);
  1671. c[0] -= a.grid.bDiv.scrollLeft;
  1672. c.push(b(a.grid.hDiv).position().top);
  1673. c.push(b(a.grid.bDiv).offset().top - b(a.grid.hDiv).offset().top + b(a.grid.bDiv).height());
  1674. return c
  1675. },
  1676. sa = function (c) {
  1677. var d, e = a.grid.headers,
  1678. g = b.jgrid.getCellIndex(c);
  1679. for (d = 0; d < e.length; d++) if (c === e[d].el) {
  1680. g = d;
  1681. break
  1682. }
  1683. return g
  1684. };
  1685. this.p.id = this.id; -1 === b.inArray(a.p.multikey, ["shiftKey", "altKey", "ctrlKey"]) && (a.p.multikey = !1);
  1686. a.p.keyIndex = !1;
  1687. a.p.keyName = !1;
  1688. for (g = 0; g < a.p.colModel.length; g++) a.p.colModel[g] = b.extend(!0, {},
  1689. a.p.cmTemplate, a.p.colModel[g].template || {},
  1690. a.p.colModel[g]),
  1691. !1 === a.p.keyIndex && !0 === a.p.colModel[g].key && (a.p.keyIndex = g);
  1692. a.p.sortorder = a.p.sortorder.toLowerCase();
  1693. 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);
  1694. if (!0 === this.p.treeGrid) {
  1695. try {
  1696. b(this).jqGrid("setTreeGrid")
  1697. } catch (za) { }
  1698. "local" !== a.p.datatype && (a.p.localReader = {
  1699. id: "_id_"
  1700. })
  1701. }
  1702. if (this.p.subGrid) try {
  1703. b(a).jqGrid("setSubGrid")
  1704. } catch (Aa) { }
  1705. this.p.multiselect && (this.p.colNames.unshift("<input role='checkbox' id='cb_" + this.p.id + "' class='cbox' type='checkbox'/>"), this.p.colModel.unshift({
  1706. name: "cb",
  1707. width: b.jgrid.cell_width ? a.p.multiselectWidth + a.p.cellLayout : a.p.multiselectWidth,
  1708. sortable: !1,
  1709. resizable: !1,
  1710. hidedlg: !0,
  1711. search: !1,
  1712. align: "center",
  1713. fixed: !0
  1714. }));
  1715. this.p.rownumbers && (this.p.colNames.unshift(""), this.p.colModel.unshift({
  1716. name: "rn",
  1717. width: a.p.rownumWidth,
  1718. sortable: !1,
  1719. resizable: !1,
  1720. hidedlg: !0,
  1721. search: !1,
  1722. align: "center",
  1723. fixed: !0
  1724. }));
  1725. a.p.xmlReader = b.extend(!0, {
  1726. root: "rows",
  1727. row: "row",
  1728. page: "rows>page",
  1729. total: "rows>total",
  1730. records: "rows>records",
  1731. repeatitems: !0,
  1732. cell: "cell",
  1733. id: "[id]",
  1734. userdata: "userdata",
  1735. subgrid: {
  1736. root: "rows",
  1737. row: "row",
  1738. repeatitems: !0,
  1739. cell: "cell"
  1740. }
  1741. },
  1742. a.p.xmlReader);
  1743. a.p.jsonReader = b.extend(!0, {
  1744. root: "rows",
  1745. page: "page",
  1746. total: "total",
  1747. records: "records",
  1748. repeatitems: !0,
  1749. cell: "cell",
  1750. id: "id",
  1751. userdata: "userdata",
  1752. subgrid: {
  1753. root: "rows",
  1754. repeatitems: !0,
  1755. cell: "cell"
  1756. }
  1757. },
  1758. a.p.jsonReader);
  1759. a.p.localReader = b.extend(!0, {
  1760. root: "rows",
  1761. page: "page",
  1762. total: "total",
  1763. records: "records",
  1764. repeatitems: !1,
  1765. cell: "cell",
  1766. id: "id",
  1767. userdata: "userdata",
  1768. subgrid: {
  1769. root: "rows",
  1770. repeatitems: !0,
  1771. cell: "cell"
  1772. }
  1773. },
  1774. a.p.localReader);
  1775. a.p.scroll && (a.p.pgbuttons = !1, a.p.pginput = !1, a.p.rowList = []);
  1776. a.p.data.length && O();
  1777. var D = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
  1778. ta, F, ja, fa, ka, y, t, ba, ua = ba = "",
  1779. ga = [],
  1780. va = [];
  1781. F = [];
  1782. 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) {
  1783. a.p.colModel[g].resizable = !1;
  1784. break
  1785. }
  1786. "horizontal" === a.p.viewsortcols[1] && (ba = " ui-i-asc", ua = " ui-i-desc");
  1787. ta = n ? "class='ui-th-div-ie'" : "";
  1788. 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>");
  1789. if (a.p.multiSort) for (ga = a.p.sortname.split(","), g = 0; g < ga.length; g++) F = b.trim(ga[g]).split(" "),
  1790. ga[g] = b.trim(F[0]),
  1791. va[g] = F[1] ? b.trim(F[1]) : a.p.sortorder || "asc";
  1792. var j = 0;
  1793. var o = 0;
  1794. for (g = 0; g < this.p.colNames.length; g++) {
  1795. var bb = a.p.colModel[g].hidden;
  1796. if (a.p.colModel[g].autowidth == true) {
  1797. o = g;
  1798. break
  1799. }
  1800. if (bb == undefined) {
  1801. o = g
  1802. }
  1803. }
  1804. for (g = 0; g < this.p.colNames.length; g++) {
  1805. var bb = a.p.colModel[g].hidden;
  1806. var bc = a.p.colModel[g].width;
  1807. if (bb != undefined) {
  1808. bc = 0
  1809. } else {
  1810. j += bc
  1811. }
  1812. if (g == o) {
  1813. if (b("#gview_" + a.p.id).width() > j) {
  1814. if (a.p.colModel[g].autowidth == true || a.p.colModel[g].autowidth == undefined) {
  1815. bc = bc + b("#gview_" + a.p.id).width() - j - 20
  1816. }
  1817. }
  1818. }
  1819. F = a.p.headertitles ? ' title="' + b.jgrid.stripHtml(a.p.colNames[g]) + '"' : "",
  1820. 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 + ">",
  1821. F = a.p.colModel[g].index || a.p.colModel[g].name,
  1822. D += "<div id='jqgh_" + a.p.id + "_" + a.p.colModel[g].name + "' " + ta + ">" + a.p.colNames[g],
  1823. a.p.colModel[g].width = bc ? parseInt(bc, 10) : 150,
  1824. "boolean" !== typeof a.p.colModel[g].title && (a.p.colModel[g].title = !0),
  1825. a.p.colModel[g].lso = "",
  1826. F === a.p.sortname && (a.p.lastsort = g),
  1827. a.p.multiSort && (F = b.inArray(F, ga), -1 !== F && (a.p.colModel[g].lso = va[F])),
  1828. D += ba + "</div></th>"
  1829. }
  1830. D += "</tr></thead>";
  1831. ba = null;
  1832. b(this).append(D);
  1833. function widthCount(a, b) {
  1834. return a
  1835. };
  1836. b("thead tr:first th", this).hover(function () { },
  1837. function () {
  1838. b(this).removeClass("ui-state-hover")
  1839. });
  1840. if (this.p.multiselect) {
  1841. var bd = [],
  1842. ca;
  1843. b("#cb_" + b.jgrid.jqID(a.p.id), this).bind("click",
  1844. function () {
  1845. a.p.selarrrow = [];
  1846. var c = !0 === a.p.frozenColumns ? a.p.id + "_frozen" : "";
  1847. this.checked ? (b(a.rows).each(function (d) {
  1848. 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")))
  1849. }), ca = !0, bd = []) : (b(a.rows).each(function (d) {
  1850. 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")))
  1851. }), a.p.selrow = null, ca = !1);
  1852. b(a).triggerHandler("jqGridSelectAll", [ca ? a.p.selarrrow : bd, ca]);
  1853. b.isFunction(a.p.onSelectAll) && a.p.onSelectAll.call(a, ca ? a.p.selarrrow : bd, ca)
  1854. })
  1855. } !0 === a.p.autowidth && (D = b(m).innerWidth(), a.p.width = 0 < D ? D : "nw"); (function () {
  1856. var d = 0,
  1857. e = b.jgrid.cell_width ? 0 : r(a.p.cellLayout, 0),
  1858. g = 0,
  1859. f,
  1860. h = r(a.p.scrollOffset, 0),
  1861. k,
  1862. m = !1,
  1863. n,
  1864. p = 0,
  1865. q;
  1866. b.each(a.p.colModel,
  1867. function () {
  1868. void 0 === this.hidden && (this.hidden = !1);
  1869. if (a.p.grouping && a.p.autowidth) {
  1870. var c = b.inArray(this.name, a.p.groupingView.groupField);
  1871. 0 <= c && a.p.groupingView.groupColumnShow.length > c && (this.hidden = !a.p.groupingView.groupColumnShow[c])
  1872. }
  1873. this.widthOrg = k = r(this.width, 0); !1 === this.hidden && (d += k + e, this.fixed ? p += k + e : g++)
  1874. });
  1875. isNaN(a.p.width) && (a.p.width = d + (!1 !== a.p.shrinkToFit || isNaN(a.p.height) ? 0 : h));
  1876. c.width = a.p.width;
  1877. 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,
  1878. function (b) {
  1879. !1 !== this.hidden || this.fixed || (this.width = k = Math.round(n * this.width / (a.p.tblwidth - e * g - p)), d += k, f = b)
  1880. }), 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))
  1881. })();
  1882. b(m).css("width", c.width + "px").append("<div class='ui-jqgrid-resize-mark' id='rs_m" + a.p.id + "'>&#160;</div>");
  1883. b(k).css("width", c.width + "px");
  1884. var D = b("thead:first", a).get(0),
  1885. V = "";
  1886. 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 + "'>");
  1887. var k = b("tr:first", D),
  1888. be = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
  1889. a.p.disableClick = !1;
  1890. b("th", k).each(function (d) {
  1891. ja = a.p.colModel[d].width;
  1892. void 0 === a.p.colModel[d].resizable && (a.p.colModel[d].resizable = !0);
  1893. 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 = "";
  1894. b(this).css("width", ja + "px").prepend(fa);
  1895. fa = null;
  1896. var e = "";
  1897. a.p.colModel[d].hidden && (b(this).css("display", "none"), e = "display:none;");
  1898. be += "<td role='gridcell' style='height:0px;width:" + ja + "px;" + e + "'></td>";
  1899. c.headers[d] = {
  1900. width: ja,
  1901. el: this
  1902. };
  1903. ka = a.p.colModel[d].sortable;
  1904. "boolean" !== typeof ka && (ka = a.p.colModel[d].sortable = !0);
  1905. e = a.p.colModel[d].name;
  1906. "cb" !== e && "subgrid" !== e && "rn" !== e && a.p.viewsortcols[2] && b(">div", this).addClass("ui-jqgrid-sortable");
  1907. 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")));
  1908. a.p.footerrow && (V += "<td role='gridcell' " + p(d, 0, "", null, "", !1) + ">&#160;</td>")
  1909. }).mousedown(function (d) {
  1910. if (1 === b(d.target).closest("th>span.ui-jqgrid-resize").length) {
  1911. var e = sa(this);
  1912. if (!0 === a.p.forceFit) {
  1913. var g = a.p,
  1914. f = e,
  1915. h;
  1916. for (h = e + 1; h < a.p.colModel.length; h++) if (!0 !== a.p.colModel[h].hidden) {
  1917. f = h;
  1918. break
  1919. }
  1920. g.nv = f - e
  1921. }
  1922. c.dragStart(e, d, xa(e));
  1923. return !1
  1924. }
  1925. }).click(function (c) {
  1926. if (a.p.disableClick) return a.p.disableClick = !1;
  1927. var d = "th>div.ui-jqgrid-sortable",
  1928. e, g;
  1929. a.p.viewsortcols[2] || (d = "th>div>span>span.ui-grid-ico-sort");
  1930. c = b(c.target).closest(d);
  1931. if (1 === c.length) {
  1932. var f;
  1933. if (a.p.frozenColumns) {
  1934. var h = b(this)[0].id.substring(a.p.id.length + 1);
  1935. b(a.p.colModel).each(function (a) {
  1936. if (this.name === h) return f = a,
  1937. !1
  1938. })
  1939. } else f = sa(this);
  1940. a.p.viewsortcols[2] || (e = !0, g = c.attr("sort"));
  1941. null != f && ra(b("div", this)[0].id, f, e, g, this);
  1942. return !1
  1943. }
  1944. });
  1945. if (a.p.sortable && b.fn.sortable) try {
  1946. b(a).jqGrid("sortableColumns", k)
  1947. } catch (Ba) { }
  1948. a.p.footerrow && (V += "</tr></tbody></table>");
  1949. be += "</tr>";
  1950. k = document.createElement("tbody");
  1951. this.appendChild(k);
  1952. b(this).addClass("ui-jqgrid-btable").append(be);
  1953. var be = null,
  1954. 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),
  1955. J = a.p.caption && !0 === a.p.hiddengrid ? !0 : !1;
  1956. g = b("<div class='ui-jqgrid-hbox" + ("rtl" === f ? "-rtl" : "") + "'><div class='edit_items' title='编辑显示字段'>...</div></div>");
  1957. D = null;
  1958. c.hDiv = document.createElement("div");
  1959. b(c.hDiv).css({
  1960. width: c.width + "px"
  1961. }).addClass("ui-state-default ui-jqgrid-hdiv").append(g);
  1962. b(g).append(k);
  1963. k = null;
  1964. J && b(c.hDiv).hide();
  1965. 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({
  1966. width: c.width + "px"
  1967. }).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",
  1968. function (a) {
  1969. t = b(a.target).closest("tr.jqgrow");
  1970. "ui-subgrid" !== b(t).attr("class") && b(t).addClass("ui-state-hover")
  1971. }).bind("mouseout",
  1972. function (a) {
  1973. t = b(a.target).closest("tr.jqgrow");
  1974. b(t).removeClass("ui-state-hover")
  1975. });
  1976. var B, N, ma;
  1977. b(a).before(c.hDiv).click(function (c) {
  1978. y = c.target;
  1979. t = b(y, a.rows).closest("tr.jqgrow");
  1980. 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;
  1981. var d = b(y).hasClass("cbox"),
  1982. 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));
  1983. 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);
  1984. else {
  1985. B = t[0].rowIndex;
  1986. try {
  1987. b(a).jqGrid("editCell", B, N, !0)
  1988. } catch (g) { }
  1989. } 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));
  1990. else {
  1991. if (a.p.multiselect && a.p.multiboxonly && !d) {
  1992. var f = a.p.frozenColumns ? a.p.id + "_frozen" : "";
  1993. b(a.p.selarrrow).each(function (c, d) {
  1994. var e = b(a).jqGrid("getGridRowById", d);
  1995. b(e).removeClass("ui-state-highlight");
  1996. b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(d))[a.p.useProp ? "prop" : "attr"]("checked", !1);
  1997. 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))
  1998. });
  1999. a.p.selarrrow = []
  2000. }
  2001. b(a).jqGrid("setSelection", B, !0, c)
  2002. }
  2003. }).bind("reloadGrid",
  2004. function (c, d) {
  2005. !0 === a.p.treeGrid && (a.p.datatype = a.p.treedatatype);
  2006. d && d.current && a.grid.selectionPreserver(a);
  2007. "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 = []);
  2008. a.p.scroll && X.call(a, !0, !1);
  2009. if (d && d.page) {
  2010. var e = d.page;
  2011. e > a.p.lastpage && (e = a.p.lastpage);
  2012. 1 > e && (e = 1);
  2013. a.p.page = e;
  2014. a.grid.bDiv.scrollTop = a.grid.prevRowHeight ? (e - 1) * a.grid.prevRowHeight * a.p.rowNum : 0
  2015. }
  2016. a.grid.prevRowHeight && a.p.scroll ? (delete a.p.lastpage, a.grid.populateVisible()) : a.grid.populate(); !0 === a.p._inlinenav && b(a).jqGrid("showAddEditButtons");
  2017. return !1
  2018. }).dblclick(function (c) {
  2019. y = c.target;
  2020. t = b(y, a.rows).closest("tr.jqgrow");
  2021. 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))
  2022. }).bind("contextmenu",
  2023. function (c) { });
  2024. c.bDiv = document.createElement("div");
  2025. n && "auto" === String(a.p.height).toLowerCase() && (a.p.height = "100%");
  2026. 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({
  2027. height: a.p.height + (isNaN(a.p.height) ? "" : "px"),
  2028. width: c.width + "px"
  2029. }).scroll(c.scrollGrid);
  2030. b("table:first", c.bDiv).css({
  2031. width: a.p.tblwidth + "px"
  2032. });
  2033. b.support.tbody || 2 === b("tbody", this).length && b("tbody:gt(0)", this).remove();
  2034. a.p.multikey && (b.jgrid.msie ? b(c.bDiv).bind("selectstart",
  2035. function () {
  2036. return !1
  2037. }) : b(c.bDiv).bind("mousedown",
  2038. function () {
  2039. return !1
  2040. }));
  2041. J && b(c.bDiv).hide();
  2042. c.cDiv = document.createElement("div");
  2043. var bf = !0 === a.p.hidegrid ? b("<a role='link' class='ui-jqgrid-titlebar-close ui-corner-all HeaderButton' />").hover(function () {
  2044. bf.addClass("ui-state-hover")
  2045. },
  2046. function () {
  2047. bf.removeClass("ui-state-hover")
  2048. }).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl" === f ? "left" : "right", "0px") : "";
  2049. 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");
  2050. b(c.cDiv).insertBefore(c.hDiv);
  2051. 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());
  2052. 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"));
  2053. 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());
  2054. g = null;
  2055. if (a.p.caption) {
  2056. var bg = a.p.datatype; !0 === a.p.hidegrid && (b(".ui-jqgrid-titlebar-close", c.cDiv).click(function (d) {
  2057. var e = b.isFunction(a.p.onHeaderClick),
  2058. g = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
  2059. f,
  2060. h = this; !0 === a.p.toolbar[0] && ("both" === a.p.toolbar[1] && (g += ", #" + b(c.ubDiv).attr("id")), g += ", #" + b(c.uDiv).attr("id"));
  2061. f = b(g, "#gview_" + b.jgrid.jqID(a.p.id)).length;
  2062. "visible" === a.p.gridstate ? b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideUp("fast",
  2063. function () {
  2064. f--;
  2065. 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)))
  2066. }) : "hidden" === a.p.gridstate && b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideDown("fast",
  2067. function () {
  2068. f--;
  2069. 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)))
  2070. });
  2071. return !1
  2072. }), J && (a.p.datatype = "local", b(".ui-jqgrid-titlebar-close", c.cDiv).trigger("click")))
  2073. } else b(c.cDiv).hide();
  2074. b(c.hDiv).after(c.bDiv).mousemove(function (a) {
  2075. if (c.resizing) return c.dragMove(a),
  2076. !1
  2077. });
  2078. b(".ui-jqgrid-labels", c.hDiv).bind("selectstart",
  2079. function () {
  2080. return !1
  2081. });
  2082. b(document).bind("mouseup.jqGrid" + a.p.id,
  2083. function () {
  2084. return c.resizing ? (c.dragEnd(), !1) : !0
  2085. });
  2086. a.formatCol = p;
  2087. a.sortData = ra;
  2088. a.updatepager = function (c, d) {
  2089. var e, g, f, h, k, l, m, n = "",
  2090. p = a.p.pager ? "_" + b.jgrid.jqID(a.p.pager.substr(1)) : "",
  2091. q = a.p.toppager ? "_" + a.p.toppager.substr(1) : "";
  2092. f = parseInt(a.p.page, 10) - 1;
  2093. 0 > f && (f = 0);
  2094. f *= parseInt(a.p.rowNum, 10);
  2095. k = f + a.p.reccount;
  2096. if (a.p.scroll) {
  2097. e = b("tbody:first > tr:gt(0)", a.grid.bDiv);
  2098. f = k - e.length;
  2099. a.p.reccount = e.length;
  2100. if (e = e.outerHeight() || a.grid.prevRowHeight) g = f * e,
  2101. m = parseInt(a.p.records, 10) * e,
  2102. b(">div:first", a.grid.bDiv).css({
  2103. height: m
  2104. }).children("div:first").css({
  2105. height: g,
  2106. display: g ? "" : "none"
  2107. }),
  2108. 0 == a.grid.bDiv.scrollTop && 1 < a.p.page && (a.grid.bDiv.scrollTop = a.p.rowNum * (a.p.page - 1) * e);
  2109. a.grid.bDiv.scrollLeft = a.grid.hDiv.scrollLeft
  2110. }
  2111. n = a.p.pager || "";
  2112. if (n += a.p.toppager ? n ? "," + a.p.toppager : a.p.toppager : "") m = b.jgrid.formatter.integer || {},
  2113. e = r(a.p.page),
  2114. g = r(a.p.lastpage),
  2115. b(".selbox", n)[this.p.useProp ? "prop" : "attr"]("disabled", !1),
  2116. !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)),
  2117. 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)))))),
  2118. !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) {
  2119. b(this).html(f + 1 + a)
  2120. });
  2121. d && a.p.jqgdnd && b(a).jqGrid("gridDnD", "updateDnD");
  2122. b(a).triggerHandler("jqGridGridComplete");
  2123. b.isFunction(a.p.gridComplete) && a.p.gridComplete.call(a);
  2124. b(a).triggerHandler("jqGridAfterGridComplete")
  2125. };
  2126. a.refreshIndex = O;
  2127. a.setHeadCheckBox = ha;
  2128. a.constructTr = $;
  2129. a.formatter = function (a, b, c, d, e) {
  2130. return x(a, b, c, d, e)
  2131. };
  2132. b.extend(c, {
  2133. populate: Q,
  2134. emptyRows: X,
  2135. beginReq: P,
  2136. endReq: T
  2137. });
  2138. this.grid = c;
  2139. a.addXmlData = function (b) {
  2140. K(b, a.grid.bDiv)
  2141. };
  2142. a.addJSONData = function (b) {
  2143. Y(b, a.grid.bDiv)
  2144. };
  2145. this.grid.cols = this.rows[0].cells;
  2146. b(a).triggerHandler("jqGridInitGrid");
  2147. b.isFunction(a.p.onInitGrid) && a.p.onInitGrid.call(a);
  2148. Q();
  2149. a.p.hiddengrid = !1
  2150. }
  2151. }
  2152. }
  2153. })
  2154. };
  2155. b.jgrid.extend({
  2156. getGridParam: function (b) {
  2157. var f = this[0];
  2158. if (f && f.grid) return b ? void 0 !== f.p[b] ? f.p[b] : null : f.p
  2159. },
  2160. setGridParam: function (e) {
  2161. return this.each(function () {
  2162. this.grid && "object" === typeof e && b.extend(!0, this.p, e)
  2163. })
  2164. },
  2165. getGridRowById: function (e) {
  2166. var f;
  2167. this.each(function () {
  2168. try {
  2169. for (var c = this.rows.length; c--;) if (e.toString() === this.rows[c].id) {
  2170. f = this.rows[c];
  2171. break
  2172. }
  2173. } catch (d) {
  2174. f = b(this.grid.bDiv).find("#" + b.jgrid.jqID(e))
  2175. }
  2176. });
  2177. return f
  2178. },
  2179. getDataIDs: function () {
  2180. var e = [],
  2181. f = 0,
  2182. c,
  2183. d = 0;
  2184. this.each(function () {
  2185. if ((c = this.rows.length) && 0 < c) for (; f < c;) b(this.rows[f]).hasClass("jqgrow") && (e[d] = this.rows[f].id, d++),
  2186. f++
  2187. });
  2188. return e
  2189. },
  2190. setSelection: function (e, f, c) {
  2191. return this.each(function () {
  2192. var d, a, l, g, h, k;
  2193. 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({
  2194. "aria-selected": "false",
  2195. tabindex: "-1"
  2196. }), b(a).addClass("ui-state-highlight").attr({
  2197. "aria-selected": "true",
  2198. tabindex: "0"
  2199. }), 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)))))
  2200. })
  2201. },
  2202. resetSelection: function (e) {
  2203. return this.each(function () {
  2204. var f = this,
  2205. c, d; !0 === f.p.frozenColumns && (d = f.p.id + "_frozen");
  2206. if (void 0 !== e) {
  2207. c = e === f.p.selrow ? f.p.selrow : e;
  2208. b("#" + b.jgrid.jqID(f.p.id) + " tbody:first tr#" + b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
  2209. d && b("#" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight");
  2210. if (f.p.multiselect) {
  2211. 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);
  2212. 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);
  2213. f.setHeadCheckBox(!1)
  2214. }
  2215. c = null
  2216. } else f.p.multiselect ? (b(f.p.selarrrow).each(function (a, c) {
  2217. b(b(f).jqGrid("getGridRowById", c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
  2218. b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c))[f.p.useProp ? "prop" : "attr"]("checked", !1);
  2219. 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))
  2220. }), 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"));
  2221. f.p.savedRow = []
  2222. })
  2223. },
  2224. getRowData: function (e) {
  2225. var f = {},
  2226. c, d = !1,
  2227. a, l = 0;
  2228. this.each(function () {
  2229. var g = this,
  2230. h, k;
  2231. if (void 0 === e) d = !0,
  2232. c = [],
  2233. a = g.rows.length;
  2234. else {
  2235. k = b(g).jqGrid("getGridRowById", e);
  2236. if (!k) return f;
  2237. a = 2
  2238. }
  2239. for (; l < a;) d && (k = g.rows[l]),
  2240. b(k).hasClass("jqgrow") && (b('td[role="gridcell"]', k).each(function (a) {
  2241. h = g.p.colModel[a].name;
  2242. 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());
  2243. else try {
  2244. f[h] = b.unformat.call(g, this, {
  2245. rowId: k.id,
  2246. colModel: g.p.colModel[a]
  2247. },
  2248. a)
  2249. } catch (c) {
  2250. f[h] = b.jgrid.htmlDecode(b(this).html())
  2251. }
  2252. }), d && (c.push(f), f = {})),
  2253. l++
  2254. });
  2255. return c || f
  2256. },
  2257. delRowData: function (e) {
  2258. var f = !1,
  2259. c, d;
  2260. this.each(function () {
  2261. c = b(this).jqGrid("getGridRowById", e);
  2262. if (!c) return !1;
  2263. b(c).remove();
  2264. this.p.records--;
  2265. this.p.reccount--;
  2266. this.updatepager(!0, !1);
  2267. f = !0;
  2268. this.p.multiselect && (d = b.inArray(e, this.p.selarrrow), -1 !== d && this.p.selarrrow.splice(d, 1));
  2269. this.p.selrow = this.p.multiselect && 0 < this.p.selarrrow.length ? this.p.selarrrow[this.p.selarrrow.length - 1] : null;
  2270. if ("local" === this.p.datatype) {
  2271. var a = b.jgrid.stripPref(this.p.idPrefix, e),
  2272. a = this.p._index[a];
  2273. void 0 !== a && (this.p.data.splice(a, 1), this.refreshIndex())
  2274. }
  2275. if (!0 === this.p.altRows && f) {
  2276. var l = this.p.altclass;
  2277. b(this.rows).each(function (a) {
  2278. 1 === a % 2 ? b(this).addClass(l) : b(this).removeClass(l)
  2279. })
  2280. }
  2281. });
  2282. return f
  2283. },
  2284. setRowData: function (e, f, c) {
  2285. var d, a = !0,
  2286. l;
  2287. this.each(function () {
  2288. if (!this.grid) return !1;
  2289. var g = this,
  2290. h, k, n = typeof c,
  2291. m = {};
  2292. k = b(this).jqGrid("getGridRowById", e);
  2293. if (!k) return !1;
  2294. if (f) try {
  2295. if (b(this.p.colModel).each(function (a) {
  2296. d = this.name;
  2297. var c = b.jgrid.getAccessor(f, d);
  2298. 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 ? {
  2299. title: b.jgrid.stripHtml(h)
  2300. } : {},
  2301. !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))
  2302. }), "local" === g.p.datatype) {
  2303. var r = b.jgrid.stripPref(g.p.idPrefix, e),
  2304. p = g.p._index[r],
  2305. q;
  2306. if (g.p.treeGrid) for (q in g.p.treeReader) g.p.treeReader.hasOwnProperty(q) && delete m[g.p.treeReader[q]];
  2307. void 0 !== p && (g.p.data[p] = b.extend(!0, g.p.data[p], m));
  2308. m = null
  2309. }
  2310. } catch (x) {
  2311. a = !1
  2312. }
  2313. a && ("string" === n ? b(k).addClass(c) : null !== c && "object" === n && b(k).css(c), b(g).triggerHandler("jqGridAfterGridComplete"))
  2314. });
  2315. return a
  2316. },
  2317. addRowData: function (e, f, c, d) {
  2318. c || (c = "last");
  2319. var a = !1,
  2320. l, g, h, k, n, m, r, p, q = "",
  2321. x, G, U, M, ea, W;
  2322. f && (b.isArray(f) ? (x = !0, c = "last", G = e) : (f = [f], x = !1), this.each(function () {
  2323. var X = f.length;
  2324. n = !0 === this.p.rownumbers ? 1 : 0;
  2325. h = !0 === this.p.multiselect ? 1 : 0;
  2326. k = !0 === this.p.subGrid ? 1 : 0;
  2327. 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]))));
  2328. U = this.p.altclass;
  2329. for (var O = 0,
  2330. $ = "",
  2331. K = {},
  2332. Y = b.isFunction(this.p.afterInsertRow) ? !0 : !1; O < X;) {
  2333. M = f[O];
  2334. g = [];
  2335. if (x) {
  2336. try {
  2337. e = M[G],
  2338. void 0 === e && (e = b.jgrid.randId())
  2339. } catch (oa) {
  2340. e = b.jgrid.randId()
  2341. }
  2342. $ = !0 === this.p.altRows ? 0 === (this.rows.length - 1) % 2 ? U : "" : ""
  2343. }
  2344. W = e;
  2345. e = this.p.idPrefix + e;
  2346. n && (q = this.formatCol(0, 1, "", null, e, !0), g[g.length] = '<td role="gridcell" class="ui-state-default jqgrid-rownum" ' + q + ">0</td>");
  2347. 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>");
  2348. k && (g[g.length] = b(this).jqGrid("addSubGridCell", h + n, 1));
  2349. for (r = h + k + n; r < this.p.colModel.length; r++) ea = this.p.colModel[r],
  2350. l = ea.name,
  2351. K[l] = M[l],
  2352. p = this.formatter(e, b.jgrid.getAccessor(M, l), r, M),
  2353. q = this.formatCol(r, 1, p, M, e, K),
  2354. g[g.length] = '<td role="gridcell" ' + q + ">" + p + "</td>";
  2355. g.unshift(this.constructTr(e, !1, $, K, M, !1));
  2356. g[g.length] = "</tr>";
  2357. if (0 === this.rows.length) b("table:first", this.grid.bDiv).append(g.join(""));
  2358. else switch (c) {
  2359. case "last":
  2360. b(this.rows[this.rows.length - 1]).after(g.join(""));
  2361. m = this.rows.length - 1;
  2362. break;
  2363. case "first":
  2364. b(this.rows[0]).after(g.join(""));
  2365. m = 1;
  2366. break;
  2367. case "after":
  2368. 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("")),
  2369. m = m.rowIndex + 1;
  2370. break;
  2371. case "before":
  2372. if (m = b(this).jqGrid("getGridRowById", d)) b(m).before(g.join("")),
  2373. m = m.rowIndex - 1
  2374. } !0 === this.p.subGrid && b(this).jqGrid("addSubGrid", h + n, m);
  2375. this.p.records++;
  2376. this.p.reccount++;
  2377. b(this).triggerHandler("jqGridAfterInsertRow", [e, M, M]);
  2378. Y && this.p.afterInsertRow.call(this, e, M, M);
  2379. O++;
  2380. "local" === this.p.datatype && (K[this.p.localReader.id] = W, this.p._index[W] = this.p.data.length, this.p.data.push(K), K = {})
  2381. } !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) {
  2382. 1 === a % 2 ? b(this).addClass(U) : b(this).removeClass(U)
  2383. }));
  2384. this.updatepager(!0, !0);
  2385. a = !0
  2386. }));
  2387. return a
  2388. },
  2389. footerData: function (e, f, c) {
  2390. function d(a) {
  2391. for (var b in a) if (a.hasOwnProperty(b)) return !1;
  2392. return !0
  2393. }
  2394. var a, l = !1,
  2395. g = {},
  2396. h;
  2397. void 0 == e && (e = "get");
  2398. "boolean" !== typeof c && (c = !0);
  2399. e = e.toLowerCase();
  2400. this.each(function () {
  2401. var k = this,
  2402. n;
  2403. if (!k.grid || !k.p.footerrow || "set" === e && d(f)) return !1;
  2404. l = !0;
  2405. b(this.p.colModel).each(function (d) {
  2406. a = this.name;
  2407. "set" === e ? void 0 !== f[a] && (n = c ? k.formatter("", f[a], d, f, "edit") : f[a], h = this.title ? {
  2408. title: b.jgrid.stripHtml(n)
  2409. } : {},
  2410. 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())
  2411. })
  2412. });
  2413. return "get" === e ? g : l
  2414. },
  2415. showHideCol: function (e, f) {
  2416. return this.each(function () {
  2417. var c = this,
  2418. d = !1,
  2419. a = b.jgrid.cell_width ? 0 : c.p.cellLayout,
  2420. l;
  2421. if (c.grid) {
  2422. "string" === typeof e && (e = [e]);
  2423. f = "none" !== f ? "" : "none";
  2424. var g = "" === f ? !0 : !1,
  2425. h = c.p.groupHeader && ("object" === typeof c.p.groupHeader || b.isFunction(c.p.groupHeader));
  2426. h && b(c).jqGrid("destroyGroupHeader", !1);
  2427. b(this.p.colModel).each(function (h) {
  2428. if (-1 !== b.inArray(this.name, e) && this.hidden === g) {
  2429. if (!0 === c.p.frozenColumns && !0 === this.frozen) return !0;
  2430. b("tr[role=rowheader]", c.grid.hDiv).each(function () {
  2431. b(this.cells[h]).css("display", f)
  2432. });
  2433. b(c.rows).each(function () {
  2434. b(this).hasClass("jqgroup") || b(this.cells[h]).css("display", f)
  2435. });
  2436. c.p.footerrow && b("tr.footrow td:eq(" + h + ")", c.grid.sDiv).css("display", f);
  2437. l = parseInt(this.width, 10);
  2438. c.p.tblwidth = "none" === f ? c.p.tblwidth - (l + a) : c.p.tblwidth + (l + a);
  2439. this.hidden = !g;
  2440. d = !0;
  2441. b(c).triggerHandler("jqGridShowHideCol", [g, this.name, h])
  2442. }
  2443. }); !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));
  2444. h && b(c).jqGrid("setGroupHeaders", c.p.groupHeader)
  2445. }
  2446. })
  2447. },
  2448. hideCol: function (e) {
  2449. return this.each(function () {
  2450. b(this).jqGrid("showHideCol", e, "none")
  2451. })
  2452. },
  2453. showCol: function (e) {
  2454. return this.each(function () {
  2455. b(this).jqGrid("showHideCol", e, "")
  2456. })
  2457. },
  2458. remapColumns: function (e, f, c) {
  2459. function d(a) {
  2460. var c;
  2461. c = a.length ? b.makeArray(a) : b.extend({},
  2462. a);
  2463. b.each(e,
  2464. function (b) {
  2465. a[b] = c[this]
  2466. })
  2467. }
  2468. function a(a, c) {
  2469. b(">tr" + (c || ""), a).each(function () {
  2470. var a = this,
  2471. c = b.makeArray(a.cells);
  2472. b.each(e,
  2473. function () {
  2474. var b = c[this];
  2475. b && a.appendChild(b)
  2476. })
  2477. })
  2478. }
  2479. var l = this.get(0);
  2480. d(l.p.colModel);
  2481. d(l.p.colNames);
  2482. d(l.grid.headers);
  2483. a(b("thead:first", l.grid.hDiv), c && ":not(.ui-jqgrid-labels)");
  2484. f && a(b("#" + b.jgrid.jqID(l.p.id) + " tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
  2485. l.p.footerrow && a(b("tbody:first", l.grid.sDiv));
  2486. l.p.remapColumns && (l.p.remapColumns.length ? d(l.p.remapColumns) : l.p.remapColumns = b.makeArray(e));
  2487. l.p.lastsort = b.inArray(l.p.lastsort, e);
  2488. l.p.treeGrid && (l.p.expColInd = b.inArray(l.p.expColInd, e));
  2489. b(l).triggerHandler("jqGridRemapColumns", [e, f, c])
  2490. },
  2491. setGridWidth: function (e, f) {
  2492. return this.each(function () {
  2493. if (this.grid) {
  2494. var c = this,
  2495. d, a = 0,
  2496. l = b.jgrid.cell_width ? 0 : c.p.cellLayout,
  2497. g,
  2498. h = 0,
  2499. k = !1,
  2500. n = c.p.scrollOffset,
  2501. m,
  2502. r = 0,
  2503. p;
  2504. "boolean" !== typeof f && (f = c.p.shrinkToFit);
  2505. if (!isNaN(e)) {
  2506. e = parseInt(e, 10);
  2507. c.grid.width = c.p.width = e;
  2508. b("#gbox_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
  2509. b("#gview_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
  2510. b(c.grid.bDiv).css("width", e + "px");
  2511. b(c.grid.hDiv).css("width", e + "px");
  2512. c.p.pager && b(c.p.pager).css("width", e + "px");
  2513. 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"));
  2514. c.p.footerrow && b(c.grid.sDiv).css("width", e + "px"); !1 === f && !0 === c.p.forceFit && (c.p.forceFit = !1);
  2515. if (!0 === f) {
  2516. b.each(c.p.colModel,
  2517. function () {
  2518. !1 === this.hidden && (d = this.widthOrg, a += d + l, this.fixed ? r += d + l : h++)
  2519. });
  2520. if (0 === h) return;
  2521. c.p.tblwidth = a;
  2522. 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);
  2523. var a = 0,
  2524. q = 0 < c.grid.cols.length;
  2525. b.each(c.p.colModel,
  2526. function (b) {
  2527. !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))
  2528. });
  2529. if (!g) return;
  2530. p = 0;
  2531. 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));
  2532. c.p.colModel[g].width += p;
  2533. c.p.tblwidth = a + p + l * h + r;
  2534. 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;
  2535. c.grid.headers[g].width = d;
  2536. c.grid.headers[g].el.style.width = d + "px";
  2537. q && (c.grid.cols[g].style.width = d + "px");
  2538. c.p.footerrow && (c.grid.footers[g].style.width = d + "px")
  2539. }
  2540. 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"))
  2541. }
  2542. }
  2543. })
  2544. },
  2545. setGridHeight: function (e) {
  2546. return this.each(function () {
  2547. if (this.grid) {
  2548. var f = b(this.grid.bDiv);
  2549. f.css({
  2550. height: e + (isNaN(e) ? "" : "px")
  2551. }); !0 === this.p.frozenColumns && b("#" + b.jgrid.jqID(this.p.id) + "_frozen").parent().height(f.height() - 16);
  2552. this.p.height = e;
  2553. this.p.scroll && this.grid.populateVisible()
  2554. }
  2555. })
  2556. },
  2557. setCaption: function (e) {
  2558. return this.each(function () {
  2559. this.p.caption = e;
  2560. b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl", this.grid.cDiv).html(e);
  2561. b(this.grid.cDiv).show()
  2562. })
  2563. },
  2564. setLabel: function (e, f, c, d) {
  2565. return this.each(function () {
  2566. var a = -1;
  2567. if (this.grid && void 0 !== e && (b(this.p.colModel).each(function (b) {
  2568. if (this.name === e) return a = b,
  2569. !1
  2570. }), 0 <= a)) {
  2571. var l = b("tr.ui-jqgrid-labels th:eq(" + a + ")", this.grid.hDiv);
  2572. if (f) {
  2573. var g = b(".s-ico", l);
  2574. b("[id^=jqgh_]", l).empty().html(f).append(g);
  2575. this.p.colNames[a] = f
  2576. }
  2577. c && ("string" === typeof c ? b(l).addClass(c) : b(l).css(c));
  2578. "object" === typeof d && b(l).attr(d)
  2579. }
  2580. })
  2581. },
  2582. setCell: function (e, f, c, d, a, l) {
  2583. return this.each(function () {
  2584. var g = -1,
  2585. h, k;
  2586. if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
  2587. if (this.name === f) return g = a,
  2588. !1
  2589. }) : g = parseInt(f, 10), 0 <= g && (h = b(this).jqGrid("getGridRowById", e)))) {
  2590. var n = b("td:eq(" + g + ")", h);
  2591. if ("" !== c || !0 === l) h = this.formatter(e, c, g, h, "edit"),
  2592. k = this.p.colModel[g].title ? {
  2593. title: b.jgrid.stripHtml(h)
  2594. } : {},
  2595. this.p.treeGrid && 0 < b(".tree-wrap", b(n)).length ? b("span", b(n)).html(h).attr(k) : b(n).html(h).attr(k),
  2596. "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));
  2597. "string" === typeof d ? b(n).addClass(d) : d && b(n).css(d);
  2598. "object" === typeof a && b(n).attr(a)
  2599. }
  2600. })
  2601. },
  2602. getCell: function (e, f) {
  2603. var c = !1;
  2604. this.each(function () {
  2605. var d = -1;
  2606. if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
  2607. if (this.name === f) return d = a,
  2608. !1
  2609. }) : d = parseInt(f, 10), 0 <= d)) {
  2610. var a = b(this).jqGrid("getGridRowById", e);
  2611. if (a) try {
  2612. c = b.unformat.call(this, b("td:eq(" + d + ")", a), {
  2613. rowId: a.id,
  2614. colModel: this.p.colModel[d]
  2615. },
  2616. d)
  2617. } catch (l) {
  2618. c = b.jgrid.htmlDecode(b("td:eq(" + d + ")", a).html())
  2619. }
  2620. }
  2621. });
  2622. return c
  2623. },
  2624. getCol: function (e, f, c) {
  2625. var d = [],
  2626. a,
  2627. l = 0,
  2628. g,
  2629. h,
  2630. k;
  2631. f = "boolean" !== typeof f ? !1 : f;
  2632. void 0 === c && (c = !1);
  2633. this.each(function () {
  2634. var n = -1;
  2635. if (this.grid && (isNaN(e) ? b(this.p.colModel).each(function (a) {
  2636. if (this.name === e) return n = a,
  2637. !1
  2638. }) : n = parseInt(e, 10), 0 <= n)) {
  2639. var m = this.rows.length,
  2640. r = 0,
  2641. p = 0;
  2642. if (m && 0 < m) {
  2643. for (; r < m;) {
  2644. if (b(this.rows[r]).hasClass("jqgrow")) {
  2645. try {
  2646. a = b.unformat.call(this, b(this.rows[r].cells[n]), {
  2647. rowId: this.rows[r].id,
  2648. colModel: this.p.colModel[n]
  2649. },
  2650. n)
  2651. } catch (q) {
  2652. a = b.jgrid.htmlDecode(this.rows[r].cells[n].innerHTML)
  2653. }
  2654. 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({
  2655. id: this.rows[r].id,
  2656. value: a
  2657. }) : d.push(a)
  2658. }
  2659. r++
  2660. }
  2661. if (c) switch (c.toLowerCase()) {
  2662. case "sum":
  2663. d = l;
  2664. break;
  2665. case "avg":
  2666. d = l / p;
  2667. break;
  2668. case "count":
  2669. d = m - 1;
  2670. break;
  2671. case "min":
  2672. d = g;
  2673. break;
  2674. case "max":
  2675. d = h
  2676. }
  2677. }
  2678. }
  2679. });
  2680. return d
  2681. },
  2682. clearGridData: function (e) {
  2683. return this.each(function () {
  2684. if (this.grid) {
  2685. "boolean" !== typeof e && (e = !1);
  2686. if (this.p.deepempty) b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:gt(0)").remove();
  2687. else {
  2688. var f = b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:first")[0];
  2689. b("#" + b.jgrid.jqID(this.p.id) + " tbody:first").empty().append(f)
  2690. }
  2691. this.p.footerrow && e && b(".ui-jqgrid-ftable td", this.grid.sDiv).html("&#160;");
  2692. this.p.selrow = null;
  2693. this.p.selarrrow = [];
  2694. this.p.savedRow = [];
  2695. this.p.records = 0;
  2696. this.p.page = 1;
  2697. this.p.lastpage = 0;
  2698. this.p.reccount = 0;
  2699. this.p.data = [];
  2700. this.p._index = {};
  2701. this.updatepager(!0, !1)
  2702. }
  2703. })
  2704. },
  2705. getInd: function (e, f) {
  2706. var c = !1,
  2707. d;
  2708. this.each(function () {
  2709. (d = b(this).jqGrid("getGridRowById", e)) && (c = !0 === f ? d : d.rowIndex)
  2710. });
  2711. return c
  2712. },
  2713. bindKeys: function (e) {
  2714. var f = b.extend({
  2715. onEnter: null,
  2716. onSpace: null,
  2717. onLeftKey: null,
  2718. onRightKey: null,
  2719. scrollingRows: !0
  2720. },
  2721. e || {});
  2722. return this.each(function () {
  2723. var c = this;
  2724. b("body").is("[role]") || b("body").attr("role", "application");
  2725. c.p.scrollrows = f.scrollingRows;
  2726. b(c).keydown(function (d) {
  2727. var a = b(c).find("tr[tabindex=0]")[0],
  2728. e,
  2729. g,
  2730. h,
  2731. k = c.p.treeReader.expanded_field;
  2732. 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) {
  2733. if (38 === d.keyCode) {
  2734. g = a.previousSibling;
  2735. e = "";
  2736. if (g) if (b(g).is(":hidden")) for (; g;) {
  2737. if (g = g.previousSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
  2738. e = g.id;
  2739. break
  2740. }
  2741. } else e = g.id;
  2742. b(c).jqGrid("setSelection", e, !0, d);
  2743. d.preventDefault()
  2744. }
  2745. if (40 === d.keyCode) {
  2746. g = a.nextSibling;
  2747. e = "";
  2748. if (g) if (b(g).is(":hidden")) for (; g;) {
  2749. if (g = g.nextSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
  2750. e = g.id;
  2751. break
  2752. }
  2753. } else e = g.id;
  2754. b(c).jqGrid("setSelection", e, !0, d);
  2755. d.preventDefault()
  2756. }
  2757. 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));
  2758. 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))
  2759. } 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))
  2760. })
  2761. })
  2762. },
  2763. unbindKeys: function () {
  2764. return this.each(function () {
  2765. b(this).unbind("keydown")
  2766. })
  2767. },
  2768. getLocalRow: function (e) {
  2769. var f = !1,
  2770. c;
  2771. this.each(function () {
  2772. void 0 !== e && (c = this.p._index[b.jgrid.stripPref(this.p.idPrefix, e)], 0 <= c && (f = this.p.data[c]))
  2773. });
  2774. return f
  2775. }
  2776. })
  2777. })(jQuery); (function (a) {
  2778. a.fmatter = {};
  2779. a.extend(a.fmatter, {
  2780. isBoolean: function (a) {
  2781. return "boolean" === typeof a
  2782. },
  2783. isObject: function (c) {
  2784. return c && ("object" === typeof c || a.isFunction(c)) || !1
  2785. },
  2786. isString: function (a) {
  2787. return "string" === typeof a
  2788. },
  2789. isNumber: function (a) {
  2790. return "number" === typeof a && isFinite(a)
  2791. },
  2792. isValue: function (a) {
  2793. return this.isObject(a) || this.isString(a) || this.isNumber(a) || this.isBoolean(a)
  2794. },
  2795. isEmpty: function (c) {
  2796. if (!this.isString(c) && this.isValue(c)) return !1;
  2797. if (!this.isValue(c)) return !0;
  2798. c = a.trim(c).replace(/\&nbsp\;/ig, "").replace(/\&#160\;/ig, "");
  2799. return "" === c
  2800. }
  2801. });
  2802. a.fn.fmatter = function (c, b, d, e, f) {
  2803. var g = b;
  2804. d = a.extend({},
  2805. a.jgrid.formatter, d);
  2806. try {
  2807. g = a.fn.fmatter[c].call(this, b, d, e, f)
  2808. } catch (h) { }
  2809. return g
  2810. };
  2811. a.fmatter.util = {
  2812. NumberFormat: function (c, b) {
  2813. a.fmatter.isNumber(c) || (c *= 1);
  2814. if (a.fmatter.isNumber(c)) {
  2815. var d = 0 > c,
  2816. e = String(c),
  2817. f = b.decimalSeparator || ".",
  2818. g;
  2819. if (a.fmatter.isNumber(b.decimalPlaces)) {
  2820. var h = b.decimalPlaces,
  2821. e = Math.pow(10, h),
  2822. e = String(Math.round(c * e) / e);
  2823. g = e.lastIndexOf(".");
  2824. if (0 < h) for (0 > g ? (e += f, g = e.length - 1) : "." !== f && (e = e.replace(".", f)) ; e.length - 1 - g < h;) e += "0"
  2825. }
  2826. if (b.thousandsSeparator) {
  2827. h = b.thousandsSeparator;
  2828. g = e.lastIndexOf(f);
  2829. g = -1 < g ? g : e.length;
  2830. var f = e.substring(g),
  2831. l = -1,
  2832. k;
  2833. for (k = g; 0 < k; k--) l++,
  2834. 0 === l % 3 && k !== g && (!d || 1 < k) && (f = h + f),
  2835. f = e.charAt(k - 1) + f;
  2836. e = f
  2837. }
  2838. e = b.prefix ? b.prefix + e : e;
  2839. return e = b.suffix ? e + b.suffix : e
  2840. }
  2841. return c
  2842. }
  2843. };
  2844. a.fn.fmatter.defaultFormat = function (c, b) {
  2845. return a.fmatter.isValue(c) && "" !== c ? c : b.defaultValue || "&#160;"
  2846. };
  2847. a.fn.fmatter.email = function (c, b) {
  2848. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : '<a href="mailto:' + c + '">' + c + "</a>"
  2849. };
  2850. a.fn.fmatter.checkbox = function (c, b) {
  2851. var d = a.extend({},
  2852. b.checkbox),
  2853. e;
  2854. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2855. d, b.colModel.formatoptions));
  2856. e = !0 === d.disabled ? 'disabled="disabled"' : "";
  2857. if (a.fmatter.isEmpty(c) || void 0 === c) c = a.fn.fmatter.defaultFormat(c, d);
  2858. c = String(c);
  2859. c = (c + "").toLowerCase();
  2860. return '<input type="checkbox" ' + (0 > c.search(/(false|f|0|no|n|off|undefined)/i) ? " checked='checked' " : "") + ' value="' + c + '" offval="no" ' + e + "/>"
  2861. };
  2862. a.fn.fmatter.link = function (c, b) {
  2863. var d = {
  2864. target: b.target
  2865. },
  2866. e = "";
  2867. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2868. d, b.colModel.formatoptions));
  2869. d.target && (e = "target=" + d.target);
  2870. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : "<a " + e + ' href="' + c + '">' + c + "</a>"
  2871. };
  2872. a.fn.fmatter.showlink = function (c, b) {
  2873. var d = {
  2874. baseLinkUrl: b.baseLinkUrl,
  2875. showAction: b.showAction,
  2876. addParam: b.addParam || "",
  2877. target: b.target,
  2878. idName: b.idName
  2879. },
  2880. e = "";
  2881. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2882. d, b.colModel.formatoptions));
  2883. d.target && (e = "target=" + d.target);
  2884. d = d.baseLinkUrl + d.showAction + "?" + d.idName + "=" + b.rowId + d.addParam;
  2885. return a.fmatter.isString(c) || a.fmatter.isNumber(c) ? "<a " + e + ' href="' + d + '">' + c + "</a>" : a.fn.fmatter.defaultFormat(c, b)
  2886. };
  2887. a.fn.fmatter.integer = function (c, b) {
  2888. var d = a.extend({},
  2889. b.integer);
  2890. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2891. d, b.colModel.formatoptions));
  2892. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2893. };
  2894. a.fn.fmatter.number = function (c, b) {
  2895. var d = a.extend({},
  2896. b.number);
  2897. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2898. d, b.colModel.formatoptions));
  2899. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2900. };
  2901. a.fn.fmatter.currency = function (c, b) {
  2902. var d = a.extend({},
  2903. b.currency);
  2904. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2905. d, b.colModel.formatoptions));
  2906. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2907. };
  2908. a.fn.fmatter.date = function (c, b, d, e) {
  2909. d = a.extend({},
  2910. b.date);
  2911. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2912. d, b.colModel.formatoptions));
  2913. 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)
  2914. };
  2915. a.fn.fmatter.select = function (c, b) {
  2916. c = String(c);
  2917. var d = !1,
  2918. e = [],
  2919. f,
  2920. g;
  2921. 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);
  2922. if (d) {
  2923. var h = !0 === b.colModel.editoptions.multiple ? !0 : !1,
  2924. l = [];
  2925. h && (l = c.split(","), l = a.map(l,
  2926. function (b) {
  2927. return a.trim(b)
  2928. }));
  2929. if (a.fmatter.isString(d)) {
  2930. var k = d.split(g),
  2931. m = 0,
  2932. n;
  2933. for (n = 0; n < k.length; n++) if (g = k[n].split(f), 2 < g.length && (g[1] = a.map(g,
  2934. function (a, b) {
  2935. if (0 < b) return a
  2936. }).join(f)), h) -1 < a.inArray(g[0], l) && (e[m] = g[1], m++);
  2937. else if (a.trim(g[0]) === a.trim(c)) {
  2938. e[0] = g[1];
  2939. break
  2940. }
  2941. } else a.fmatter.isObject(d) && (h ? e = a.map(l,
  2942. function (a) {
  2943. return d[a]
  2944. }) : e[0] = d[c] || "")
  2945. }
  2946. c = e.join(", ");
  2947. return "" === c ? a.fn.fmatter.defaultFormat(c, b) : c
  2948. };
  2949. a.fn.fmatter.rowactions = function (c) {
  2950. var b = a(this).closest("tr.jqgrow"),
  2951. d = b.attr("id"),
  2952. e = a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/, "$1"),
  2953. e = a("#" + e),
  2954. f = e[0],
  2955. g = f.p,
  2956. h = g.colModel[a.jgrid.getCellIndex(this)],
  2957. l = h.frozen ? a("tr#" + d + " td:eq(" + a.jgrid.getCellIndex(this) + ") > div", e) : a(this).parent(),
  2958. k = {
  2959. extraparam: {}
  2960. },
  2961. m = function (b) {
  2962. a.isFunction(k.afterRestore) && k.afterRestore.call(f, b);
  2963. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2964. l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
  2965. };
  2966. void 0 !== h.formatoptions && (k = a.extend(k, h.formatoptions));
  2967. void 0 !== g.editOptions && (k.editOptions = g.editOptions);
  2968. void 0 !== g.delOptions && (k.delOptions = g.delOptions);
  2969. b.hasClass("jqgrid-new-row") && (k.extraparam[g.prmNames.oper] = g.prmNames.addoper);
  2970. b = {
  2971. keys: k.keys,
  2972. oneditfunc: k.onEdit,
  2973. successfunc: k.onSuccess,
  2974. url: k.url,
  2975. extraparam: k.extraparam,
  2976. aftersavefunc: function (b, c) {
  2977. a.isFunction(k.afterSave) && k.afterSave.call(f, b, c);
  2978. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2979. l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
  2980. },
  2981. errorfunc: k.onError,
  2982. afterrestorefunc: m,
  2983. restoreAfterError: k.restoreAfterError,
  2984. mtype: k.mtype
  2985. };
  2986. switch (c) {
  2987. case "edit":
  2988. e.jqGrid("editRow", d, b);
  2989. l.find("div.ui-inline-edit,div.ui-inline-del").hide();
  2990. l.find("div.ui-inline-save,div.ui-inline-cancel").show();
  2991. e.triggerHandler("jqGridAfterGridComplete");
  2992. break;
  2993. case "save":
  2994. 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"));
  2995. break;
  2996. case "cancel":
  2997. e.jqGrid("restoreRow", d, m);
  2998. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2999. l.find("div.ui-inline-save,div.ui-inline-cancel").hide();
  3000. e.triggerHandler("jqGridAfterGridComplete");
  3001. break;
  3002. case "del":
  3003. e.jqGrid("delGridRow", d, k.delOptions);
  3004. break;
  3005. case "formedit":
  3006. e.jqGrid("setSelection", d),
  3007. e.jqGrid("editGridRow", d, k.editOptions)
  3008. }
  3009. };
  3010. a.fn.fmatter.actions = function (c, b) {
  3011. var d = {
  3012. keys: !1,
  3013. editbutton: !0,
  3014. delbutton: !0,
  3015. editformbutton: !1
  3016. },
  3017. e = b.rowId,
  3018. f = "";
  3019. void 0 !== b.colModel.formatoptions && (d = a.extend(d, b.colModel.formatoptions));
  3020. if (void 0 === e || a.fmatter.isEmpty(e)) return "";
  3021. 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>");
  3022. 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>");
  3023. 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>";
  3024. 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>";
  3025. return "<div style='margin-left:8px;'>" + f + "</div>"
  3026. };
  3027. a.unformat = function (c, b, d, e) {
  3028. var f, g = b.colModel.formatter,
  3029. h = b.colModel.formatoptions || {},
  3030. l = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
  3031. k = b.colModel.unformat || a.fn.fmatter[g] && a.fn.fmatter[g].unformat;
  3032. if (void 0 !== k && a.isFunction(k)) f = k.call(this, a(c).text(), b, c);
  3033. else if (void 0 !== g && a.fmatter.isString(g)) switch (f = a.jgrid.formatter || {},
  3034. g) {
  3035. case "integer":
  3036. h = a.extend({},
  3037. f.integer, h);
  3038. b = h.thousandsSeparator.replace(l, "\\$1");
  3039. b = RegExp(b, "g");
  3040. f = a(c).text().replace(b, "");
  3041. break;
  3042. case "number":
  3043. h = a.extend({},
  3044. f.number, h);
  3045. b = h.thousandsSeparator.replace(l, "\\$1");
  3046. b = RegExp(b, "g");
  3047. f = a(c).text().replace(b, "").replace(h.decimalSeparator, ".");
  3048. break;
  3049. case "currency":
  3050. h = a.extend({},
  3051. f.currency, h);
  3052. b = h.thousandsSeparator.replace(l, "\\$1");
  3053. b = RegExp(b, "g");
  3054. f = a(c).text();
  3055. h.prefix && h.prefix.length && (f = f.substr(h.prefix.length));
  3056. h.suffix && h.suffix.length && (f = f.substr(0, f.length - h.suffix.length));
  3057. f = f.replace(b, "").replace(h.decimalSeparator, ".");
  3058. break;
  3059. case "checkbox":
  3060. h = b.colModel.editoptions ? b.colModel.editoptions.value.split(":") : ["Yes", "No"];
  3061. f = a("input", c).is(":checked") ? h[0] : h[1];
  3062. break;
  3063. case "select":
  3064. f = a.unformat.select(c, b, d, e);
  3065. break;
  3066. case "actions":
  3067. return "";
  3068. default:
  3069. f = a(c).text()
  3070. }
  3071. return void 0 !== f ? f : !0 === e ? a(c).text() : a.jgrid.htmlDecode(a(c).html())
  3072. };
  3073. a.unformat.select = function (c, b, d, e) {
  3074. d = [];
  3075. c = a(c).text();
  3076. if (!0 === e) return c;
  3077. e = a.extend({},
  3078. void 0 !== b.colModel.formatoptions ? b.colModel.formatoptions : b.colModel.editoptions);
  3079. b = void 0 === e.separator ? ":" : e.separator;
  3080. var f = void 0 === e.delimiter ? ";" : e.delimiter;
  3081. if (e.value) {
  3082. var g = e.value;
  3083. e = !0 === e.multiple ? !0 : !1;
  3084. var h = [];
  3085. e && (h = c.split(","), h = a.map(h,
  3086. function (b) {
  3087. return a.trim(b)
  3088. }));
  3089. if (a.fmatter.isString(g)) {
  3090. var l = g.split(f),
  3091. k = 0,
  3092. m;
  3093. for (m = 0; m < l.length; m++) if (f = l[m].split(b), 2 < f.length && (f[1] = a.map(f,
  3094. function (a, b) {
  3095. if (0 < b) return a
  3096. }).join(b)), e) -1 < a.inArray(f[1], h) && (d[k] = f[0], k++);
  3097. else if (a.trim(f[1]) === a.trim(c)) {
  3098. d[0] = f[0];
  3099. break
  3100. }
  3101. } else if (a.fmatter.isObject(g) || a.isArray(g)) e || (h[0] = c),
  3102. d = a.map(h,
  3103. function (b) {
  3104. var c;
  3105. a.each(g,
  3106. function (a, d) {
  3107. if (d === b) return c = a,
  3108. !1
  3109. });
  3110. if (void 0 !== c) return c
  3111. });
  3112. return d.join(", ")
  3113. }
  3114. return c || ""
  3115. };
  3116. a.unformat.date = function (c, b) {
  3117. var d = a.jgrid.formatter.date || {};
  3118. void 0 !== b.formatoptions && (d = a.extend({},
  3119. d, b.formatoptions));
  3120. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : a.jgrid.parseDate(d.newformat, c, d.srcformat, d)
  3121. }
  3122. })(jQuery); (function (a) {
  3123. a.jgrid.extend({
  3124. getColProp: function (a) {
  3125. var c = {},
  3126. d = this[0];
  3127. if (!d.grid) return !1;
  3128. var d = d.p.colModel,
  3129. h;
  3130. for (h = 0; h < d.length; h++) if (d[h].name === a) {
  3131. c = d[h];
  3132. break
  3133. }
  3134. return c
  3135. },
  3136. setColProp: function (b, c) {
  3137. return this.each(function () {
  3138. if (this.grid && c) {
  3139. var d = this.p.colModel,
  3140. h;
  3141. for (h = 0; h < d.length; h++) if (d[h].name === b) {
  3142. a.extend(!0, this.p.colModel[h], c);
  3143. break
  3144. }
  3145. }
  3146. })
  3147. },
  3148. sortGrid: function (a, c, d) {
  3149. return this.each(function () {
  3150. var h = -1,
  3151. k, e = !1;
  3152. if (this.grid) {
  3153. a || (a = this.p.sortname);
  3154. for (k = 0; k < this.p.colModel.length; k++) if (this.p.colModel[k].index === a || this.p.colModel[k].name === a) {
  3155. h = k; !0 === this.p.frozenColumns && !0 === this.p.colModel[k].frozen && (e = this.grid.fhDiv.find("#" + this.p.id + "_" + a));
  3156. break
  3157. } -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))
  3158. }
  3159. })
  3160. },
  3161. clearBeforeUnload: function () {
  3162. return this.each(function () {
  3163. var b = this.grid;
  3164. a.isFunction(b.emptyRows) && b.emptyRows.call(this, !0, !0);
  3165. a(document).unbind("mouseup.jqGrid" + this.p.id);
  3166. a(b.hDiv).unbind("mousemove");
  3167. a(this).unbind();
  3168. b.dragEnd = null;
  3169. b.dragMove = null;
  3170. b.dragStart = null;
  3171. b.emptyRows = null;
  3172. b.populate = null;
  3173. b.populateVisible = null;
  3174. b.scrollGrid = null;
  3175. b.selectionPreserver = null;
  3176. b.bDiv = null;
  3177. b.cDiv = null;
  3178. b.hDiv = null;
  3179. b.cols = null;
  3180. var c, d = b.headers.length;
  3181. for (c = 0; c < d; c++) b.headers[c].el = null;
  3182. this.grid = this.addJSONData = this.addXmlData = this.formatter = this.constructTr = this.setHeadCheckBox = this.refreshIndex = this.updatepager = this.sortData = this.formatCol = null
  3183. })
  3184. },
  3185. GridDestroy: function () {
  3186. return this.each(function () {
  3187. if (this.grid) {
  3188. this.p.pager && a(this.p.pager).remove();
  3189. try {
  3190. a(this).jqGrid("clearBeforeUnload"),
  3191. a("#gbox_" + a.jgrid.jqID(this.id)).remove()
  3192. } catch (b) { }
  3193. }
  3194. })
  3195. },
  3196. GridUnload: function () {
  3197. return this.each(function () {
  3198. if (this.grid) {
  3199. var b = a(this).attr("id"),
  3200. c = a(this).attr("class");
  3201. this.p.pager && a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");
  3202. var d = document.createElement("table");
  3203. a(d).attr({
  3204. id: b
  3205. });
  3206. d.className = c;
  3207. b = a.jgrid.jqID(this.id);
  3208. a(d).removeClass("ui-jqgrid-btable");
  3209. 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();
  3210. a(this).jqGrid("clearBeforeUnload");
  3211. a("#gbox_" + b).remove()
  3212. }
  3213. })
  3214. },
  3215. setGridState: function (b) {
  3216. return this.each(function () {
  3217. 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"))
  3218. })
  3219. },
  3220. filterToolbar: function (b) {
  3221. b = a.extend({
  3222. autosearch: !0,
  3223. searchOnEnter: !0,
  3224. beforeSearch: null,
  3225. afterSearch: null,
  3226. beforeClear: null,
  3227. afterClear: null,
  3228. searchurl: "",
  3229. stringResult: !1,
  3230. groupOp: "AND",
  3231. defaultSearch: "bw",
  3232. searchOperators: !1,
  3233. resetIcon: "x",
  3234. operands: {
  3235. eq: "==",
  3236. ne: "!",
  3237. lt: "<",
  3238. le: "<=",
  3239. gt: ">",
  3240. ge: ">=",
  3241. bw: "^",
  3242. bn: "!^",
  3243. "in": "=",
  3244. ni: "!=",
  3245. ew: "|",
  3246. en: "!@",
  3247. cn: "~",
  3248. nc: "!~",
  3249. nu: "#",
  3250. nn: "!#"
  3251. }
  3252. },
  3253. a.jgrid.search, b || {});
  3254. return this.each(function () {
  3255. var c = this;
  3256. if (!this.ftoolbar) {
  3257. var d = function () {
  3258. var d = {},
  3259. f = 0,
  3260. g, m, e = {},
  3261. q;
  3262. a.each(c.p.colModel,
  3263. function () {
  3264. var l = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
  3265. m = this.index || this.name;
  3266. 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;
  3267. 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,
  3268. e[m] = q,
  3269. f++;
  3270. else try {
  3271. delete c.p.postData[m]
  3272. } catch (k) { }
  3273. });
  3274. var k = 0 < f ? !0 : !1;
  3275. if (!0 === b.stringResult || "local" === c.p.datatype) {
  3276. var l = '{"groupOp":"' + b.groupOp + '","rules":[',
  3277. n = 0;
  3278. a.each(d,
  3279. function (a, b) {
  3280. 0 < n && (l += ",");
  3281. l += '{"field":"' + a + '",';
  3282. l += '"op":"' + e[a] + '",';
  3283. l += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
  3284. n++
  3285. });
  3286. l += "]}";
  3287. a.extend(c.p.postData, {
  3288. filters: l
  3289. });
  3290. a.each(["searchField", "searchString", "searchOper"],
  3291. function (a, b) {
  3292. c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
  3293. })
  3294. } else a.extend(c.p.postData, d);
  3295. var r;
  3296. c.p.searchurl && (r = c.p.url, a(c).jqGrid("setGridParam", {
  3297. url: c.p.searchurl
  3298. }));
  3299. var h = "stop" === a(c).triggerHandler("jqGridToolbarBeforeSearch") ? !0 : !1; !h && a.isFunction(b.beforeSearch) && (h = b.beforeSearch.call(c));
  3300. h || a(c).jqGrid("setGridParam", {
  3301. search: k
  3302. }).trigger("reloadGrid", [{
  3303. page: 1
  3304. }]);
  3305. r && a(c).jqGrid("setGridParam", {
  3306. url: r
  3307. });
  3308. a(c).triggerHandler("jqGridToolbarAfterSearch");
  3309. a.isFunction(b.afterSearch) && b.afterSearch.call(c)
  3310. },
  3311. h = function (e, f, g) {
  3312. a("#sopt_menu").remove();
  3313. f = parseInt(f, 10);
  3314. g = parseInt(g, 10) + 18;
  3315. 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;">';
  3316. g = a(e).attr("soper");
  3317. var k, h = [],
  3318. q,
  3319. p = 0,
  3320. l = a(e).attr("colname");
  3321. for (k = c.p.colModel.length; p < k && c.p.colModel[p].name !== l;) p++;
  3322. p = c.p.colModel[p];
  3323. l = a.extend({},
  3324. p.searchoptions);
  3325. l.sopt || (l.sopt = [], l.sopt[0] = "select" === p.stype ? "eq" : b.defaultSearch);
  3326. a.each(b.odata,
  3327. function () {
  3328. h.push(this.oper)
  3329. });
  3330. for (p = 0; p < l.sopt.length; p++) q = a.inArray(l.sopt[p], h),
  3331. -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>");
  3332. f += "</ul>";
  3333. a("body").append(f);
  3334. a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");
  3335. a("#sopt_menu > li > a").hover(function () {
  3336. a(this).addClass("ui-state-hover")
  3337. },
  3338. function () {
  3339. a(this).removeClass("ui-state-hover")
  3340. }).click(function (f) {
  3341. f = a(this).attr("value");
  3342. var g = a(this).attr("oper");
  3343. a(c).triggerHandler("jqGridToolbarSelectOper", [f, g, e]);
  3344. a("#sopt_menu").hide();
  3345. 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())
  3346. })
  3347. },
  3348. k = a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),
  3349. e;
  3350. a.each(c.p.colModel,
  3351. function (h) {
  3352. var f = this,
  3353. g, m;
  3354. m = "";
  3355. var x = "=",
  3356. q, p = a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-" + c.p.direction + "'></th>"),
  3357. l = a("<div style='position:relative;height:100%;padding-right:0.3em;padding-left:0.3em;'></div>"),
  3358. 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");
  3359. this.search = !1 === this.search ? !1 : !0;
  3360. void 0 === this.stype && (this.stype = "text");
  3361. g = a.extend({},
  3362. this.searchoptions || {});
  3363. if (this.search) {
  3364. if (b.searchOperators) {
  3365. m = g.sopt ? g.sopt[0] : "select" === f.stype ? "eq" : b.defaultSearch;
  3366. for (q = 0; q < b.odata.length; q++) if (b.odata[q].oper === m) {
  3367. x = b.operands[m] || "";
  3368. break
  3369. }
  3370. m = "<a title='" + (null != g.searchtitle ? g.searchtitle : b.operandTitle) + "' style='padding-right: 0.5em;' soper='" + m + "' class='soptclass' colname='" + this.name + "'>" + x + "</a>"
  3371. }
  3372. a("td:eq(0)", n).attr("colindex", h).append(m);
  3373. void 0 === g.clearSearch && (g.clearSearch = !0);
  3374. 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();
  3375. switch (this.stype) {
  3376. case "select":
  3377. if (m = this.surl || g.dataUrl) a(l).append(n),
  3378. a.ajax(a.extend({
  3379. url: m,
  3380. dataType: "html",
  3381. success: function (e) {
  3382. void 0 !== g.buildSelect ? (e = g.buildSelect(e)) && a("td:eq(1)", n).append(e) : a("td:eq(1)", n).append(e);
  3383. void 0 !== g.defaultValue && a("select", l).val(g.defaultValue);
  3384. a("select", l).attr({
  3385. name: f.index || f.name,
  3386. id: "gs_" + f.name
  3387. });
  3388. g.attr && a("select", l).attr(g.attr);
  3389. a("select", l).css({
  3390. width: "100%"
  3391. });
  3392. a.jgrid.bindEv.call(c, a("select", l)[0], g); !0 === b.autosearch && a("select", l).change(function () {
  3393. d();
  3394. return !1
  3395. });
  3396. e = null
  3397. }
  3398. },
  3399. a.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
  3400. else {
  3401. var r, w, u;
  3402. 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);
  3403. if (r) {
  3404. var t = document.createElement("select");
  3405. t.style.width = "100%";
  3406. a(t).attr({
  3407. name: f.index || f.name,
  3408. id: "gs_" + f.name
  3409. });
  3410. var v;
  3411. if ("string" === typeof r) for (m = r.split(u), v = 0; v < m.length; v++) r = m[v].split(w),
  3412. u = document.createElement("option"),
  3413. u.value = r[0],
  3414. u.innerHTML = r[1],
  3415. t.appendChild(u);
  3416. 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));
  3417. void 0 !== g.defaultValue && a(t).val(g.defaultValue);
  3418. g.attr && a(t).attr(g.attr);
  3419. a(l).append(n);
  3420. a.jgrid.bindEv.call(c, t, g);
  3421. a("td:eq(1)", n).append(t); !0 === b.autosearch && a(t).change(function () {
  3422. d();
  3423. return !1
  3424. })
  3425. }
  3426. }
  3427. break;
  3428. case "text":
  3429. w = void 0 !== g.defaultValue ? g.defaultValue : "";
  3430. 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 + "'/>");
  3431. a(l).append(n);
  3432. g.attr && a("input", l).attr(g.attr);
  3433. a.jgrid.bindEv.call(c, a("input", l)[0], g); !0 === b.autosearch && (b.searchOnEnter ? a("input", l).keypress(function (a) {
  3434. return 13 === (a.charCode || a.keyCode || 0) ? (d(), !1) : this
  3435. }) : a("input", l).keydown(function (a) {
  3436. switch (a.which) {
  3437. case 13:
  3438. return !1;
  3439. case 9:
  3440. case 16:
  3441. case 37:
  3442. case 38:
  3443. case 39:
  3444. case 40:
  3445. case 27:
  3446. break;
  3447. default:
  3448. e && clearTimeout(e),
  3449. e = setTimeout(function () {
  3450. d()
  3451. },
  3452. 500)
  3453. }
  3454. }));
  3455. break;
  3456. case "custom":
  3457. a("td:eq(1)", n).append("<span style='width:95%;padding:0px;' name='" + (f.index || f.name) + "' id='gs_" + f.name + "'/>");
  3458. a(l).append(n);
  3459. try {
  3460. 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"),
  3461. a(l).find(">span").append(t);
  3462. else throw "e2";
  3463. else throw "e1";
  3464. } catch (y) {
  3465. "e1" === y && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  3466. "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)
  3467. }
  3468. }
  3469. }
  3470. a(p).append(l);
  3471. a(k).append(p);
  3472. b.searchOperators || a("td:eq(0)", n).hide()
  3473. });
  3474. a("table thead", c.grid.hDiv).append(k);
  3475. b.searchOperators && (a(".soptclass", k).click(function (b) {
  3476. var c = a(this).offset();
  3477. h(this, c.left, c.top);
  3478. b.stopPropagation()
  3479. }), a("body").on("click",
  3480. function (b) {
  3481. "soptclass" !== b.target.className && a("#sopt_menu").hide()
  3482. }));
  3483. a(".clearsearchclass", k).click(function (e) {
  3484. e = a(this).parents("tr:first");
  3485. var f = parseInt(a("td.ui-search-oper", e).attr("colindex"), 10),
  3486. g = a.extend({},
  3487. c.p.colModel[f].searchoptions || {}),
  3488. g = g.defaultValue ? g.defaultValue : "";
  3489. "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()
  3490. });
  3491. this.ftoolbar = !0;
  3492. this.triggerToolbar = d;
  3493. this.clearToolbar = function (d) {
  3494. var f = {},
  3495. g = 0,
  3496. e;
  3497. d = "boolean" !== typeof d ? !0 : d;
  3498. a.each(c.p.colModel,
  3499. function () {
  3500. var b, d = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
  3501. this.searchoptions && void 0 !== this.searchoptions.defaultValue && (b = this.searchoptions.defaultValue);
  3502. e = this.index || this.name;
  3503. switch (this.stype) {
  3504. case "select":
  3505. d.find("option").each(function (c) {
  3506. 0 === c && (this.selected = !0);
  3507. if (a(this).val() === b) return this.selected = !0,
  3508. !1
  3509. });
  3510. if (void 0 !== b) f[e] = b,
  3511. g++;
  3512. else try {
  3513. delete c.p.postData[e]
  3514. } catch (h) { }
  3515. break;
  3516. case "text":
  3517. d.val(b || "");
  3518. if (void 0 !== b) f[e] = b,
  3519. g++;
  3520. else try {
  3521. delete c.p.postData[e]
  3522. } catch (k) { }
  3523. break;
  3524. case "custom":
  3525. 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 || "")
  3526. }
  3527. });
  3528. var k = 0 < g ? !0 : !1;
  3529. c.p.resetsearch = !0;
  3530. if (!0 === b.stringResult || "local" === c.p.datatype) {
  3531. var h = '{"groupOp":"' + b.groupOp + '","rules":[',
  3532. p = 0;
  3533. a.each(f,
  3534. function (a, b) {
  3535. 0 < p && (h += ",");
  3536. h += '{"field":"' + a + '",';
  3537. h += '"op":"eq",';
  3538. h += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
  3539. p++
  3540. });
  3541. h += "]}";
  3542. a.extend(c.p.postData, {
  3543. filters: h
  3544. });
  3545. a.each(["searchField", "searchString", "searchOper"],
  3546. function (a, b) {
  3547. c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
  3548. })
  3549. } else a.extend(c.p.postData, f);
  3550. var l;
  3551. c.p.searchurl && (l = c.p.url, a(c).jqGrid("setGridParam", {
  3552. url: c.p.searchurl
  3553. }));
  3554. var n = "stop" === a(c).triggerHandler("jqGridToolbarBeforeClear") ? !0 : !1; !n && a.isFunction(b.beforeClear) && (n = b.beforeClear.call(c));
  3555. n || d && a(c).jqGrid("setGridParam", {
  3556. search: k
  3557. }).trigger("reloadGrid", [{
  3558. page: 1
  3559. }]);
  3560. l && a(c).jqGrid("setGridParam", {
  3561. url: l
  3562. });
  3563. a(c).triggerHandler("jqGridToolbarAfterClear");
  3564. a.isFunction(b.afterClear) && b.afterClear()
  3565. };
  3566. this.toggleToolbar = function () {
  3567. var b = a("tr.ui-search-toolbar", c.grid.hDiv),
  3568. d = !0 === c.p.frozenColumns ? a("tr.ui-search-toolbar", c.grid.fhDiv) : !1;
  3569. "none" === b.css("display") ? (b.show(), d && d.show()) : (b.hide(), d && d.hide())
  3570. }
  3571. }
  3572. })
  3573. },
  3574. destroyFilterToolbar: function () {
  3575. return this.each(function () {
  3576. this.ftoolbar && (this.toggleToolbar = this.clearToolbar = this.triggerToolbar = null, this.ftoolbar = !1, a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())
  3577. })
  3578. },
  3579. destroyGroupHeader: function (b) {
  3580. void 0 === b && (b = !0);
  3581. return this.each(function () {
  3582. var c, d, h, k, e, s;
  3583. d = this.grid;
  3584. var f = a("table.ui-jqgrid-htable thead", d.hDiv),
  3585. g = this.p.colModel;
  3586. if (d) {
  3587. a(this).unbind(".setGroupHeaders");
  3588. c = a("<tr>", {
  3589. role: "rowheader"
  3590. }).addClass("ui-jqgrid-labels");
  3591. k = d.headers;
  3592. d = 0;
  3593. for (h = k.length; d < h; d++) {
  3594. e = g[d].hidden ? "none" : "";
  3595. e = a(k[d].el).width(k[d].width).css("display", e);
  3596. try {
  3597. e.removeAttr("rowSpan")
  3598. } catch (m) {
  3599. e.attr("rowSpan", 1)
  3600. }
  3601. c.append(e);
  3602. s = e.children("span.ui-jqgrid-resize");
  3603. 0 < s.length && (s[0].style.height = "");
  3604. e.children("div")[0].style.top = ""
  3605. }
  3606. a(f).children("tr.ui-jqgrid-labels").remove();
  3607. a(f).prepend(c); !0 === b && a(this).jqGrid("setGridParam", {
  3608. groupHeader: null
  3609. })
  3610. }
  3611. })
  3612. },
  3613. setGroupHeaders: function (b) {
  3614. b = a.extend({
  3615. useColSpanStyle: !1,
  3616. groupHeaders: []
  3617. },
  3618. b || {});
  3619. return this.each(function () {
  3620. this.p.groupHeader = b;
  3621. var c, d, h = 0,
  3622. k, e, s, f, g, m = this.p.colModel,
  3623. x = m.length,
  3624. q = this.grid.headers,
  3625. p = a("table.ui-jqgrid-htable", this.grid.hDiv),
  3626. l = p.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");
  3627. k = p.children("thead");
  3628. var n = p.find(".jqg-first-row-header");
  3629. void 0 === n[0] ? n = a("<tr>", {
  3630. role: "row",
  3631. "aria-hidden": "true"
  3632. }).addClass("jqg-first-row-header").css("height", "auto") : n.empty();
  3633. var r, w = function (a, b) {
  3634. var c = b.length,
  3635. d;
  3636. for (d = 0; d < c; d++) if (b[d].startColumnName === a) return d;
  3637. return -1
  3638. };
  3639. a(this).prepend(k);
  3640. k = a("<tr>", {
  3641. role: "rowheader"
  3642. }).addClass("ui-jqgrid-labels jqg-third-row-header");
  3643. for (c = 0; c < x; c++) if (s = q[c].el, f = a(s), d = m[c], e = {
  3644. height: "0px",
  3645. width: q[c].width + "px",
  3646. display: d.hidden ? "none" : ""
  3647. },
  3648. a("<th>", {
  3649. role: "gridcell"
  3650. }).css(e).addClass("ui-first-th-" + this.p.direction).appendTo(n), s.style.width = "", e = w(d.name, b.groupHeaders), 0 <= e) {
  3651. e = b.groupHeaders[e];
  3652. h = e.numberOfColumns;
  3653. g = e.titleText;
  3654. for (e = d = 0; e < h && c + e < x; e++) m[c + e].hidden || d++;
  3655. e = a("<th>").attr({
  3656. role: "columnheader"
  3657. }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).css({
  3658. height: "28px",
  3659. "border-top": "0 none"
  3660. }).html(g);
  3661. 0 < d && e.attr("colspan", String(d));
  3662. this.p.headertitles && e.attr("title", e.text());
  3663. 0 === d && e.hide();
  3664. f.before(e);
  3665. k.append(s);
  3666. h -= 1
  3667. } else 0 === h ? b.useColSpanStyle ? f.attr("rowspan", "2") : (a("<th>", {
  3668. role: "columnheader"
  3669. }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).css({
  3670. display: d.hidden ? "none" : "",
  3671. "border-top": "0 none"
  3672. }).insertBefore(f), k.append(s)) : (k.append(s), h--);
  3673. m = a(this).children("thead");
  3674. m.prepend(n);
  3675. k.insertAfter(l);
  3676. p.append(m);
  3677. b.useColSpanStyle && (p.find("span.ui-jqgrid-resize").each(function () {
  3678. var b = a(this).parent();
  3679. b.is(":visible") && (this.style.cssText = "height: " + b.height() + "px !important; cursor: col-resize;")
  3680. }), p.find("div.ui-jqgrid-sortable").each(function () {
  3681. var b = a(this),
  3682. c = b.parent();
  3683. c.is(":visible") && c.is(":has(span.ui-jqgrid-resize)") && b.css("top", (c.height() - b.outerHeight()) / 2 - 2 + "px")
  3684. }));
  3685. r = m.find("tr.jqg-first-row-header");
  3686. a(this).bind("jqGridResizeStop.setGroupHeaders",
  3687. function (a, b, c) {
  3688. r.find("th").eq(c).width(b)
  3689. })
  3690. })
  3691. },
  3692. setFrozenColumns: function () {
  3693. return this.each(function () {
  3694. if (this.grid) {
  3695. var b = this,
  3696. c = b.p.colModel,
  3697. d = 0,
  3698. h = c.length,
  3699. k = -1,
  3700. e = !1;
  3701. if (!0 !== b.p.subGrid && !0 !== b.p.treeGrid && !0 !== b.p.cellEdit && !b.p.sortable && !b.p.scroll) {
  3702. b.p.rownumbers && d++;
  3703. for (b.p.multiselect && d++; d < h;) {
  3704. if (!0 === c[d].frozen) e = !0,
  3705. k = d;
  3706. else break;
  3707. d++
  3708. }
  3709. if (0 <= k && e) {
  3710. c = b.p.caption ? a(b.grid.cDiv).outerHeight() : 0;
  3711. d = a(".ui-jqgrid-htable", "#gview_" + a.jgrid.jqID(b.p.id)).height();
  3712. 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());
  3713. 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>');
  3714. 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>');
  3715. a("#gview_" + a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);
  3716. c = a(".ui-jqgrid-htable", "#gview_" + a.jgrid.jqID(b.p.id)).clone(!0);
  3717. if (b.p.groupHeader) {
  3718. a("tr.jqg-first-row-header, tr.jqg-third-row-header", c).each(function () {
  3719. a("th:gt(" + k + ")", this).remove()
  3720. });
  3721. var s = -1,
  3722. f = -1,
  3723. g, m;
  3724. a("tr.jqg-second-row-header th", c).each(function () {
  3725. g = parseInt(a(this).attr("colspan"), 10);
  3726. if (m = parseInt(a(this).attr("rowspan"), 10)) s++,
  3727. f++;
  3728. g && (s += g, f++);
  3729. if (s === k) return !1
  3730. });
  3731. s !== k && (f = k);
  3732. a("tr.jqg-second-row-header", c).each(function () {
  3733. a("th:gt(" + f + ")", this).remove()
  3734. })
  3735. } else a("tr", c).each(function () {
  3736. a("th:gt(" + k + ")", this).remove()
  3737. });
  3738. a(c).width(1);
  3739. a(b.grid.fhDiv).append(c).mousemove(function (a) {
  3740. if (b.grid.resizing) return b.grid.dragMove(a),
  3741. !1
  3742. });
  3743. a(b).bind("jqGridResizeStop.setFrozenColumns",
  3744. function (c, d, e) {
  3745. c = a(".ui-jqgrid-htable", b.grid.fhDiv);
  3746. a("th:eq(" + e + ")", c).width(d);
  3747. c = a(".ui-jqgrid-btable", b.grid.fbDiv);
  3748. a("tr:first td:eq(" + e + ")", c).width(d)
  3749. });
  3750. a(b).bind("jqGridSortCol.setFrozenColumns",
  3751. function (c, d, e) {
  3752. c = a("tr.ui-jqgrid-labels:last th:eq(" + b.p.lastsort + ")", b.grid.fhDiv);
  3753. d = a("tr.ui-jqgrid-labels:last th:eq(" + e + ")", b.grid.fhDiv);
  3754. a("span.ui-grid-ico-sort", c).addClass("ui-state-disabled");
  3755. a(c).attr("aria-selected", "false");
  3756. a("span.ui-icon-" + b.p.sortorder, d).removeClass("ui-state-disabled");
  3757. a(d).attr("aria-selected", "true");
  3758. b.p.viewsortcols[0] || b.p.lastsort === e || (a("span.s-ico", c).hide(), a("span.s-ico", d).show())
  3759. });
  3760. a("#gview_" + a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);
  3761. a(b.grid.bDiv).scroll(function () {
  3762. a(b.grid.fbDiv).scrollTop(a(this).scrollTop())
  3763. }); !0 === b.p.hoverrows && a("#" + a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");
  3764. a(b).bind("jqGridAfterGridComplete.setFrozenColumns",
  3765. function () {
  3766. a("#" + a.jgrid.jqID(b.p.id) + "_frozen").remove();
  3767. a(b.grid.fbDiv).height(a(b.grid.bDiv).height() - 16);
  3768. var c = a("#" + a.jgrid.jqID(b.p.id)).clone(!0);
  3769. a("tr[role=row]", c).each(function () {
  3770. a("td[role=gridcell]:gt(" + k + ")", this).remove()
  3771. });
  3772. a(c).width(1).attr("id", b.p.id + "_frozen");
  3773. a(b.grid.fbDiv).append(c); !0 === b.p.hoverrows && (a("tr.jqgrow", c).hover(function () {
  3774. a(this).addClass("ui-state-hover");
  3775. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id)).addClass("ui-state-hover")
  3776. },
  3777. function () {
  3778. a(this).removeClass("ui-state-hover");
  3779. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id)).removeClass("ui-state-hover")
  3780. }), a("tr.jqgrow", "#" + a.jgrid.jqID(b.p.id)).hover(function () {
  3781. a(this).addClass("ui-state-hover");
  3782. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id) + "_frozen").addClass("ui-state-hover")
  3783. },
  3784. function () {
  3785. a(this).removeClass("ui-state-hover");
  3786. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id) + "_frozen").removeClass("ui-state-hover")
  3787. }));
  3788. c = null
  3789. });
  3790. b.grid.hDiv.loading || a(b).triggerHandler("jqGridAfterGridComplete");
  3791. b.p.frozenColumns = !0
  3792. }
  3793. }
  3794. }
  3795. })
  3796. },
  3797. destroyFrozenColumns: function () {
  3798. return this.each(function () {
  3799. if (this.grid && !0 === this.p.frozenColumns) {
  3800. a(this.grid.fhDiv).remove();
  3801. a(this.grid.fbDiv).remove();
  3802. this.grid.fhDiv = null;
  3803. this.grid.fbDiv = null;
  3804. a(this).unbind(".setFrozenColumns");
  3805. if (!0 === this.p.hoverrows) {
  3806. var b;
  3807. a("#" + a.jgrid.jqID(this.p.id)).bind("mouseover",
  3808. function (c) {
  3809. b = a(c.target).closest("tr.jqgrow");
  3810. "ui-subgrid" !== a(b).attr("class") && a(b).addClass("ui-state-hover")
  3811. }).bind("mouseout",
  3812. function (c) {
  3813. b = a(c.target).closest("tr.jqgrow");
  3814. a(b).removeClass("ui-state-hover")
  3815. })
  3816. }
  3817. this.p.frozenColumns = !1
  3818. }
  3819. })
  3820. }
  3821. })
  3822. })(jQuery); (function (a) {
  3823. a.extend(a.jgrid, {
  3824. showModal: function (a) {
  3825. a.w.show()
  3826. },
  3827. closeModal: function (a) {
  3828. a.w.hide().attr("aria-hidden", "true");
  3829. a.o && a.o.remove()
  3830. },
  3831. hideModal: function (d, b) {
  3832. b = a.extend({
  3833. jqm: !0,
  3834. gb: ""
  3835. },
  3836. b || {});
  3837. if (b.onClose) {
  3838. 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);
  3839. if ("boolean" === typeof c && !c) return
  3840. }
  3841. if (a.fn.jqm && !0 === b.jqm) a(d).attr("aria-hidden", "true").jqmHide();
  3842. else {
  3843. if ("" !== b.gb) try {
  3844. a(".jqgrid-overlay:first", b.gb).hide()
  3845. } catch (g) { }
  3846. a(d).hide().attr("aria-hidden", "true")
  3847. }
  3848. },
  3849. findPos: function (a) {
  3850. var b = 0,
  3851. c = 0;
  3852. if (a.offsetParent) {
  3853. do b += a.offsetLeft,
  3854. c += a.offsetTop;
  3855. while (a = a.offsetParent)
  3856. }
  3857. return [b, c]
  3858. },
  3859. createModal: function (d, b, c, g, e, h, f) {
  3860. c = a.extend(!0, {},
  3861. a.jgrid.jqModal || {},
  3862. c);
  3863. var k = document.createElement("div"),
  3864. l,
  3865. m = this;
  3866. f = a.extend({},
  3867. f || {});
  3868. l = "rtl" === a(c.gbox).attr("dir") ? !0 : !1;
  3869. k.className = "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
  3870. k.id = d.themodal;
  3871. var n = document.createElement("div");
  3872. n.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
  3873. n.id = d.modalhead;
  3874. a(n).append("<span class='ui-jqdialog-title'>" + c.caption + "</span>");
  3875. var q = a("<a class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function () {
  3876. q.addClass("ui-state-hover")
  3877. },
  3878. function () {
  3879. q.removeClass("ui-state-hover")
  3880. }).append("<span class='ui-icon ui-icon-closethick'></span>");
  3881. a(n).append(q);
  3882. 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"));
  3883. var p = document.createElement("div");
  3884. a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id", d.modalcontent);
  3885. a(p).append(b);
  3886. k.appendChild(p);
  3887. a(k).prepend(n); !0 === h ? a("body").append(k) : "string" === typeof h ? a(h).append(k) : a(k).insertBefore(g);
  3888. a(k).css(f);
  3889. void 0 === c.jqModal && (c.jqModal = !0);
  3890. b = {};
  3891. 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),
  3892. b.top = c.top + "px",
  3893. b.left = c.left;
  3894. else if (0 !== c.left || 0 !== c.top) b.left = c.left,
  3895. b.top = c.top + "px";
  3896. a("a.ui-jqdialog-titlebar-close", n).click(function () {
  3897. var b = a("#" + a.jgrid.jqID(d.themodal)).data("onClose") || c.onClose,
  3898. e = a("#" + a.jgrid.jqID(d.themodal)).data("gbox") || c.gbox;
  3899. m.hideModal("#" + a.jgrid.jqID(d.themodal), {
  3900. gb: e,
  3901. jqm: c.jqModal,
  3902. onClose: b
  3903. });
  3904. return !1
  3905. });
  3906. 0 !== c.width && c.width || (c.width = 300);
  3907. 0 !== c.height && c.height || (c.height = 200);
  3908. c.zIndex || (g = a(g).parents("*[role=dialog]").filter(":first").css("z-index"), c.zIndex = g ? parseInt(g, 10) + 2 : 950);
  3909. g = 0;
  3910. 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));
  3911. b.left && (b.left += "px");
  3912. a(k).css(a.extend({
  3913. width: isNaN(c.width) ? "auto" : c.width + "px",
  3914. height: isNaN(c.height) ? "auto" : c.height + "px",
  3915. zIndex: c.zIndex,
  3916. overflow: "hidden"
  3917. },
  3918. b)).attr({
  3919. tabIndex: "-1",
  3920. role: "dialog",
  3921. "aria-labelledby": d.modalhead,
  3922. "aria-hidden": "true"
  3923. });
  3924. void 0 === c.drag && (c.drag = !0);
  3925. void 0 === c.resize && (c.resize = !0);
  3926. if (c.drag) if (a(n).css("cursor", "move"), a.fn.jqDrag) a(k).jqDrag(n);
  3927. else try {
  3928. a(k).draggable({
  3929. handle: a("#" + a.jgrid.jqID(n.id))
  3930. })
  3931. } catch (r) { }
  3932. 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>"),
  3933. a("#" + a.jgrid.jqID(d.themodal)).jqResize(".jqResize", d.scrollelm ? "#" + a.jgrid.jqID(d.scrollelm) : !1);
  3934. else try {
  3935. a(k).resizable({
  3936. handles: "se, sw",
  3937. alsoResize: d.scrollelm ? "#" + a.jgrid.jqID(d.scrollelm) : !1
  3938. })
  3939. } catch (s) { } !0 === c.closeOnEscape && a(k).keydown(function (b) {
  3940. 27 == b.which && (b = a("#" + a.jgrid.jqID(d.themodal)).data("onClose") || c.onClose, m.hideModal("#" + a.jgrid.jqID(d.themodal), {
  3941. gb: c.gbox,
  3942. jqm: c.jqModal,
  3943. onClose: b
  3944. }))
  3945. })
  3946. },
  3947. viewModal: function (d, b) {
  3948. b = a.extend({
  3949. toTop: !0,
  3950. overlay: 10,
  3951. modal: !1,
  3952. overlayClass: "ui-widget-overlay",
  3953. onShow: a.jgrid.showModal,
  3954. onHide: a.jgrid.closeModal,
  3955. gbox: "",
  3956. jqm: !0,
  3957. jqM: !0
  3958. },
  3959. b || {});
  3960. 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();
  3961. else {
  3962. "" !== b.gbox && (a(".jqgrid-overlay:first", b.gbox).show(), a(d).data("gbox", b.gbox));
  3963. a(d).show().attr("aria-hidden", "false");
  3964. try {
  3965. a(":input:visible", d)[0].focus()
  3966. } catch (c) { }
  3967. }
  3968. },
  3969. info_dialog: function (d, b, c, g) {
  3970. var e = {
  3971. width: 290,
  3972. height: "auto",
  3973. dataheight: "auto",
  3974. drag: !0,
  3975. resize: !1,
  3976. left: 250,
  3977. top: 170,
  3978. zIndex: 1E3,
  3979. jqModal: !0,
  3980. modal: !1,
  3981. closeOnEscape: !0,
  3982. align: "center",
  3983. buttonalign: "center",
  3984. buttons: []
  3985. };
  3986. a.extend(!0, e, a.jgrid.jqModal || {},
  3987. {
  3988. caption: "<b>" + d + "</b>"
  3989. },
  3990. g || {});
  3991. var h = e.jqModal,
  3992. f = this;
  3993. a.fn.jqm && !h && (h = !1);
  3994. d = "";
  3995. 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),
  3996. d += "<a id='" + e.buttons[g].id + "' class='fm-button ui-state-default ui-corner-all'>" + e.buttons[g].text + "</a>";
  3997. g = isNaN(e.dataheight) ? e.dataheight : e.dataheight + "px";
  3998. 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>");
  3999. 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>" : "";
  4000. b += "</div>";
  4001. try {
  4002. "false" === a("#info_dialog").attr("aria-hidden") && a.jgrid.hideModal("#info_dialog", {
  4003. jqm: h
  4004. }),
  4005. a("#info_dialog").remove()
  4006. } catch (k) { }
  4007. a.jgrid.createModal({
  4008. themodal: "info_dialog",
  4009. modalhead: "info_head",
  4010. modalcontent: "info_content",
  4011. scrollelm: "infocnt"
  4012. },
  4013. b, e, "", "", !0);
  4014. d && a.each(e.buttons,
  4015. function (b) {
  4016. a("#" + a.jgrid.jqID(this.id), "#info_id").bind("click",
  4017. function () {
  4018. e.buttons[b].onClick.call(a("#info_dialog"));
  4019. return !1
  4020. })
  4021. });
  4022. a("#closedialog", "#info_id").click(function () {
  4023. f.hideModal("#info_dialog", {
  4024. jqm: h,
  4025. onClose: a("#info_dialog").data("onClose") || e.onClose,
  4026. gb: a("#info_dialog").data("gbox") || e.gbox
  4027. });
  4028. return !1
  4029. });
  4030. a(".fm-button", "#info_dialog").hover(function () {
  4031. a(this).addClass("ui-state-hover")
  4032. },
  4033. function () {
  4034. a(this).removeClass("ui-state-hover")
  4035. });
  4036. a.isFunction(e.beforeOpen) && e.beforeOpen();
  4037. a.jgrid.viewModal("#info_dialog", {
  4038. onHide: function (a) {
  4039. a.w.hide().remove();
  4040. a.o && a.o.remove()
  4041. },
  4042. modal: e.modal,
  4043. jqm: h
  4044. });
  4045. a.isFunction(e.afterOpen) && e.afterOpen();
  4046. try {
  4047. a("#info_dialog").focus()
  4048. } catch (l) { }
  4049. },
  4050. bindEv: function (d, b) {
  4051. a.isFunction(b.dataInit) && b.dataInit.call(this, d, b);
  4052. b.dataEvents && a.each(b.dataEvents,
  4053. function () {
  4054. void 0 !== this.data ? a(d).bind(this.type, this.data, this.fn) : a(d).bind(this.type, this.fn)
  4055. })
  4056. },
  4057. createEl: function (d, b, c, g, e) {
  4058. function h(b, d, c) {
  4059. var e = "dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr custom_element custom_value".split(" ");
  4060. void 0 !== c && a.isArray(c) && a.merge(e, c);
  4061. a.each(d,
  4062. function (d, c) {
  4063. -1 === a.inArray(d, e) && a(b).attr(d, c)
  4064. });
  4065. d.hasOwnProperty("id") || a(b).attr("id", a.jgrid.randId())
  4066. }
  4067. var f = "",
  4068. k = this;
  4069. switch (d) {
  4070. case "textarea":
  4071. f = document.createElement("textarea");
  4072. g ? b.cols || a(f).css({
  4073. width: "100%"
  4074. }) : b.cols || (b.cols = 20);
  4075. b.rows || (b.rows = 2);
  4076. if ("&nbsp;" === c || "&#160;" === c || 1 === c.length && 160 === c.charCodeAt(0)) c = "";
  4077. f.value = c;
  4078. h(f, b);
  4079. a(f).attr({
  4080. role: "textbox",
  4081. multiline: "true"
  4082. });
  4083. break;
  4084. case "checkbox":
  4085. f = document.createElement("input");
  4086. f.type = "checkbox";
  4087. 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"));
  4088. h(f, b, ["value"]);
  4089. a(f).attr("role", "checkbox");
  4090. break;
  4091. case "select":
  4092. f = document.createElement("select");
  4093. f.setAttribute("role", "select");
  4094. g = []; !0 === b.multiple ? (d = !0, f.multiple = "multiple", a(f).attr("aria-multiselectable", "true")) : d = !1;
  4095. if (void 0 !== b.dataUrl) {
  4096. d = b.name ? String(b.id).substring(0, String(b.id).length - String(b.name).length - 1) : String(b.id);
  4097. var l = b.postData || e.postData;
  4098. k.p && k.p.idPrefix && (d = a.jgrid.stripPref(k.p.idPrefix, d));
  4099. a.ajax(a.extend({
  4100. url: a.isFunction(b.dataUrl) ? b.dataUrl.call(k, d, c, String(b.name)) : b.dataUrl,
  4101. type: "GET",
  4102. dataType: "html",
  4103. data: a.isFunction(l) ? l.call(k, d, c, String(b.name)) : l,
  4104. context: {
  4105. elem: f,
  4106. options: b,
  4107. vl: c
  4108. },
  4109. success: function (b) {
  4110. var d = [],
  4111. c = this.elem,
  4112. e = this.vl,
  4113. f = a.extend({},
  4114. this.options),
  4115. g = !0 === f.multiple;
  4116. b = a.isFunction(f.buildSelect) ? f.buildSelect.call(k, b) : b;
  4117. "string" === typeof b && (b = a(a.trim(b)).html());
  4118. 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,
  4119. function (b) {
  4120. return a.trim(b)
  4121. })) : d[0] = a.trim(e), setTimeout(function () {
  4122. a("option", c).each(function (b) {
  4123. 0 === b && c.multiple && (this.selected = !1);
  4124. a(this).attr("role", "option");
  4125. if (-1 < a.inArray(a.trim(a(this).text()), d) || -1 < a.inArray(a.trim(a(this).val()), d)) this.selected = "selected"
  4126. })
  4127. },
  4128. 0))
  4129. }
  4130. },
  4131. e || {}))
  4132. } else if (b.value) {
  4133. var m;
  4134. void 0 === b.size && (b.size = d ? 3 : 1);
  4135. d && (g = c.split(","), g = a.map(g,
  4136. function (b) {
  4137. return a.trim(b)
  4138. }));
  4139. "function" === typeof b.value && (b.value = b.value());
  4140. var n, q, p = void 0 === b.separator ? ":" : b.separator;
  4141. e = void 0 === b.delimiter ? ";" : b.delimiter;
  4142. if ("string" === typeof b.value) for (n = b.value.split(e), m = 0; m < n.length; m++) q = n[m].split(p),
  4143. 2 < q.length && (q[1] = a.map(q,
  4144. function (a, b) {
  4145. if (0 < b) return a
  4146. }).join(p)),
  4147. e = document.createElement("option"),
  4148. e.setAttribute("role", "option"),
  4149. e.value = q[0],
  4150. e.innerHTML = q[1],
  4151. f.appendChild(e),
  4152. d || a.trim(q[0]) !== a.trim(c) && a.trim(q[1]) !== a.trim(c) || (e.selected = "selected"),
  4153. d && (-1 < a.inArray(a.trim(q[1]), g) || -1 < a.inArray(a.trim(q[0]), g)) && (e.selected = "selected");
  4154. 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"));
  4155. h(f, b, ["value"])
  4156. }
  4157. break;
  4158. case "text":
  4159. case "password":
  4160. case "button":
  4161. m = "button" === d ? "button" : "textbox";
  4162. f = document.createElement("input");
  4163. f.type = d;
  4164. f.value = c;
  4165. h(f, b);
  4166. "button" !== d && (g ? b.size || a(f).css({
  4167. width: "100%"
  4168. }) : b.size || (b.size = 20));
  4169. a(f).attr("role", m);
  4170. break;
  4171. case "image":
  4172. case "file":
  4173. f = document.createElement("input");
  4174. f.type = d;
  4175. h(f, b);
  4176. break;
  4177. case "custom":
  4178. f = document.createElement("span");
  4179. try {
  4180. if (a.isFunction(b.custom_element)) if (p = b.custom_element.call(k, c, b)) p = a(p).addClass("customelement").attr({
  4181. id: b.id,
  4182. name: b.name
  4183. }),
  4184. a(f).empty().append(p);
  4185. else throw "e2";
  4186. else throw "e1";
  4187. } catch (r) {
  4188. "e1" === r && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  4189. "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)
  4190. }
  4191. }
  4192. return f
  4193. },
  4194. checkDate: function (a, b) {
  4195. var c = {},
  4196. g;
  4197. a = a.toLowerCase();
  4198. g = -1 !== a.indexOf("/") ? "/" : -1 !== a.indexOf("-") ? "-" : -1 !== a.indexOf(".") ? "." : "/";
  4199. a = a.split(g);
  4200. b = b.split(g);
  4201. if (3 !== b.length) return !1;
  4202. var e = -1,
  4203. h, f = g = -1,
  4204. k;
  4205. for (k = 0; k < a.length; k++) h = isNaN(b[k]) ? 0 : parseInt(b[k], 10),
  4206. c[a[k]] = h,
  4207. h = a[k],
  4208. -1 !== h.indexOf("y") && (e = k),
  4209. -1 !== h.indexOf("m") && (f = k),
  4210. -1 !== h.indexOf("d") && (g = k);
  4211. h = "y" === a[e] || "yyyy" === a[e] ? 4 : "yy" === a[e] ? 2 : -1;
  4212. k = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  4213. var l;
  4214. if (-1 === e) return !1;
  4215. l = c[a[e]].toString();
  4216. 2 === h && 1 === l.length && (h = 1);
  4217. if (l.length !== h || 0 === c[a[e]] && "00" !== b[e] || -1 === f) return !1;
  4218. l = c[a[f]].toString();
  4219. if (1 > l.length || 1 > c[a[f]] || 12 < c[a[f]] || -1 === g) return !1;
  4220. l = c[a[g]].toString();
  4221. if (!(h = 1 > l.length) && !(h = 1 > c[a[g]]) && !(h = 31 < c[a[g]])) {
  4222. if (h = 2 === c[a[f]]) e = c[a[e]],
  4223. h = c[a[g]] > (0 !== e % 4 || 0 === e % 100 && 0 !== e % 400 ? 28 : 29);
  4224. h = h || c[a[g]] > k[c[a[f]]]
  4225. }
  4226. return h ? !1 : !0
  4227. },
  4228. isEmpty: function (a) {
  4229. return a.match(/^\s+$/) || "" === a ? !0 : !1
  4230. },
  4231. checkTime: function (d) {
  4232. var b = /^(\d{1,2}):(\d{2})([apAP][Mm])?$/;
  4233. if (!a.jgrid.isEmpty(d)) if (d = d.match(b)) {
  4234. if (d[3]) {
  4235. if (1 > d[1] || 12 < d[1]) return !1
  4236. } else if (23 < d[1]) return !1;
  4237. if (59 < d[2]) return !1
  4238. } else return !1;
  4239. return !0
  4240. },
  4241. checkValues: function (d, b, c, g) {
  4242. var e, h, f;
  4243. f = this.p.colModel;
  4244. if (void 0 === c) if ("string" === typeof b) for (c = 0, g = f.length; c < g; c++) {
  4245. if (f[c].name === b) {
  4246. e = f[c].editrules;
  4247. b = c;
  4248. null != f[c].formoptions && (h = f[c].formoptions.label);
  4249. break
  4250. }
  4251. } else 0 <= b && (e = f[b].editrules);
  4252. else e = c,
  4253. h = void 0 === g ? "_" : g;
  4254. if (e) {
  4255. h || (h = null != this.p.colNames ? this.p.colNames[b] : f[b].label);
  4256. if (!0 === e.required && a.jgrid.isEmpty(d)) return [!1, h + ": " + a.jgrid.edit.msg.required, ""];
  4257. c = !1 === e.required ? !1 : !0;
  4258. if (!0 === e.number && (!1 !== c || !a.jgrid.isEmpty(d)) && isNaN(d)) return [!1, h + ": " + a.jgrid.edit.msg.number, ""];
  4259. if (void 0 !== e.minValue && !isNaN(e.minValue) && parseFloat(d) < parseFloat(e.minValue)) return [!1, h + ": " + a.jgrid.edit.msg.minValue + " " + e.minValue, ""];
  4260. if (void 0 !== e.maxValue && !isNaN(e.maxValue) && parseFloat(d) > parseFloat(e.maxValue)) return [!1, h + ": " + a.jgrid.edit.msg.maxValue + " " + e.maxValue, ""];
  4261. 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, ""];
  4262. 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, ""];
  4263. 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, ""];
  4264. 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)", ""];
  4265. 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, ""];
  4266. 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, ""]
  4267. }
  4268. return [!0, "", ""]
  4269. }
  4270. })
  4271. })(jQuery); (function (a) {
  4272. var b = {};
  4273. a.jgrid.extend({
  4274. searchGrid: function (b) {
  4275. b = a.extend(!0, {
  4276. recreateFilter: !1,
  4277. drag: !0,
  4278. sField: "searchField",
  4279. sValue: "searchString",
  4280. sOper: "searchOper",
  4281. sFilter: "filters",
  4282. loadDefaults: !0,
  4283. beforeShowSearch: null,
  4284. afterShowSearch: null,
  4285. onInitializeSearch: null,
  4286. afterRedraw: null,
  4287. afterChange: null,
  4288. closeAfterSearch: !1,
  4289. closeAfterReset: !1,
  4290. closeOnEscape: !1,
  4291. searchOnEnter: !1,
  4292. multipleSearch: !1,
  4293. multipleGroup: !1,
  4294. top: 0,
  4295. left: 0,
  4296. jqModal: !0,
  4297. modal: !1,
  4298. resize: !0,
  4299. width: 450,
  4300. height: "auto",
  4301. dataheight: "auto",
  4302. showQuery: !1,
  4303. errorcheck: !0,
  4304. sopt: null,
  4305. stringResult: void 0,
  4306. onClose: null,
  4307. onSearch: null,
  4308. onReset: null,
  4309. toTop: !0,
  4310. overlay: 30,
  4311. columns: [],
  4312. tmplNames: null,
  4313. tmplFilters: null,
  4314. tmplLabel: " Template: ",
  4315. showOnLoad: !1,
  4316. layer: null,
  4317. operands: {
  4318. eq: "=",
  4319. ne: "<>",
  4320. lt: "<",
  4321. le: "<=",
  4322. gt: ">",
  4323. ge: ">=",
  4324. bw: "LIKE",
  4325. bn: "NOT LIKE",
  4326. "in": "IN",
  4327. ni: "NOT IN",
  4328. ew: "LIKE",
  4329. en: "NOT LIKE",
  4330. cn: "LIKE",
  4331. nc: "NOT LIKE",
  4332. nu: "IS NULL",
  4333. nn: "ISNOT NULL"
  4334. }
  4335. },
  4336. a.jgrid.search, b || {});
  4337. return this.each(function () {
  4338. function c(c) {
  4339. w = a(e).triggerHandler("jqGridFilterBeforeShow", [c]);
  4340. void 0 === w && (w = !0);
  4341. w && a.isFunction(b.beforeShowSearch) && (w = b.beforeShowSearch.call(e, c));
  4342. w && (a.jgrid.viewModal("#" + a.jgrid.jqID(s.themodal), {
  4343. gbox: "#gbox_" + a.jgrid.jqID(h),
  4344. jqm: b.jqModal,
  4345. modal: b.modal,
  4346. overlay: b.overlay,
  4347. toTop: b.toTop
  4348. }), a(e).triggerHandler("jqGridFilterAfterShow", [c]), a.isFunction(b.afterShowSearch) && b.afterShowSearch.call(e, c))
  4349. }
  4350. var e = this;
  4351. if (e.grid) {
  4352. var h = "fbox_" + e.p.id,
  4353. w = !0,
  4354. t = !0,
  4355. s = {
  4356. themodal: "searchmod" + h,
  4357. modalhead: "searchhd" + h,
  4358. modalcontent: "searchcnt" + h,
  4359. scrollelm: h
  4360. },
  4361. r = e.p.postData[b.sFilter];
  4362. "string" === typeof r && (r = a.jgrid.parse(r)); !0 === b.recreateFilter && a("#" + a.jgrid.jqID(s.themodal)).remove();
  4363. if (void 0 !== a("#" + a.jgrid.jqID(s.themodal))[0]) c(a("#fbox_" + a.jgrid.jqID(+e.p.id)));
  4364. else {
  4365. var f = a("<div><div id='" + h + "' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_" + a.jgrid.jqID(e.p.id)),
  4366. k = "left",
  4367. u = "";
  4368. "rtl" === e.p.direction && (k = "right", u = " style='text-align:left'", f.attr("dir", "rtl"));
  4369. var x = a.extend([], e.p.colModel),
  4370. 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>",
  4371. 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>",
  4372. g = "",
  4373. m = "",
  4374. p,
  4375. q = !1,
  4376. y = -1;
  4377. 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>");
  4378. b.columns.length ? (x = b.columns, y = 0, p = x[0].index || x[0].name) : a.each(x,
  4379. function (a, b) {
  4380. b.label || (b.label = e.p.colNames[a]);
  4381. if (!q) {
  4382. var c = void 0 === b.search ? !0 : b.search,
  4383. d = !0 === b.hidden;
  4384. if (b.searchoptions && !0 === b.searchoptions.searchhidden && c || c && !d) q = !0,
  4385. p = b.index || b.name,
  4386. y = a
  4387. }
  4388. });
  4389. if (!r && p || !1 === b.multipleSearch) {
  4390. var D = "eq";
  4391. 0 <= y && x[y].searchoptions && x[y].searchoptions.sopt ? D = x[y].searchoptions.sopt[0] : b.sopt && b.sopt.length && (D = b.sopt[0]);
  4392. r = {
  4393. groupOp: "AND",
  4394. rules: [{
  4395. field: p,
  4396. op: D,
  4397. data: ""
  4398. }]
  4399. }
  4400. }
  4401. q = !1;
  4402. 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,
  4403. function (a, b) {
  4404. m += "<option value='" + a + "'>" + b + "</option>"
  4405. }), m += "</select>");
  4406. 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>";
  4407. h = a.jgrid.jqID(h);
  4408. a("#" + h).jqFilter({
  4409. columns: x,
  4410. filter: b.loadDefaults ? r : null,
  4411. showQuery: b.showQuery,
  4412. errorcheck: b.errorcheck,
  4413. sopt: b.sopt,
  4414. groupButton: b.multipleGroup,
  4415. ruleButtons: b.multipleSearch,
  4416. afterRedraw: b.afterRedraw,
  4417. ops: b.odata,
  4418. operands: b.operands,
  4419. ajaxSelectOptions: e.p.ajaxSelectOptions,
  4420. groupOps: b.groupOps,
  4421. onChange: function () {
  4422. this.p.showQuery && a(".query", this).html(this.toUserFriendlyString());
  4423. a.isFunction(b.afterChange) && b.afterChange.call(e, a("#" + h), b)
  4424. },
  4425. direction: e.p.direction,
  4426. id: e.p.id
  4427. });
  4428. f.append(k);
  4429. q && b.tmplFilters && b.tmplFilters.length && a(".ui-template", f).bind("change",
  4430. function () {
  4431. var c = a(this).val();
  4432. "default" === c ? a("#" + h).jqFilter("addFilter", r) : a("#" + h).jqFilter("addFilter", b.tmplFilters[parseInt(c, 10)]);
  4433. return !1
  4434. }); !0 === b.multipleGroup && (b.multipleSearch = !0);
  4435. a(e).triggerHandler("jqGridFilterInitialize", [a("#" + h)]);
  4436. a.isFunction(b.onInitializeSearch) && b.onInitializeSearch.call(e, a("#" + h));
  4437. b.gbox = "#gbox_" + h;
  4438. 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), {
  4439. position: "relative"
  4440. }) : 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) {
  4441. var d = a(c.target);
  4442. 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(),
  4443. !1;
  4444. if (b.closeOnEscape && 27 === c.which) return a("#" + a.jgrid.jqID(s.modalhead)).find(".ui-jqdialog-titlebar-close").click(),
  4445. !1
  4446. });
  4447. g && a("#" + h + "_query").bind("click",
  4448. function () {
  4449. a(".queryresult", f).toggle();
  4450. return !1
  4451. });
  4452. void 0 === b.stringResult && (b.stringResult = b.multipleSearch);
  4453. a("#" + h + "_search").bind("click",
  4454. function () {
  4455. var c = a("#" + h),
  4456. d = {},
  4457. n,
  4458. g;
  4459. c.find(".input-elm:focus").change();
  4460. g = c.jqFilter("filterData");
  4461. if (b.errorcheck && (c[0].hideError(), b.showQuery || c.jqFilter("toSQLString"), c[0].p.error)) return c[0].showError(),
  4462. !1;
  4463. if (b.stringResult) {
  4464. try {
  4465. n = xmlJsonClass.toJson(g, "", "", !1)
  4466. } catch (f) {
  4467. try {
  4468. n = JSON.stringify(g)
  4469. } catch (k) { }
  4470. }
  4471. "string" === typeof n && (d[b.sFilter] = n, a.each([b.sField, b.sValue, b.sOper],
  4472. function () {
  4473. d[this] = ""
  4474. }))
  4475. } else b.multipleSearch ? (d[b.sFilter] = g, a.each([b.sField, b.sValue, b.sOper],
  4476. function () {
  4477. d[this] = ""
  4478. })) : (d[b.sField] = g.rules[0].field, d[b.sValue] = g.rules[0].data, d[b.sOper] = g.rules[0].op, d[b.sFilter] = "");
  4479. e.p.search = !0;
  4480. a.extend(e.p.postData, d);
  4481. t = a(e).triggerHandler("jqGridFilterSearch");
  4482. void 0 === t && (t = !0);
  4483. t && a.isFunction(b.onSearch) && (t = b.onSearch.call(e, e.p.filters)); !1 !== t && a(e).trigger("reloadGrid", [{
  4484. page: 1
  4485. }]);
  4486. b.closeAfterSearch && a.jgrid.hideModal("#" + a.jgrid.jqID(s.themodal), {
  4487. gb: "#gbox_" + a.jgrid.jqID(e.p.id),
  4488. jqm: b.jqModal,
  4489. onClose: b.onClose
  4490. });
  4491. return !1
  4492. });
  4493. a("#" + h + "_reset").bind("click",
  4494. function () {
  4495. var c = {},
  4496. d = a("#" + h);
  4497. e.p.search = !1;
  4498. e.p.resetsearch = !0; !1 === b.multipleSearch ? c[b.sField] = c[b.sValue] = c[b.sOper] = "" : c[b.sFilter] = "";
  4499. d[0].resetFilter();
  4500. q && a(".ui-template", f).val("default");
  4501. a.extend(e.p.postData, c);
  4502. t = a(e).triggerHandler("jqGridFilterReset");
  4503. void 0 === t && (t = !0);
  4504. t && a.isFunction(b.onReset) && (t = b.onReset.call(e)); !1 !== t && a(e).trigger("reloadGrid", [{
  4505. page: 1
  4506. }]);
  4507. b.closeAfterReset && a.jgrid.hideModal("#" + a.jgrid.jqID(s.themodal), {
  4508. gb: "#gbox_" + a.jgrid.jqID(e.p.id),
  4509. jqm: b.jqModal,
  4510. onClose: b.onClose
  4511. });
  4512. return !1
  4513. });
  4514. c(a("#" + h));
  4515. a(".fm-button:not(.ui-state-disabled)", f).hover(function () {
  4516. a(this).addClass("ui-state-hover")
  4517. },
  4518. function () {
  4519. a(this).removeClass("ui-state-hover")
  4520. })
  4521. }
  4522. }
  4523. })
  4524. },
  4525. editGridRow: function (z, c) {
  4526. c = a.extend(!0, {
  4527. top: 0,
  4528. left: 0,
  4529. width: 300,
  4530. datawidth: "auto",
  4531. height: "auto",
  4532. dataheight: "auto",
  4533. modal: !1,
  4534. overlay: 30,
  4535. drag: !0,
  4536. resize: !0,
  4537. url: null,
  4538. mtype: "POST",
  4539. clearAfterAdd: !0,
  4540. closeAfterEdit: !1,
  4541. reloadAfterSubmit: !0,
  4542. onInitializeForm: null,
  4543. beforeInitData: null,
  4544. beforeShowForm: null,
  4545. afterShowForm: null,
  4546. beforeSubmit: null,
  4547. afterSubmit: null,
  4548. onclickSubmit: null,
  4549. afterComplete: null,
  4550. onclickPgButtons: null,
  4551. afterclickPgButtons: null,
  4552. editData: {},
  4553. recreateForm: !1,
  4554. jqModal: !0,
  4555. closeOnEscape: !1,
  4556. addedrow: "first",
  4557. topinfo: "",
  4558. bottominfo: "",
  4559. saveicon: [],
  4560. closeicon: [],
  4561. savekey: [!1, 13],
  4562. navkeys: [!1, 38, 40],
  4563. checkOnSubmit: !1,
  4564. checkOnUpdate: !1,
  4565. _savedData: {},
  4566. processing: !1,
  4567. onClose: null,
  4568. ajaxEditOptions: {},
  4569. serializeEditData: null,
  4570. viewPagerButtons: !0,
  4571. overlayClass: "ui-widget-overlay"
  4572. },
  4573. a.jgrid.edit, c || {});
  4574. b[a(this)[0].p.id] = c;
  4575. return this.each(function () {
  4576. function e() {
  4577. a(p + " > tbody > tr > td > .FormElement").each(function () {
  4578. var b = a(".customelement", this);
  4579. if (b.length) {
  4580. var c = a(b[0]).attr("name");
  4581. a.each(d.p.colModel,
  4582. function () {
  4583. if (this.name === c && this.editoptions && a.isFunction(this.editoptions.custom_value)) {
  4584. try {
  4585. if (l[c] = this.editoptions.custom_value.call(d, a("#" + a.jgrid.jqID(c), p), "get"), void 0 === l[c]) throw "e1";
  4586. } catch (b) {
  4587. "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)
  4588. }
  4589. return !0
  4590. }
  4591. })
  4592. } else {
  4593. switch (a(this).get(0).type) {
  4594. case "checkbox":
  4595. a(this).is(":checked") ? l[this.name] = a(this).val() : (b = a(this).attr("offval"), l[this.name] = b);
  4596. break;
  4597. case "select-one":
  4598. l[this.name] = a("option:selected", this).val();
  4599. break;
  4600. case "select-multiple":
  4601. l[this.name] = a(this).val();
  4602. l[this.name] = l[this.name] ? l[this.name].join(",") : "";
  4603. a("option:selected", this).each(function (b, c) {
  4604. a(c).text()
  4605. });
  4606. break;
  4607. case "password":
  4608. case "text":
  4609. case "textarea":
  4610. case "button":
  4611. l[this.name] = a(this).val()
  4612. }
  4613. d.p.autoencode && (l[this.name] = a.jgrid.htmlEncode(l[this.name]))
  4614. }
  4615. });
  4616. return !0
  4617. }
  4618. function h(c, e, n, f) {
  4619. var k, l, p, h = 0,
  4620. q, m, r, C = [],
  4621. u = !1,
  4622. z = "",
  4623. t;
  4624. for (t = 1; t <= f; t++) z += "<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";
  4625. "_empty" !== c && (u = a(e).jqGrid("getInd", c));
  4626. a(e.p.colModel).each(function (t) {
  4627. k = this.name;
  4628. m = (l = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) ? "style='display:none'" : "";
  4629. if ("cb" !== k && "subgrid" !== k && !0 === this.editable && "rn" !== k) {
  4630. if (!1 === u) q = "";
  4631. else if (k === e.p.ExpandColumn && !0 === e.p.treeGrid) q = a("td[role='gridcell']:eq(" + t + ")", e.rows[u]).text();
  4632. else {
  4633. try {
  4634. q = a.unformat.call(e, a("td[role='gridcell']:eq(" + t + ")", e.rows[u]), {
  4635. rowId: c,
  4636. colModel: this
  4637. },
  4638. t)
  4639. } catch (w) {
  4640. 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()
  4641. }
  4642. if (!q || "&nbsp;" === q || "&#160;" === q || 1 === q.length && 160 === q.charCodeAt(0)) q = ""
  4643. }
  4644. var s = a.extend({},
  4645. this.editoptions || {},
  4646. {
  4647. id: k,
  4648. name: k
  4649. }),
  4650. y = a.extend({},
  4651. {
  4652. elmprefix: "",
  4653. elmsuffix: "",
  4654. rowabove: !1,
  4655. rowcontent: ""
  4656. },
  4657. this.formoptions || {}),
  4658. v = parseInt(y.rowpos, 10) || h + 1,
  4659. A = parseInt(2 * (parseInt(y.colpos, 10) || 1), 10);
  4660. "_empty" === c && s.defaultValue && (q = a.isFunction(s.defaultValue) ? s.defaultValue.call(d) : s.defaultValue);
  4661. this.edittype || (this.edittype = "text");
  4662. d.p.autoencode && (q = a.jgrid.htmlDecode(q));
  4663. r = a.jgrid.createEl.call(d, this.edittype, s, q, !1, a.extend({},
  4664. a.jgrid.ajaxOptions, e.p.ajaxSelectOptions || {}));
  4665. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData[k] = q;
  4666. a(r).addClass("FormElement"); -1 < a.inArray(this.edittype, ["text", "textarea", "password", "select"]) && a(r).addClass("ui-widget-content ui-corner-all");
  4667. p = a(n).find("tr[rowpos=" + v + "]");
  4668. if (y.rowabove) {
  4669. var x = a("<tr><td class='contentinfo' colspan='" + 2 * f + "'>" + y.rowcontent + "</td></tr>");
  4670. a(n).append(x);
  4671. x[0].rp = v
  4672. }
  4673. 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);
  4674. a("td:eq(" + (A - 2) + ")", p[0]).html(void 0 === y.label ? e.p.colNames[t] : y.label);
  4675. a("td:eq(" + (A - 1) + ")", p[0]).append(y.elmprefix).append(r).append(y.elmsuffix);
  4676. "custom" === this.edittype && a.isFunction(s.custom_value) && s.custom_value.call(d, a("#" + k, "#" + g), "set", q);
  4677. a.jgrid.bindEv.call(d, r, s);
  4678. C[h] = t;
  4679. h++
  4680. }
  4681. });
  4682. 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);
  4683. return C
  4684. }
  4685. function w(c, e, n) {
  4686. var g, k = 0,
  4687. f, l, q, h, r;
  4688. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData = {},
  4689. b[d.p.id]._savedData[e.p.id + "_id"] = c;
  4690. var m = e.p.colModel;
  4691. if ("_empty" === c) a(m).each(function () {
  4692. g = this.name;
  4693. q = a.extend({},
  4694. 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)
  4695. }),
  4696. a("#id_g", "#" + n).val(c);
  4697. else {
  4698. var t = a(e).jqGrid("getInd", c, !0);
  4699. t && (a('td[role="gridcell"]', t).each(function (l) {
  4700. g = m[l].name;
  4701. if ("cb" !== g && "subgrid" !== g && "rn" !== g && !0 === m[l].editable) {
  4702. if (g === e.p.ExpandColumn && !0 === e.p.treeGrid) f = a(this).text();
  4703. else try {
  4704. f = a.unformat.call(e, a(this), {
  4705. rowId: c,
  4706. colModel: m[l]
  4707. },
  4708. l)
  4709. } catch (q) {
  4710. f = "textarea" === m[l].edittype ? a(this).text() : a(this).html()
  4711. }
  4712. d.p.autoencode && (f = a.jgrid.htmlDecode(f));
  4713. if (!0 === b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData[g] = f;
  4714. g = a.jgrid.jqID(g);
  4715. switch (m[l].edittype) {
  4716. case "password":
  4717. case "text":
  4718. case "button":
  4719. case "image":
  4720. case "textarea":
  4721. if ("&nbsp;" === f || "&#160;" === f || 1 === f.length && 160 === f.charCodeAt(0)) f = "";
  4722. a("#" + g, "#" + n).val(f);
  4723. break;
  4724. case "select":
  4725. var h = f.split(","),
  4726. h = a.map(h,
  4727. function (b) {
  4728. return a.trim(b)
  4729. });
  4730. a("#" + g + " option", "#" + n).each(function () {
  4731. 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
  4732. });
  4733. break;
  4734. case "checkbox":
  4735. f = String(f);
  4736. if (m[l].editoptions && m[l].editoptions.value) if (m[l].editoptions.value.split(":")[0] === f) a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]({
  4737. checked: !0,
  4738. defaultChecked: !0
  4739. });
  4740. else a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]({
  4741. checked: !1,
  4742. defaultChecked: !1
  4743. });
  4744. else f = f.toLowerCase(),
  4745. 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));
  4746. break;
  4747. case "custom":
  4748. try {
  4749. if (m[l].editoptions && a.isFunction(m[l].editoptions.custom_value)) m[l].editoptions.custom_value.call(d, a("#" + g, "#" + n), "set", f);
  4750. else throw "e1";
  4751. } catch (p) {
  4752. "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)
  4753. }
  4754. }
  4755. k++
  4756. }
  4757. }), 0 < k && a("#id_g", p).val(c))
  4758. }
  4759. }
  4760. function t() {
  4761. a.each(d.p.colModel,
  4762. function (a, b) {
  4763. b.editoptions && !0 === b.editoptions.NullIfEmpty && l.hasOwnProperty(b.name) && "" === l[b.name] && (l[b.name] = "null")
  4764. })
  4765. }
  4766. function s() {
  4767. var e, n = [!0, "", ""],
  4768. f = {},
  4769. k = d.p.prmNames,
  4770. h,
  4771. m,
  4772. r,
  4773. u,
  4774. s,
  4775. C = a(d).triggerHandler("jqGridAddEditBeforeCheckValues", [a("#" + g), B]);
  4776. C && "object" === typeof C && (l = C);
  4777. a.isFunction(b[d.p.id].beforeCheckValues) && (C = b[d.p.id].beforeCheckValues.call(d, l, a("#" + g), B)) && "object" === typeof C && (l = C);
  4778. for (r in l) if (l.hasOwnProperty(r) && (n = a.jgrid.checkValues.call(d, l[r], r), !1 === n[0])) break;
  4779. t();
  4780. 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)));
  4781. if (n[0] && !b[d.p.id].processing) {
  4782. b[d.p.id].processing = !0;
  4783. a("#sData", p + "_2").addClass("ui-state-active");
  4784. m = k.oper;
  4785. h = k.id;
  4786. l[m] = "_empty" === a.trim(l[d.p.id + "_id"]) ? k.addoper : k.editoper;
  4787. l[m] !== k.addoper ? l[h] = l[d.p.id + "_id"] : void 0 === l[h] && (l[h] = l[d.p.id + "_id"]);
  4788. delete l[d.p.id + "_id"];
  4789. l = a.extend(l, b[d.p.id].editData, f);
  4790. 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]);
  4791. l[h] = a.jgrid.stripPref(d.p.idPrefix, l[h]);
  4792. s = a.extend({
  4793. url: b[d.p.id].url || a(d).jqGrid("getGridParam", "editurl"),
  4794. type: b[d.p.id].mtype,
  4795. data: a.isFunction(b[d.p.id].serializeEditData) ? b[d.p.id].serializeEditData.call(d, l) : l,
  4796. complete: function (f, r) {
  4797. var s;
  4798. l[h] = d.p.idPrefix + l[h];
  4799. 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)));
  4800. if (!1 === n[0]) a("#FormError>td", p).html(n[1]),
  4801. a("#FormError", p).show();
  4802. else if (d.p.autoencode && a.each(l,
  4803. function (b, c) {
  4804. l[b] = a.jgrid.htmlDecode(c)
  4805. }), 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), {
  4806. gb: "#gbox_" + a.jgrid.jqID(v),
  4807. jqm: c.jqModal,
  4808. onClose: b[d.p.id].onClose
  4809. })) : 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 () {
  4810. a(d).jqGrid("setSelection", l[h])
  4811. },
  4812. 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), {
  4813. gb: "#gbox_" + a.jgrid.jqID(v),
  4814. jqm: c.jqModal,
  4815. onClose: b[d.p.id].onClose
  4816. })), a.isFunction(b[d.p.id].afterComplete) && (e = f, setTimeout(function () {
  4817. a(d).triggerHandler("jqGridAddEditAfterComplete", [e, l, a("#" + g), B]);
  4818. b[d.p.id].afterComplete.call(d, e, l, a("#" + g), B);
  4819. e = null
  4820. },
  4821. 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]);
  4822. b[d.p.id].processing = !1;
  4823. a("#sData", p + "_2").removeClass("ui-state-active");
  4824. try {
  4825. a(":input:visible", "#" + g)[0].focus()
  4826. } catch (t) { }
  4827. }
  4828. },
  4829. a.jgrid.ajaxOptions, b[d.p.id].ajaxEditOptions);
  4830. 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));
  4831. 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), {
  4832. gb: "#gbox_" + a.jgrid.jqID(v),
  4833. jqm: c.jqModal,
  4834. onClose: b[d.p.id].onClose
  4835. }), s.data.oper === k.editoper && b[d.p.id].closeAfterEdit && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4836. gb: "#gbox_" + a.jgrid.jqID(v),
  4837. jqm: c.jqModal,
  4838. onClose: b[d.p.id].onClose
  4839. }))) : a.ajax(s))
  4840. } !1 === n[0] && (a("#FormError>td", p).html(n[1]), a("#FormError", p).show())
  4841. }
  4842. function r(a, b) {
  4843. var c = !1,
  4844. d;
  4845. for (d in a) if (a.hasOwnProperty(d) && a[d] != b[d]) {
  4846. c = !0;
  4847. break
  4848. }
  4849. return c
  4850. }
  4851. function f() {
  4852. var c = !0;
  4853. a("#FormError", p).hide();
  4854. b[d.p.id].checkOnUpdate && (l = {},
  4855. e(), M = r(l, b[d.p.id]._savedData)) && (a("#" + g).data("disabled", !0), a(".confirm", "#" + q.themodal).show(), c = !1);
  4856. return c
  4857. }
  4858. function k() {
  4859. var b;
  4860. 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) {
  4861. a(d).jqGrid("restoreRow", z);
  4862. break
  4863. }
  4864. }
  4865. function u(b, c) {
  4866. var d = c[1].length - 1;
  4867. 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");
  4868. 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")
  4869. }
  4870. function x() {
  4871. var b = a(d).jqGrid("getDataIDs"),
  4872. c = a("#id_g", p).val();
  4873. return [a.inArray(c, b), b]
  4874. }
  4875. var d = this;
  4876. if (d.grid && z) {
  4877. var v = d.p.id,
  4878. g = "FrmGrid_" + v,
  4879. m = "TblGrid_" + v,
  4880. p = "#" + a.jgrid.jqID(m),
  4881. q = {
  4882. themodal: "editmod" + v,
  4883. modalhead: "edithd" + v,
  4884. modalcontent: "editcnt" + v,
  4885. scrollelm: g
  4886. },
  4887. y = a.isFunction(b[d.p.id].beforeShowForm) ? b[d.p.id].beforeShowForm : !1,
  4888. D = a.isFunction(b[d.p.id].afterShowForm) ? b[d.p.id].afterShowForm : !1,
  4889. A = a.isFunction(b[d.p.id].beforeInitData) ? b[d.p.id].beforeInitData : !1,
  4890. E = a.isFunction(b[d.p.id].onInitializeForm) ? b[d.p.id].onInitializeForm : !1,
  4891. n = !0,
  4892. C = 1,
  4893. I = 0,
  4894. l,
  4895. M,
  4896. B,
  4897. g = a.jgrid.jqID(g);
  4898. "new" === z ? (z = "_empty", B = "add", c.caption = b[d.p.id].addCaption) : (c.caption = b[d.p.id].editCaption, B = "edit");
  4899. c.recreateForm || a(d).data("formProp") && a.extend(b[a(this)[0].p.id], a(d).data("formProp"));
  4900. var N = !0;
  4901. c.checkOnUpdate && c.jqModal && !c.modal && (N = !1);
  4902. 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",
  4903. n = isNaN(b[a(this)[0].p.id].datawidth) ? b[a(this)[0].p.id].datawidth : b[a(this)[0].p.id].datawidth + "px",
  4904. 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),
  4905. F = a("<table id='" + m + "' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  4906. n = a(d).triggerHandler("jqGridAddEditBeforeInitData", [a("#" + g), B]);
  4907. void 0 === n && (n = !0);
  4908. n && A && (n = A.call(d, a("#" + g), B));
  4909. if (!1 !== n) {
  4910. k();
  4911. a(d.p.colModel).each(function () {
  4912. var a = this.formoptions;
  4913. C = Math.max(C, a ? a.colpos || 0 : 0);
  4914. I = Math.max(I, a ? a.rowpos || 0 : 0)
  4915. });
  4916. a(H).append(F);
  4917. A = a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='" + 2 * C + "'></td></tr>");
  4918. A[0].rp = 0;
  4919. a(F).append(A);
  4920. A = a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='" + 2 * C + "'>" + b[d.p.id].topinfo + "</td></tr>");
  4921. A[0].rp = 0;
  4922. a(F).append(A);
  4923. var n = (A = "rtl" === d.p.direction ? !0 : !1) ? "nData" : "pData",
  4924. G = A ? "pData" : "nData";
  4925. h(z, d, F, C);
  4926. 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>",
  4927. G = "<a id='" + G + "' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
  4928. J = "<a id='sData' class='fm-button ui-state-default ui-corner-all'>" + c.bSubmit + "</a>",
  4929. K = "<a id='cData' class='fm-button ui-state-default ui-corner-all'>" + c.bCancel + "</a>",
  4930. 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>"),
  4931. m = m + "</tbody></table>";
  4932. if (0 < I) {
  4933. var L = [];
  4934. a.each(a(F)[0].rows,
  4935. function (a, b) {
  4936. L[a] = b
  4937. });
  4938. L.sort(function (a, b) {
  4939. return a.rp > b.rp ? 1 : a.rp < b.rp ? -1 : 0
  4940. });
  4941. a.each(L,
  4942. function (b, c) {
  4943. a("tbody", F).append(c)
  4944. })
  4945. }
  4946. c.gbox = "#gbox_" + a.jgrid.jqID(v);
  4947. var O = !1; !0 === c.closeOnEscape && (c.closeOnEscape = !1, O = !0);
  4948. m = a("<div></div>").append(H).append(m);
  4949. 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]);
  4950. A && (a("#pData, #nData", p + "_2").css("float", "right"), a(".EditButton", p + "_2").css("text-align", "left"));
  4951. b[d.p.id].topinfo && a(".tinfo", p).show();
  4952. b[d.p.id].bottominfo && a(".binfo", p + "_2").show();
  4953. m = m = null;
  4954. a("#" + a.jgrid.jqID(q.themodal)).keydown(function (e) {
  4955. var n = e.target;
  4956. if (!0 === a("#" + g).data("disabled")) return !1;
  4957. 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"),
  4958. !1;
  4959. if (27 === e.which) {
  4960. if (!f()) return !1;
  4961. O && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4962. gb: c.gbox,
  4963. jqm: c.jqModal,
  4964. onClose: b[d.p.id].onClose
  4965. });
  4966. return !1
  4967. }
  4968. if (!0 === b[d.p.id].navkeys[0]) {
  4969. if ("_empty" === a("#id_g", p).val()) return !0;
  4970. if (e.which === b[d.p.id].navkeys[1]) return a("#pData", p + "_2").trigger("click"),
  4971. !1;
  4972. if (e.which === b[d.p.id].navkeys[2]) return a("#nData", p + "_2").trigger("click"),
  4973. !1
  4974. }
  4975. });
  4976. 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 () {
  4977. if (!f()) return !1;
  4978. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4979. gb: "#gbox_" + a.jgrid.jqID(v),
  4980. jqm: c.jqModal,
  4981. onClose: b[d.p.id].onClose
  4982. });
  4983. return !1
  4984. }));
  4985. c.saveicon = a.extend([!0, "left", "ui-icon-disk"], c.saveicon);
  4986. 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>");
  4987. 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>",
  4988. G = "<a id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bNo + "</a>",
  4989. K = "<a id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bExit + "</a>",
  4990. m = c.zIndex || 999,
  4991. m++,
  4992. 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),
  4993. a("#sNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  4994. s();
  4995. a("#" + g).data("disabled", !1);
  4996. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  4997. return !1
  4998. }),
  4999. a("#nNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  5000. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  5001. a("#" + g).data("disabled", !1);
  5002. setTimeout(function () {
  5003. a(":input:visible", "#" + g)[0].focus()
  5004. },
  5005. 0);
  5006. return !1
  5007. }),
  5008. a("#cNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  5009. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  5010. a("#" + g).data("disabled", !1);
  5011. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5012. gb: "#gbox_" + a.jgrid.jqID(v),
  5013. jqm: c.jqModal,
  5014. onClose: b[d.p.id].onClose
  5015. });
  5016. return !1
  5017. });
  5018. a(d).triggerHandler("jqGridAddEditInitializeForm", [a("#" + g), B]);
  5019. E && E.call(d, a("#" + g), B);
  5020. "_empty" !== z && b[d.p.id].viewPagerButtons ? a("#pData,#nData", p + "_2").show() : a("#pData,#nData", p + "_2").hide();
  5021. a(d).triggerHandler("jqGridAddEditBeforeShowForm", [a("#" + g), B]);
  5022. y && y.call(d, a("#" + g), B);
  5023. a("#" + a.jgrid.jqID(q.themodal)).data("onClose", b[d.p.id].onClose);
  5024. a.jgrid.viewModal("#" + a.jgrid.jqID(q.themodal), {
  5025. gbox: "#gbox_" + a.jgrid.jqID(v),
  5026. jqm: c.jqModal,
  5027. overlay: c.overlay,
  5028. modal: c.modal,
  5029. overlayClass: c.overlayClass,
  5030. onHide: function (b) {
  5031. a(d).data("formProp", {
  5032. top: parseFloat(a(b.w).css("top")),
  5033. left: parseFloat(a(b.w).css("left")),
  5034. width: a(b.w).width(),
  5035. height: a(b.w).height(),
  5036. dataheight: a("#" + g).height(),
  5037. datawidth: a("#" + g).width()
  5038. });
  5039. b.w.remove();
  5040. b.o && b.o.remove()
  5041. }
  5042. });
  5043. N || a("." + a.jgrid.jqID(c.overlayClass)).click(function () {
  5044. if (!f()) return !1;
  5045. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5046. gb: "#gbox_" + a.jgrid.jqID(v),
  5047. jqm: c.jqModal,
  5048. onClose: b[d.p.id].onClose
  5049. });
  5050. return !1
  5051. });
  5052. a(".fm-button", "#" + a.jgrid.jqID(q.themodal)).hover(function () {
  5053. a(this).addClass("ui-state-hover")
  5054. },
  5055. function () {
  5056. a(this).removeClass("ui-state-hover")
  5057. });
  5058. a("#sData", p + "_2").click(function () {
  5059. l = {};
  5060. a("#FormError", p).hide();
  5061. e();
  5062. "_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();
  5063. return !1
  5064. });
  5065. a("#cData", p + "_2").click(function () {
  5066. if (!f()) return !1;
  5067. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5068. gb: "#gbox_" + a.jgrid.jqID(v),
  5069. jqm: c.jqModal,
  5070. onClose: b[d.p.id].onClose
  5071. });
  5072. return !1
  5073. });
  5074. a("#nData", p + "_2").click(function () {
  5075. if (!f()) return !1;
  5076. a("#FormError", p).hide();
  5077. var b = x();
  5078. b[0] = parseInt(b[0], 10);
  5079. if (-1 !== b[0] && b[1][b[0] + 1]) {
  5080. a(d).triggerHandler("jqGridAddEditClickPgButtons", ["next", a("#" + g), b[1][b[0]]]);
  5081. var e;
  5082. 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;
  5083. w(b[1][b[0] + 1], d, g);
  5084. a(d).jqGrid("setSelection", b[1][b[0] + 1]);
  5085. a(d).triggerHandler("jqGridAddEditAfterClickPgButtons", ["next", a("#" + g), b[1][b[0]]]);
  5086. a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(d, "next", a("#" + g), b[1][b[0] + 1]);
  5087. u(b[0] + 1, b)
  5088. }
  5089. return !1
  5090. });
  5091. a("#pData", p + "_2").click(function () {
  5092. if (!f()) return !1;
  5093. a("#FormError", p).hide();
  5094. var b = x();
  5095. if (-1 !== b[0] && b[1][b[0] - 1]) {
  5096. a(d).triggerHandler("jqGridAddEditClickPgButtons", ["prev", a("#" + g), b[1][b[0]]]);
  5097. var e;
  5098. 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;
  5099. w(b[1][b[0] - 1], d, g);
  5100. a(d).jqGrid("setSelection", b[1][b[0] - 1]);
  5101. a(d).triggerHandler("jqGridAddEditAfterClickPgButtons", ["prev", a("#" + g), b[1][b[0]]]);
  5102. a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(d, "prev", a("#" + g), b[1][b[0] - 1]);
  5103. u(b[0] - 1, b)
  5104. }
  5105. return !1
  5106. });
  5107. a(d).triggerHandler("jqGridAddEditAfterShowForm", [a("#" + g), B]);
  5108. D && D.call(d, a("#" + g), B);
  5109. y = x();
  5110. u(y[0], y)
  5111. }
  5112. }
  5113. })
  5114. },
  5115. viewGridRow: function (z, c) {
  5116. c = a.extend(!0, {
  5117. top: 0,
  5118. left: 0,
  5119. width: 0,
  5120. datawidth: "auto",
  5121. height: "auto",
  5122. dataheight: "auto",
  5123. modal: !1,
  5124. overlay: 30,
  5125. drag: !0,
  5126. resize: !0,
  5127. jqModal: !0,
  5128. closeOnEscape: !1,
  5129. labelswidth: "30%",
  5130. closeicon: [],
  5131. navkeys: [!1, 38, 40],
  5132. onClose: null,
  5133. beforeShowForm: null,
  5134. beforeInitData: null,
  5135. viewPagerButtons: !0,
  5136. recreateForm: !1
  5137. },
  5138. a.jgrid.view, c || {});
  5139. b[a(this)[0].p.id] = c;
  5140. return this.each(function () {
  5141. function e() {
  5142. !0 !== b[r.p.id].closeOnEscape && !0 !== b[r.p.id].navkeys[0] || setTimeout(function () {
  5143. a(".ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(v.modalhead)).focus()
  5144. },
  5145. 0)
  5146. }
  5147. function h(b, d, e, f) {
  5148. var g, k, h, q = 0,
  5149. m, p, r = [],
  5150. s = !1,
  5151. t,
  5152. 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>",
  5153. y = "",
  5154. z = ["integer", "number", "currency"],
  5155. v = 0,
  5156. w = 0,
  5157. A,
  5158. x,
  5159. D;
  5160. 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>";
  5161. a(d.p.colModel).each(function () {
  5162. (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)))
  5163. });
  5164. A = 0 !== v ? v : 0 !== w ? w : 0;
  5165. s = a(d).jqGrid("getInd", b);
  5166. a(d.p.colModel).each(function (b) {
  5167. g = this.name;
  5168. x = !1;
  5169. p = (k = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) ? "style='display:none'" : "";
  5170. D = "boolean" !== typeof this.viewable ? !0 : this.viewable;
  5171. if ("cb" !== g && "subgrid" !== g && "rn" !== g && D) {
  5172. 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();
  5173. x = "right" === this.align && 0 !== A ? !0 : !1;
  5174. var c = a.extend({},
  5175. {
  5176. rowabove: !1,
  5177. rowcontent: ""
  5178. },
  5179. this.formoptions || {}),
  5180. n = parseInt(c.rowpos, 10) || q + 1,
  5181. t = parseInt(2 * (parseInt(c.colpos, 10) || 1), 10);
  5182. if (c.rowabove) {
  5183. var u = a("<tr><td class='contentinfo' colspan='" + 2 * f + "'>" + c.rowcontent + "</td></tr>");
  5184. a(e).append(u);
  5185. u[0].rp = n
  5186. }
  5187. h = a(e).find("tr[rowpos=" + n + "]");
  5188. 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);
  5189. a("td:eq(" + (t - 2) + ")", h[0]).html("<b>" + (void 0 === c.label ? d.p.colNames[b] : c.label) + "</b>");
  5190. a("td:eq(" + (t - 1) + ")", h[0]).append("<span>" + m + "</span>").attr("id", "v_" + g);
  5191. x && a("td:eq(" + (t - 1) + ") span", h[0]).css({
  5192. "text-align": "right",
  5193. width: A + "px"
  5194. });
  5195. r[q] = b;
  5196. q++
  5197. }
  5198. });
  5199. 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));
  5200. return r
  5201. }
  5202. function w(b, c) {
  5203. var d, e, f = 0,
  5204. g, k;
  5205. if (k = a(c).jqGrid("getInd", b, !0)) a("td", k).each(function (b) {
  5206. d = c.p.colModel[b].name;
  5207. e = c.p.colModel[b].editrules && !0 === c.p.colModel[b].editrules.edithidden ? !1 : !0 === c.p.colModel[b].hidden ? !0 : !1;
  5208. "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++)
  5209. }),
  5210. 0 < f && a("#id_g", "#" + u).val(b)
  5211. }
  5212. function t(b, c) {
  5213. var d = c[1].length - 1;
  5214. 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");
  5215. 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")
  5216. }
  5217. function s() {
  5218. var b = a(r).jqGrid("getDataIDs"),
  5219. c = a("#id_g", "#" + u).val();
  5220. return [a.inArray(c, b), b]
  5221. }
  5222. var r = this;
  5223. if (r.grid && z) {
  5224. var f = r.p.id,
  5225. k = "ViewGrid_" + a.jgrid.jqID(f),
  5226. u = "ViewTbl_" + a.jgrid.jqID(f),
  5227. x = "ViewGrid_" + f,
  5228. d = "ViewTbl_" + f,
  5229. v = {
  5230. themodal: "viewmod" + f,
  5231. modalhead: "viewhd" + f,
  5232. modalcontent: "viewcnt" + f,
  5233. scrollelm: k
  5234. },
  5235. g = a.isFunction(b[r.p.id].beforeInitData) ? b[r.p.id].beforeInitData : !1,
  5236. m = !0,
  5237. p = 1,
  5238. q = 0;
  5239. c.recreateForm || a(r).data("viewProp") && a.extend(b[a(this)[0].p.id], a(r).data("viewProp"));
  5240. 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",
  5241. D = isNaN(b[a(this)[0].p.id].datawidth) ? b[a(this)[0].p.id].datawidth : b[a(this)[0].p.id].datawidth + "px",
  5242. x = a("<form name='FormPost' id='" + x + "' class='FormGrid' style='width:" + D + ";overflow:auto;position:relative;height:" + y + ";'></form>"),
  5243. A = a("<table id='" + d + "' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
  5244. g && (m = g.call(r, a("#" + k)), void 0 === m && (m = !0));
  5245. if (!1 !== m) {
  5246. a(r.p.colModel).each(function () {
  5247. var a = this.formoptions;
  5248. p = Math.max(p, a ? a.colpos || 0 : 0);
  5249. q = Math.max(q, a ? a.rowpos || 0 : 0)
  5250. });
  5251. a(x).append(A);
  5252. h(z, r, A, p);
  5253. d = "rtl" === r.p.direction ? !0 : !1;
  5254. 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>";
  5255. 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>";
  5256. y = "<a id='cData' class='fm-button ui-state-default ui-corner-all'>" + c.bClose + "</a>";
  5257. if (0 < q) {
  5258. var E = [];
  5259. a.each(a(A)[0].rows,
  5260. function (a, b) {
  5261. E[a] = b
  5262. });
  5263. E.sort(function (a, b) {
  5264. return a.rp > b.rp ? 1 : a.rp < b.rp ? -1 : 0
  5265. });
  5266. a.each(E,
  5267. function (b, c) {
  5268. a("tbody", A).append(c)
  5269. })
  5270. }
  5271. c.gbox = "#gbox_" + a.jgrid.jqID(f);
  5272. 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>");
  5273. a.jgrid.createModal(v, x, c, "#gview_" + a.jgrid.jqID(r.p.id), a("#gview_" + a.jgrid.jqID(r.p.id))[0]);
  5274. d && (a("#pData, #nData", "#" + u + "_2").css("float", "right"), a(".EditButton", "#" + u + "_2").css("text-align", "left"));
  5275. c.viewPagerButtons || a("#pData, #nData", "#" + u + "_2").hide();
  5276. x = null;
  5277. a("#" + v.themodal).keydown(function (d) {
  5278. if (27 === d.which) return b[r.p.id].closeOnEscape && a.jgrid.hideModal("#" + a.jgrid.jqID(v.themodal), {
  5279. gb: c.gbox,
  5280. jqm: c.jqModal,
  5281. onClose: c.onClose
  5282. }),
  5283. !1;
  5284. if (!0 === c.navkeys[0]) {
  5285. if (d.which === c.navkeys[1]) return a("#pData", "#" + u + "_2").trigger("click"),
  5286. !1;
  5287. if (d.which === c.navkeys[2]) return a("#nData", "#" + u + "_2").trigger("click"),
  5288. !1
  5289. }
  5290. });
  5291. 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>");
  5292. a.isFunction(c.beforeShowForm) && c.beforeShowForm.call(r, a("#" + k));
  5293. a.jgrid.viewModal("#" + a.jgrid.jqID(v.themodal), {
  5294. gbox: "#gbox_" + a.jgrid.jqID(f),
  5295. jqm: c.jqModal,
  5296. overlay: c.overlay,
  5297. modal: c.modal,
  5298. onHide: function (b) {
  5299. a(r).data("viewProp", {
  5300. top: parseFloat(a(b.w).css("top")),
  5301. left: parseFloat(a(b.w).css("left")),
  5302. width: a(b.w).width(),
  5303. height: a(b.w).height(),
  5304. dataheight: a("#" + k).height(),
  5305. datawidth: a("#" + k).width()
  5306. });
  5307. b.w.remove();
  5308. b.o && b.o.remove()
  5309. }
  5310. });
  5311. a(".fm-button:not(.ui-state-disabled)", "#" + u + "_2").hover(function () {
  5312. a(this).addClass("ui-state-hover")
  5313. },
  5314. function () {
  5315. a(this).removeClass("ui-state-hover")
  5316. });
  5317. e();
  5318. a("#cData", "#" + u + "_2").click(function () {
  5319. a.jgrid.hideModal("#" + a.jgrid.jqID(v.themodal), {
  5320. gb: "#gbox_" + a.jgrid.jqID(f),
  5321. jqm: c.jqModal,
  5322. onClose: c.onClose
  5323. });
  5324. return !1
  5325. });
  5326. a("#nData", "#" + u + "_2").click(function () {
  5327. a("#FormError", "#" + u).hide();
  5328. var b = s();
  5329. 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));
  5330. e();
  5331. return !1
  5332. });
  5333. a("#pData", "#" + u + "_2").click(function () {
  5334. a("#FormError", "#" + u).hide();
  5335. 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));
  5336. e();
  5337. return !1
  5338. });
  5339. x = s();
  5340. t(x[0], x)
  5341. }
  5342. }
  5343. })
  5344. },
  5345. delGridRow: function (z, c) {
  5346. c = a.extend(!0, {
  5347. top: 0,
  5348. left: 0,
  5349. width: 240,
  5350. height: "auto",
  5351. dataheight: "auto",
  5352. modal: !1,
  5353. overlay: 30,
  5354. drag: !0,
  5355. resize: !0,
  5356. url: "",
  5357. mtype: "POST",
  5358. reloadAfterSubmit: !0,
  5359. beforeShowForm: null,
  5360. beforeInitData: null,
  5361. afterShowForm: null,
  5362. beforeSubmit: null,
  5363. onclickSubmit: null,
  5364. afterSubmit: null,
  5365. jqModal: !0,
  5366. closeOnEscape: !1,
  5367. delData: {},
  5368. delicon: [],
  5369. cancelicon: [],
  5370. onClose: null,
  5371. ajaxDelOptions: {},
  5372. processing: !1,
  5373. serializeDelData: null,
  5374. useDataProxy: !1
  5375. },
  5376. a.jgrid.del, c || {});
  5377. b[a(this)[0].p.id] = c;
  5378. return this.each(function () {
  5379. var e = this;
  5380. if (e.grid && z) {
  5381. var h = a.isFunction(b[e.p.id].beforeShowForm),
  5382. w = a.isFunction(b[e.p.id].afterShowForm),
  5383. t = a.isFunction(b[e.p.id].beforeInitData) ? b[e.p.id].beforeInitData : !1,
  5384. s = e.p.id,
  5385. r = {},
  5386. f = !0,
  5387. k = "DelTbl_" + a.jgrid.jqID(s),
  5388. u,
  5389. x,
  5390. d,
  5391. v,
  5392. g = "DelTbl_" + s,
  5393. m = {
  5394. themodal: "delmod" + s,
  5395. modalhead: "delhd" + s,
  5396. modalcontent: "delcnt" + s,
  5397. scrollelm: k
  5398. };
  5399. a.isArray(z) && (z = z.join());
  5400. if (void 0 !== a("#" + a.jgrid.jqID(m.themodal))[0]) {
  5401. t && (f = t.call(e, a("#" + k)), void 0 === f && (f = !0));
  5402. if (!1 === f) return;
  5403. a("#DelData>td", "#" + k).text(z);
  5404. a("#DelError", "#" + k).hide(); !0 === b[e.p.id].processing && (b[e.p.id].processing = !1, a("#dData", "#" + k).removeClass("ui-state-active"));
  5405. h && b[e.p.id].beforeShowForm.call(e, a("#" + k));
  5406. a.jgrid.viewModal("#" + a.jgrid.jqID(m.themodal), {
  5407. gbox: "#gbox_" + a.jgrid.jqID(s),
  5408. jqm: b[e.p.id].jqModal,
  5409. jqM: !1,
  5410. overlay: b[e.p.id].overlay,
  5411. modal: b[e.p.id].modal
  5412. })
  5413. } else {
  5414. var p = isNaN(b[e.p.id].dataheight) ? b[e.p.id].dataheight : b[e.p.id].dataheight + "px",
  5415. q = isNaN(c.datawidth) ? c.datawidth : c.datawidth + "px",
  5416. g = "<div id='" + g + "' class='formdata' style='width:" + q + ";overflow:auto;position:relative;height:" + p + ";'><table class='DelTable'><tbody>",
  5417. g = g + "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",
  5418. g = g + ("<tr id='DelData' style='display:none'><td >" + z + "</td></tr>"),
  5419. g = g + ('<tr><td class="delmsg" style="white-space:pre;">' + b[e.p.id].msg + "</td></tr><tr><td >&#160;</td></tr>"),
  5420. g = g + "</tbody></table></div>",
  5421. 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>");
  5422. c.gbox = "#gbox_" + a.jgrid.jqID(s);
  5423. a.jgrid.createModal(m, g, c, "#gview_" + a.jgrid.jqID(e.p.id), a("#gview_" + a.jgrid.jqID(e.p.id))[0]);
  5424. t && (f = t.call(e, a("#" + k)), void 0 === f && (f = !0));
  5425. if (!1 === f) return;
  5426. a(".fm-button", "#" + k + "_2").hover(function () {
  5427. a(this).addClass("ui-state-hover")
  5428. },
  5429. function () {
  5430. a(this).removeClass("ui-state-hover")
  5431. });
  5432. c.delicon = a.extend([!0, "left", "ui-icon-scissors"], b[e.p.id].delicon);
  5433. 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>");
  5434. a("#dData", "#" + k + "_2").click(function () {
  5435. var f = [!0, ""],
  5436. g,
  5437. h = a("#DelData>td", "#" + k).text();
  5438. r = {};
  5439. a.isFunction(b[e.p.id].onclickSubmit) && (r = b[e.p.id].onclickSubmit.call(e, b[e.p.id], h) || {});
  5440. a.isFunction(b[e.p.id].beforeSubmit) && (f = b[e.p.id].beforeSubmit.call(e, h));
  5441. if (f[0] && !b[e.p.id].processing) {
  5442. b[e.p.id].processing = !0;
  5443. d = e.p.prmNames;
  5444. u = a.extend({},
  5445. b[e.p.id].delData, r);
  5446. v = d.oper;
  5447. u[v] = d.deloper;
  5448. x = d.id;
  5449. h = String(h).split(",");
  5450. if (!h.length) return !1;
  5451. for (g in h) h.hasOwnProperty(g) && (h[g] = a.jgrid.stripPref(e.p.idPrefix, h[g]));
  5452. u[x] = h.join();
  5453. a(this).addClass("ui-state-active");
  5454. g = a.extend({
  5455. url: b[e.p.id].url || a(e).jqGrid("getGridParam", "editurl"),
  5456. type: b[e.p.id].mtype,
  5457. data: a.isFunction(b[e.p.id].serializeDelData) ? b[e.p.id].serializeDelData.call(e, u) : u,
  5458. complete: function (d, g) {
  5459. var q;
  5460. 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));
  5461. if (!1 === f[0]) a("#DelError>td", "#" + k).html(f[1]),
  5462. a("#DelError", "#" + k).show();
  5463. else {
  5464. if (b[e.p.id].reloadAfterSubmit && "local" !== e.p.datatype) a(e).trigger("reloadGrid");
  5465. else {
  5466. if (!0 === e.p.treeGrid) try {
  5467. a(e).jqGrid("delTreeNode", e.p.idPrefix + h[0])
  5468. } catch (p) { } else for (q = 0; q < h.length; q++) a(e).jqGrid("delRowData", e.p.idPrefix + h[q]);
  5469. e.p.selrow = null;
  5470. e.p.selarrrow = []
  5471. }
  5472. a.isFunction(b[e.p.id].afterComplete) && setTimeout(function () {
  5473. b[e.p.id].afterComplete.call(e, d, h)
  5474. },
  5475. 500)
  5476. }
  5477. b[e.p.id].processing = !1;
  5478. a("#dData", "#" + k + "_2").removeClass("ui-state-active");
  5479. f[0] && a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5480. gb: "#gbox_" + a.jgrid.jqID(s),
  5481. jqm: c.jqModal,
  5482. onClose: b[e.p.id].onClose
  5483. })
  5484. }
  5485. },
  5486. a.jgrid.ajaxOptions, b[e.p.id].ajaxDelOptions);
  5487. 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));
  5488. 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), {
  5489. gb: "#gbox_" + a.jgrid.jqID(s),
  5490. jqm: c.jqModal,
  5491. onClose: b[e.p.id].onClose
  5492. })) : a.ajax(g))
  5493. } !1 === f[0] && (a("#DelError>td", "#" + k).html(f[1]), a("#DelError", "#" + k).show());
  5494. return !1
  5495. });
  5496. a("#eData", "#" + k + "_2").click(function () {
  5497. a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5498. gb: "#gbox_" + a.jgrid.jqID(s),
  5499. jqm: b[e.p.id].jqModal,
  5500. onClose: b[e.p.id].onClose
  5501. });
  5502. return !1
  5503. });
  5504. h && b[e.p.id].beforeShowForm.call(e, a("#" + k));
  5505. a.jgrid.viewModal("#" + a.jgrid.jqID(m.themodal), {
  5506. gbox: "#gbox_" + a.jgrid.jqID(s),
  5507. jqm: b[e.p.id].jqModal,
  5508. overlay: b[e.p.id].overlay,
  5509. modal: b[e.p.id].modal
  5510. })
  5511. }
  5512. w && b[e.p.id].afterShowForm.call(e, a("#" + k)); !0 === b[e.p.id].closeOnEscape && setTimeout(function () {
  5513. a(".ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(m.modalhead)).focus()
  5514. },
  5515. 0)
  5516. }
  5517. })
  5518. },
  5519. navGrid: function (b, c, e, h, w, t, s) {
  5520. c = a.extend({
  5521. edit: !0,
  5522. editicon: "ui-icon-pencil",
  5523. add: !0,
  5524. addicon: "ui-icon-plus",
  5525. del: !0,
  5526. delicon: "ui-icon-trash",
  5527. search: !0,
  5528. searchicon: "ui-icon-search",
  5529. refresh: !0,
  5530. refreshicon: "ui-icon-refresh",
  5531. refreshstate: "firstpage",
  5532. view: !1,
  5533. viewicon: "ui-icon-document",
  5534. position: "left",
  5535. closeOnEscape: !0,
  5536. beforeRefresh: null,
  5537. afterRefresh: null,
  5538. cloneToTop: !1,
  5539. alertwidth: 200,
  5540. alertheight: "auto",
  5541. alerttop: null,
  5542. alertleft: null,
  5543. alertzIndex: null
  5544. },
  5545. a.jgrid.nav, c || {});
  5546. return this.each(function () {
  5547. if (!this.nav) {
  5548. var r = {
  5549. themodal: "alertmod_" + this.p.id,
  5550. modalhead: "alerthd_" + this.p.id,
  5551. modalcontent: "alertcnt_" + this.p.id
  5552. },
  5553. f = this,
  5554. k;
  5555. if (f.grid && "string" === typeof b) {
  5556. 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>", {
  5557. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5558. jqModal: !0,
  5559. drag: !0,
  5560. resize: !0,
  5561. caption: c.alertcap,
  5562. top: c.alerttop,
  5563. left: c.alertleft,
  5564. width: c.alertwidth,
  5565. height: c.alertheight,
  5566. closeOnEscape: c.closeOnEscape,
  5567. zIndex: c.alertzIndex
  5568. },
  5569. "#gview_" + a.jgrid.jqID(f.p.id), a("#gbox_" + a.jgrid.jqID(f.p.id))[0], !0));
  5570. var u = 1,
  5571. x, d = function () {
  5572. a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")
  5573. },
  5574. v = function () {
  5575. a(this).removeClass("ui-state-hover")
  5576. };
  5577. c.cloneToTop && f.p.toppager && (u = 2);
  5578. for (x = 0; x < u; x++) {
  5579. 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>"),
  5580. m,
  5581. p;
  5582. 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");
  5583. "rtl" === f.p.direction && a(g).attr("dir", "rtl").css("float", "right");
  5584. c.add && (h = h || {},
  5585. 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({
  5586. title: c.addtitle || "",
  5587. id: h.id || "add_" + p
  5588. }).click(function () {
  5589. a(this).hasClass("ui-state-disabled") || (a.isFunction(c.addfunc) ? c.addfunc.call(f) : a(f).jqGrid("editGridRow", "new", h));
  5590. return !1
  5591. }).hover(d, v), k = null);
  5592. c.edit && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), e = e || {},
  5593. 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({
  5594. title: c.edittitle || "",
  5595. id: e.id || "edit_" + p
  5596. }).click(function () {
  5597. if (!a(this).hasClass("ui-state-disabled")) {
  5598. var b = f.p.selrow;
  5599. b ? a.isFunction(c.editfunc) ? c.editfunc.call(f, b) : a(f).jqGrid("editGridRow", b, e) : (a.jgrid.viewModal("#" + r.themodal, {
  5600. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5601. jqm: !0
  5602. }), a("#jqg_alrt").focus())
  5603. }
  5604. return !1
  5605. }).hover(d, v), k = null);
  5606. c.view && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), s = s || {},
  5607. 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({
  5608. title: c.viewtitle || "",
  5609. id: s.id || "view_" + p
  5610. }).click(function () {
  5611. if (!a(this).hasClass("ui-state-disabled")) {
  5612. var b = f.p.selrow;
  5613. b ? a.isFunction(c.viewfunc) ? c.viewfunc.call(f, b) : a(f).jqGrid("viewGridRow", b, s) : (a.jgrid.viewModal("#" + r.themodal, {
  5614. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5615. jqm: !0
  5616. }), a("#jqg_alrt").focus())
  5617. }
  5618. return !1
  5619. }).hover(d, v), k = null);
  5620. c.del && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), w = w || {},
  5621. 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({
  5622. title: c.deltitle || "",
  5623. id: w.id || "del_" + p
  5624. }).click(function () {
  5625. if (!a(this).hasClass("ui-state-disabled")) {
  5626. var b;
  5627. f.p.multiselect ? (b = f.p.selarrrow, 0 === b.length && (b = null)) : b = f.p.selrow;
  5628. b ? a.isFunction(c.delfunc) ? c.delfunc.call(f, b) : a(f).jqGrid("delGridRow", b, w) : (a.jgrid.viewModal("#" + r.themodal, {
  5629. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5630. jqm: !0
  5631. }), a("#jqg_alrt").focus())
  5632. }
  5633. return !1
  5634. }).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>");
  5635. c.search && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), t = t || {},
  5636. 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({
  5637. title: c.searchtitle || "",
  5638. id: t.id || "search_" + p
  5639. }).click(function () {
  5640. a(this).hasClass("ui-state-disabled") || (a.isFunction(c.searchfunc) ? c.searchfunc.call(f, t) : a(f).jqGrid("searchGrid", t));
  5641. return !1
  5642. }).hover(d, v), t.showOnLoad && !0 === t.showOnLoad && a(k, g).click(), k = null);
  5643. 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({
  5644. title: c.refreshtitle || "",
  5645. id: "refresh_" + p
  5646. }).click(function () {
  5647. if (!a(this).hasClass("ui-state-disabled")) {
  5648. a.isFunction(c.beforeRefresh) && c.beforeRefresh.call(f);
  5649. f.p.search = !1;
  5650. f.p.resetsearch = !0;
  5651. try {
  5652. var b = f.p.id;
  5653. f.p.postData.filters = "";
  5654. try {
  5655. a("#fbox_" + a.jgrid.jqID(b)).jqFilter("resetFilter")
  5656. } catch (d) { }
  5657. a.isFunction(f.clearToolbar) && f.clearToolbar.call(f, !1)
  5658. } catch (e) { }
  5659. switch (c.refreshstate) {
  5660. case "firstpage":
  5661. a(f).trigger("reloadGrid", [{
  5662. page: 1
  5663. }]);
  5664. break;
  5665. case "current":
  5666. a(f).trigger("reloadGrid", [{
  5667. current: !0
  5668. }])
  5669. }
  5670. a.isFunction(c.afterRefresh) && c.afterRefresh.call(f)
  5671. }
  5672. return !1
  5673. }).hover(d, v), k = null);
  5674. k = a(".ui-jqgrid").css("font-size") || "11px";
  5675. a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + k + ";visibility:hidden;' ></div>");
  5676. k = a(g).clone().appendTo("#testpg2").width();
  5677. a("#testpg2").remove();
  5678. a(m + "_" + c.position, m).append(g);
  5679. 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);
  5680. g = k = k = null;
  5681. this.nav = !0
  5682. }
  5683. }
  5684. }
  5685. })
  5686. },
  5687. navButtonAdd: function (b, c) {
  5688. c = a.extend({
  5689. caption: "newButton",
  5690. title: "",
  5691. buttonicon: "ui-icon-newwin",
  5692. onClickButton: null,
  5693. position: "last",
  5694. cursor: "pointer"
  5695. },
  5696. c || {});
  5697. return this.each(function () {
  5698. if (this.grid) {
  5699. "string" === typeof b && 0 !== b.indexOf("#") && (b = "#" + a.jgrid.jqID(b));
  5700. var e = a(".navtable", b)[0],
  5701. h = this;
  5702. if (e && (!c.id || void 0 === a("#" + a.jgrid.jqID(c.id), e)[0])) {
  5703. var w = a("<td></td>");
  5704. "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>");
  5705. c.id && a(w).attr("id", c.id);
  5706. "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);
  5707. a(w, e).attr("title", c.title || "").click(function (b) {
  5708. a(this).hasClass("ui-state-disabled") || a.isFunction(c.onClickButton) && c.onClickButton.call(h, b);
  5709. return !1
  5710. }).hover(function () {
  5711. a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")
  5712. },
  5713. function () {
  5714. a(this).removeClass("ui-state-hover")
  5715. })
  5716. }
  5717. }
  5718. })
  5719. },
  5720. navSeparatorAdd: function (b, c) {
  5721. c = a.extend({
  5722. sepclass: "ui-separator",
  5723. sepcontent: "",
  5724. position: "last"
  5725. },
  5726. c || {});
  5727. return this.each(function () {
  5728. if (this.grid) {
  5729. "string" === typeof b && 0 !== b.indexOf("#") && (b = "#" + a.jgrid.jqID(b));
  5730. var e = a(".navtable", b)[0];
  5731. if (e) {
  5732. var h = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='" + c.sepclass + "'></span>" + c.sepcontent + "</td>";
  5733. "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)
  5734. }
  5735. }
  5736. })
  5737. },
  5738. GridToForm: function (b, c) {
  5739. return this.each(function () {
  5740. var e = this,
  5741. h;
  5742. if (e.grid) {
  5743. var w = a(e).jqGrid("getRowData", b);
  5744. 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 () {
  5745. if (a(this).val() == w[h]) a(this)[e.p.useProp ? "prop" : "attr"]("checked", !0);
  5746. else a(this)[e.p.useProp ? "prop" : "attr"]("checked", !1)
  5747. }) : a("[name=" + a.jgrid.jqID(h) + "]", c).val(w[h]))
  5748. }
  5749. })
  5750. },
  5751. FormToGrid: function (b, c, e, h) {
  5752. return this.each(function () {
  5753. if (this.grid) {
  5754. e || (e = "set");
  5755. h || (h = "first");
  5756. var w = a(c).serializeArray(),
  5757. t = {};
  5758. a.each(w,
  5759. function (a, b) {
  5760. t[b.name] = b.value
  5761. });
  5762. "add" === e ? a(this).jqGrid("addRowData", b, t, h) : "set" === e && a(this).jqGrid("setRowData", b, t)
  5763. }
  5764. })
  5765. }
  5766. })
  5767. })(jQuery); (function (a) {
  5768. a.fn.jqFilter = function (d) {
  5769. if ("string" === typeof d) {
  5770. var q = a.fn.jqFilter[d];
  5771. if (!q) throw "jqFilter - No such method: " + d;
  5772. var x = a.makeArray(arguments).slice(1);
  5773. return q.apply(this, x)
  5774. }
  5775. var n = a.extend(!0, {
  5776. filter: null,
  5777. columns: [],
  5778. onChange: null,
  5779. afterRedraw: null,
  5780. checkValues: null,
  5781. error: !1,
  5782. errmsg: "",
  5783. errorcheck: !0,
  5784. showQuery: !0,
  5785. sopt: null,
  5786. ops: [],
  5787. operands: null,
  5788. numopts: "eq ne lt le gt ge nu nn in ni".split(" "),
  5789. stropts: "eq ne bw bn ew en cn nc nu nn in ni".split(" "),
  5790. strarr: ["text", "string", "blob"],
  5791. groupOps: [{
  5792. op: "AND",
  5793. text: "AND"
  5794. },
  5795. {
  5796. op: "OR",
  5797. text: "OR"
  5798. }],
  5799. groupButton: !0,
  5800. ruleButtons: !0,
  5801. direction: "ltr"
  5802. },
  5803. a.jgrid.filter, d || {});
  5804. return this.each(function () {
  5805. if (!this.filter) {
  5806. this.p = n;
  5807. if (null === this.p.filter || void 0 === this.p.filter) this.p.filter = {
  5808. groupOp: this.p.groupOps[0].op,
  5809. rules: [],
  5810. groups: []
  5811. };
  5812. var d, q = this.p.columns.length,
  5813. f, w = /msie/i.test(navigator.userAgent) && !window.opera;
  5814. this.p.initFilter = a.extend(!0, {},
  5815. this.p.filter);
  5816. if (q) {
  5817. for (d = 0; d < q; d++) f = this.p.columns[d],
  5818. f.stype ? f.inputtype = f.stype : f.inputtype || (f.inputtype = "text"),
  5819. f.sorttype ? f.searchtype = f.sorttype : f.searchtype || (f.searchtype = "string"),
  5820. void 0 === f.hidden && (f.hidden = !1),
  5821. f.label || (f.label = f.name),
  5822. f.index && (f.name = f.index),
  5823. f.hasOwnProperty("searchoptions") || (f.searchoptions = {}),
  5824. f.hasOwnProperty("searchrules") || (f.searchrules = {});
  5825. 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>");
  5826. var u = function (g, l) {
  5827. var b = [!0, ""],
  5828. c = a("#" + a.jgrid.jqID(n.id))[0] || null;
  5829. if (a.isFunction(l.searchrules)) b = l.searchrules.call(c, g, l);
  5830. else if (a.jgrid && a.jgrid.checkValues) try {
  5831. b = a.jgrid.checkValues.call(c, g, -1, l.searchrules, l.label)
  5832. } catch (m) { }
  5833. b && b.length && !1 === b[0] && (n.error = !b[0], n.errmsg = b[1])
  5834. };
  5835. this.onchange = function () {
  5836. this.p.error = !1;
  5837. this.p.errmsg = "";
  5838. return a.isFunction(this.p.onChange) ? this.p.onChange.call(this, this.p) : !1
  5839. };
  5840. this.reDraw = function () {
  5841. a("table.group:first", this).remove();
  5842. var g = this.createTableForGroup(n.filter, null);
  5843. a(this).append(g);
  5844. a.isFunction(this.p.afterRedraw) && this.p.afterRedraw.call(this, this.p)
  5845. };
  5846. this.createTableForGroup = function (g, l) {
  5847. var b = this,
  5848. c, m = a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),
  5849. e = "left";
  5850. "rtl" === this.p.direction && (e = "right", m.attr("dir", "rtl"));
  5851. null === l && m.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='" + e + "'></th></tr>");
  5852. var h = a("<tr></tr>");
  5853. m.append(h);
  5854. e = a("<th colspan='5' align='" + e + "'></th>");
  5855. h.append(e);
  5856. if (!0 === this.p.ruleButtons) {
  5857. var d = a("<select class='opsel'></select>");
  5858. e.append(d);
  5859. var h = "",
  5860. k;
  5861. for (c = 0; c < n.groupOps.length; c++) k = g.groupOp === b.p.groupOps[c].op ? " selected='selected'" : "",
  5862. h += "<option value='" + b.p.groupOps[c].op + "'" + k + ">" + b.p.groupOps[c].text + "</option>";
  5863. d.append(h).bind("change",
  5864. function () {
  5865. g.groupOp = a(d).val();
  5866. b.onchange()
  5867. })
  5868. }
  5869. h = "<span></span>";
  5870. this.p.groupButton && (h = a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"), h.bind("click",
  5871. function () {
  5872. void 0 === g.groups && (g.groups = []);
  5873. g.groups.push({
  5874. groupOp: n.groupOps[0].op,
  5875. rules: [],
  5876. groups: []
  5877. });
  5878. b.reDraw();
  5879. b.onchange();
  5880. return !1
  5881. }));
  5882. e.append(h);
  5883. if (!0 === this.p.ruleButtons) {
  5884. var h = a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),
  5885. f;
  5886. h.bind("click",
  5887. function () {
  5888. void 0 === g.rules && (g.rules = []);
  5889. for (c = 0; c < b.p.columns.length; c++) {
  5890. var e = void 0 === b.p.columns[c].search ? !0 : b.p.columns[c].search,
  5891. l = !0 === b.p.columns[c].hidden;
  5892. if (!0 === b.p.columns[c].searchoptions.searchhidden && e || e && !l) {
  5893. f = b.p.columns[c];
  5894. break
  5895. }
  5896. }
  5897. 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;
  5898. g.rules.push({
  5899. field: f.name,
  5900. op: e[0],
  5901. data: ""
  5902. });
  5903. b.reDraw();
  5904. return !1
  5905. });
  5906. e.append(h)
  5907. }
  5908. null !== l && (h = a("<input type='button' value='-' title='Delete group' class='delete-group'/>"), e.append(h), h.bind("click",
  5909. function () {
  5910. for (c = 0; c < l.groups.length; c++) if (l.groups[c] === g) {
  5911. l.groups.splice(c, 1);
  5912. break
  5913. }
  5914. b.reDraw();
  5915. b.onchange();
  5916. return !1
  5917. }));
  5918. if (void 0 !== g.groups) for (c = 0; c < g.groups.length; c++) e = a("<tr></tr>"),
  5919. m.append(e),
  5920. h = a("<td class='first'></td>"),
  5921. e.append(h),
  5922. h = a("<td colspan='4'></td>"),
  5923. h.append(this.createTableForGroup(g.groups[c], g)),
  5924. e.append(h);
  5925. void 0 === g.groupOp && (g.groupOp = b.p.groupOps[0].op);
  5926. if (void 0 !== g.rules) for (c = 0; c < g.rules.length; c++) m.append(this.createTableRowForRule(g.rules[c], g));
  5927. return m
  5928. };
  5929. this.createTableRowForRule = function (g, l) {
  5930. var b = this,
  5931. c = a("#" + a.jgrid.jqID(n.id))[0] || null,
  5932. m = a("<tr></tr>"),
  5933. e,
  5934. h,
  5935. f,
  5936. k,
  5937. d = "",
  5938. s;
  5939. m.append("<td class='first'></td>");
  5940. var p = a("<td class='columns'></td>");
  5941. m.append(p);
  5942. var q = a("<select></select>"),
  5943. r,
  5944. t = [];
  5945. p.append(q);
  5946. q.bind("change",
  5947. function () {
  5948. g.field = a(q).val();
  5949. f = a(this).parents("tr:first");
  5950. for (e = 0; e < b.p.columns.length; e++) if (b.p.columns[e].name === g.field) {
  5951. k = b.p.columns[e];
  5952. break
  5953. }
  5954. if (k) {
  5955. k.searchoptions.id = a.jgrid.randId();
  5956. w && "text" === k.inputtype && !k.searchoptions.size && (k.searchoptions.size = 10);
  5957. var d = a.jgrid.createEl.call(c, k.inputtype, k.searchoptions, "", !0, b.p.ajaxSelectOptions || {},
  5958. !0);
  5959. a(d).addClass("input-elm");
  5960. 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;
  5961. var l = "",
  5962. m = 0;
  5963. t = [];
  5964. a.each(b.p.ops,
  5965. function () {
  5966. t.push(this.oper)
  5967. });
  5968. for (e = 0; e < h.length; e++) r = a.inArray(h[e], t),
  5969. -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++);
  5970. a(".selectopts", f).empty().append(l);
  5971. a(".selectopts", f)[0].selectedIndex = 0;
  5972. 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"));
  5973. a(".data", f).empty().append(d);
  5974. a.jgrid.bindEv.call(c, d, k.searchoptions);
  5975. a(".input-elm", f).bind("change",
  5976. function (e) {
  5977. e = e.target;
  5978. 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;
  5979. b.onchange()
  5980. });
  5981. setTimeout(function () {
  5982. g.data = a(d).val();
  5983. b.onchange()
  5984. },
  5985. 0)
  5986. }
  5987. });
  5988. for (e = p = 0; e < b.p.columns.length; e++) {
  5989. s = void 0 === b.p.columns[e].search ? !0 : b.p.columns[e].search;
  5990. var u = !0 === b.p.columns[e].hidden;
  5991. if (!0 === b.p.columns[e].searchoptions.searchhidden && s || s && !u) s = "",
  5992. g.field === b.p.columns[e].name && (s = " selected='selected'", p = e),
  5993. d += "<option value='" + b.p.columns[e].name + "'" + s + ">" + b.p.columns[e].label + "</option>"
  5994. }
  5995. q.append(d);
  5996. d = a("<td class='operators'></td>");
  5997. m.append(d);
  5998. k = n.columns[p];
  5999. k.searchoptions.id = a.jgrid.randId();
  6000. w && "text" === k.inputtype && !k.searchoptions.size && (k.searchoptions.size = 10);
  6001. p = a.jgrid.createEl.call(c, k.inputtype, k.searchoptions, g.data, !0, b.p.ajaxSelectOptions || {},
  6002. !0);
  6003. if ("nu" === g.op || "nn" === g.op) a(p).attr("readonly", "true"),
  6004. a(p).attr("disabled", "true");
  6005. var v = a("<select class='selectopts'></select>");
  6006. d.append(v);
  6007. v.bind("change",
  6008. function () {
  6009. g.op = a(v).val();
  6010. f = a(this).parents("tr:first");
  6011. var c = a(".input-elm", f)[0];
  6012. "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"));
  6013. b.onchange()
  6014. });
  6015. 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;
  6016. d = "";
  6017. a.each(b.p.ops,
  6018. function () {
  6019. t.push(this.oper)
  6020. });
  6021. for (e = 0; e < h.length; e++) r = a.inArray(h[e], t),
  6022. -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>");
  6023. v.append(d);
  6024. d = a("<td class='data'></td>");
  6025. m.append(d);
  6026. d.append(p);
  6027. a.jgrid.bindEv.call(c, p, k.searchoptions);
  6028. a(p).addClass("input-elm").bind("change",
  6029. function () {
  6030. g.data = "custom" === k.inputtype ? k.searchoptions.custom_value.call(c, a(this).children(".customelement:first"), "get") : a(this).val();
  6031. b.onchange()
  6032. });
  6033. d = a("<td></td>");
  6034. 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",
  6035. function () {
  6036. for (e = 0; e < l.rules.length; e++) if (l.rules[e] === g) {
  6037. l.rules.splice(e, 1);
  6038. break
  6039. }
  6040. b.reDraw();
  6041. b.onchange();
  6042. return !1
  6043. }));
  6044. return m
  6045. };
  6046. this.getStringForGroup = function (a) {
  6047. var d = "(",
  6048. b;
  6049. if (void 0 !== a.groups) for (b = 0; b < a.groups.length; b++) {
  6050. 1 < d.length && (d += " " + a.groupOp + " ");
  6051. try {
  6052. d += this.getStringForGroup(a.groups[b])
  6053. } catch (c) {
  6054. alert(c)
  6055. }
  6056. }
  6057. if (void 0 !== a.rules) try {
  6058. for (b = 0; b < a.rules.length; b++) 1 < d.length && (d += " " + a.groupOp + " "),
  6059. d += this.getStringForRule(a.rules[b])
  6060. } catch (f) {
  6061. alert(f)
  6062. }
  6063. d += ")";
  6064. return "()" === d ? "" : d
  6065. };
  6066. this.getStringForRule = function (d) {
  6067. var f = "",
  6068. b = "",
  6069. c, m;
  6070. for (c = 0; c < this.p.ops.length; c++) if (this.p.ops[c].oper === d.op) {
  6071. f = this.p.operands.hasOwnProperty(d.op) ? this.p.operands[d.op] : "";
  6072. b = this.p.ops[c].oper;
  6073. break
  6074. }
  6075. for (c = 0; c < this.p.columns.length; c++) if (this.p.columns[c].name === d.field) {
  6076. m = this.p.columns[c];
  6077. break
  6078. }
  6079. if (void 0 == m) return "";
  6080. c = d.data;
  6081. if ("bw" === b || "bn" === b) c += "%";
  6082. if ("ew" === b || "en" === b) c = "%" + c;
  6083. if ("cn" === b || "nc" === b) c = "%" + c + "%";
  6084. if ("in" === b || "ni" === b) c = " (" + c + ")";
  6085. n.errorcheck && u(d.data, m);
  6086. return -1 !== a.inArray(m.searchtype, ["int", "integer", "float", "number", "currency"]) || "nn" === b || "nu" === b ? d.field + " " + f + " " + c : d.field + " " + f + ' "' + c + '"'
  6087. };
  6088. this.resetFilter = function () {
  6089. this.p.filter = a.extend(!0, {},
  6090. this.p.initFilter);
  6091. this.reDraw();
  6092. this.onchange()
  6093. };
  6094. this.hideError = function () {
  6095. a("th.ui-state-error", this).html("");
  6096. a("tr.error", this).hide()
  6097. };
  6098. this.showError = function () {
  6099. a("th.ui-state-error", this).html(this.p.errmsg);
  6100. a("tr.error", this).show()
  6101. };
  6102. this.toUserFriendlyString = function () {
  6103. return this.getStringForGroup(n.filter)
  6104. };
  6105. this.toString = function () {
  6106. function a(b) {
  6107. var c = "(",
  6108. f;
  6109. if (void 0 !== b.groups) for (f = 0; f < b.groups.length; f++) 1 < c.length && (c = "OR" === b.groupOp ? c + " || " : c + " && "),
  6110. c += a(b.groups[f]);
  6111. if (void 0 !== b.rules) for (f = 0; f < b.rules.length; f++) {
  6112. 1 < c.length && (c = "OR" === b.groupOp ? c + " || " : c + " && ");
  6113. var e = b.rules[f];
  6114. if (d.p.errorcheck) {
  6115. for (var h = void 0,
  6116. n = void 0,
  6117. h = 0; h < d.p.columns.length; h++) if (d.p.columns[h].name === e.field) {
  6118. n = d.p.columns[h];
  6119. break
  6120. }
  6121. n && u(e.data, n)
  6122. }
  6123. c += e.op + "(item." + e.field + ",'" + e.data + "')"
  6124. }
  6125. c += ")";
  6126. return "()" === c ? "" : c
  6127. }
  6128. var d = this;
  6129. return a(this.p.filter)
  6130. };
  6131. this.reDraw();
  6132. if (this.p.showQuery) this.onchange();
  6133. this.filter = !0
  6134. }
  6135. }
  6136. })
  6137. };
  6138. a.extend(a.fn.jqFilter, {
  6139. toSQLString: function () {
  6140. var a = "";
  6141. this.each(function () {
  6142. a = this.toUserFriendlyString()
  6143. });
  6144. return a
  6145. },
  6146. filterData: function () {
  6147. var a;
  6148. this.each(function () {
  6149. a = this.p.filter
  6150. });
  6151. return a
  6152. },
  6153. getParameter: function (a) {
  6154. return void 0 !== a && this.p.hasOwnProperty(a) ? this.p[a] : this.p
  6155. },
  6156. resetFilter: function () {
  6157. return this.each(function () {
  6158. this.resetFilter()
  6159. })
  6160. },
  6161. addFilter: function (d) {
  6162. "string" === typeof d && (d = a.jgrid.parse(d));
  6163. this.each(function () {
  6164. this.p.filter = d;
  6165. this.reDraw();
  6166. this.onchange()
  6167. })
  6168. }
  6169. })
  6170. })(jQuery); (function (a) {
  6171. a.jgrid.inlineEdit = a.jgrid.inlineEdit || {};
  6172. a.jgrid.extend({
  6173. editRow: function (c, e, b, l, h, n, p, g, f) {
  6174. var m = {},
  6175. d = a.makeArray(arguments).slice(1);
  6176. "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));
  6177. m = a.extend(!0, {
  6178. keys: !1,
  6179. oneditfunc: null,
  6180. successfunc: null,
  6181. url: null,
  6182. extraparam: {},
  6183. aftersavefunc: null,
  6184. errorfunc: null,
  6185. afterrestorefunc: null,
  6186. restoreAfterError: !0,
  6187. mtype: "POST"
  6188. },
  6189. a.jgrid.inlineEdit, m);
  6190. return this.each(function () {
  6191. var d = this,
  6192. f, e, b, g = 0,
  6193. h = null,
  6194. n = {},
  6195. l, q;
  6196. 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) {
  6197. f = q[b].name;
  6198. var l = !0 === d.p.treeGrid && f === d.p.ExpandColumn;
  6199. if (l) e = a("span:first", this).html();
  6200. else try {
  6201. e = a.unformat.call(d, this, {
  6202. rowId: c,
  6203. colModel: q[b]
  6204. },
  6205. b)
  6206. } catch (m) {
  6207. e = q[b].edittype && "textarea" === q[b].edittype ? a(this).text() : a(this).html()
  6208. }
  6209. if ("cb" !== f && "subgrid" !== f && "rn" !== f && (d.p.autoencode && (e = a.jgrid.htmlDecode(e)), n[f] = e, !0 === q[b].editable)) {
  6210. null === h && (h = b);
  6211. l ? a("span:first", this).html("") : a(this).html("");
  6212. var p = a.extend({},
  6213. q[b].editoptions || {},
  6214. {
  6215. id: c + "_" + f,
  6216. name: f
  6217. });
  6218. q[b].edittype || (q[b].edittype = "text");
  6219. if ("&nbsp;" === e || "&#160;" === e || 1 === e.length && 160 === e.charCodeAt(0)) e = "";
  6220. var x = a.jgrid.createEl.call(d, q[b].edittype, p, e, !0, a.extend({},
  6221. a.jgrid.ajaxOptions, d.p.ajaxSelectOptions || {}));
  6222. a(x).addClass("editable");
  6223. l ? a("span:first", this).append(x) : a(this).append(x);
  6224. a.jgrid.bindEv.call(d, x, p);
  6225. "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());
  6226. g++
  6227. }
  6228. }), 0 < g && (n.id = c, d.p.savedRow.push(n), a(l).attr("editable", "1"), setTimeout(function () {
  6229. a("td:eq(" + h + ") input", l).focus()
  6230. },
  6231. 0), !0 === m.keys && a(l).bind("keydown",
  6232. function (b) {
  6233. if (27 === b.keyCode) {
  6234. a(d).jqGrid("restoreRow", c, m.afterrestorefunc);
  6235. if (d.p._inlinenav) try {
  6236. a(d).jqGrid("showAddEditButtons")
  6237. } catch (f) { }
  6238. return !1
  6239. }
  6240. if (13 === b.keyCode) {
  6241. if ("TEXTAREA" === b.target.tagName) return !0;
  6242. if (a(d).jqGrid("saveRow", c, m) && d.p._inlinenav) try {
  6243. a(d).jqGrid("showAddEditButtons")
  6244. } catch (e) { }
  6245. return !1
  6246. }
  6247. }), a(d).triggerHandler("jqGridInlineEditRow", [c, m]), a.isFunction(m.oneditfunc) && m.oneditfunc.call(d, c))))))
  6248. })
  6249. },
  6250. saveRow: function (c, e, b, l, h, n, p) {
  6251. var g = a.makeArray(arguments).slice(1),
  6252. f = {};
  6253. "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));
  6254. var f = a.extend(!0, {
  6255. successfunc: null,
  6256. url: null,
  6257. extraparam: {},
  6258. aftersavefunc: null,
  6259. errorfunc: null,
  6260. afterrestorefunc: null,
  6261. restoreAfterError: !0,
  6262. mtype: "POST"
  6263. },
  6264. a.jgrid.inlineEdit, f),
  6265. m = !1,
  6266. d = this[0],
  6267. r,
  6268. k = {},
  6269. y = {},
  6270. v = {},
  6271. w,
  6272. z,
  6273. u;
  6274. if (!d.grid) return m;
  6275. u = a(d).jqGrid("getInd", c, !0);
  6276. if (!1 === u) return m;
  6277. g = a.isFunction(f.beforeSaveRow) ? f.beforeSaveRow.call(d, f, c) : void 0;
  6278. void 0 === g && (g = !0);
  6279. if (g) {
  6280. g = a(u).attr("editable");
  6281. f.url = f.url || d.p.editurl;
  6282. if ("1" === g) {
  6283. var t;
  6284. a('td[role="gridcell"]', u).each(function (c) {
  6285. t = d.p.colModel[c];
  6286. r = t.name;
  6287. if ("cb" !== r && "subgrid" !== r && !0 === t.editable && "rn" !== r && !a(this).hasClass("not-editable-cell")) {
  6288. switch (t.edittype) {
  6289. case "checkbox":
  6290. var b = ["Yes", "No"];
  6291. t.editoptions && (b = t.editoptions.value.split(":"));
  6292. k[r] = a("input", this).is(":checked") ? b[0] : b[1];
  6293. break;
  6294. case "text":
  6295. case "password":
  6296. case "textarea":
  6297. case "button":
  6298. k[r] = a("input, textarea", this).val();
  6299. break;
  6300. case "select":
  6301. if (t.editoptions.multiple) {
  6302. var b = a("select", this),
  6303. e = [];
  6304. k[r] = a(b).val();
  6305. k[r] = k[r] ? k[r].join(",") : "";
  6306. a("select option:selected", this).each(function (d, b) {
  6307. e[d] = a(b).text()
  6308. });
  6309. y[r] = e.join(",")
  6310. } else k[r] = a("select option:selected", this).val(),
  6311. y[r] = a("select option:selected", this).text();
  6312. t.formatter && "select" === t.formatter && (y = {});
  6313. break;
  6314. case "custom":
  6315. try {
  6316. if (t.editoptions && a.isFunction(t.editoptions.custom_value)) {
  6317. if (k[r] = t.editoptions.custom_value.call(d, a(".customelement", this), "get"), void 0 === k[r]) throw "e2";
  6318. } else throw "e1";
  6319. } catch (g) {
  6320. "e1" === g && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  6321. "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)
  6322. }
  6323. }
  6324. z = a.jgrid.checkValues.call(d, k[r], c);
  6325. if (!1 === z[0]) return !1;
  6326. d.p.autoencode && (k[r] = a.jgrid.htmlEncode(k[r]));
  6327. "clientArray" !== f.url && t.editoptions && !0 === t.editoptions.NullIfEmpty && "" === k[r] && (v[r] = "null")
  6328. }
  6329. });
  6330. if (!1 === z[0]) {
  6331. try {
  6332. var q = a(d).jqGrid("getGridRowById", c),
  6333. s = a.jgrid.findPos(q);
  6334. a.jgrid.info_dialog(a.jgrid.errors.errcap, z[1], a.jgrid.edit.bClose, {
  6335. left: s[0],
  6336. top: s[1] + a(q).outerHeight()
  6337. })
  6338. } catch (A) {
  6339. alert(z[1])
  6340. }
  6341. return m
  6342. }
  6343. g = d.p.prmNames;
  6344. q = c;
  6345. 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;
  6346. 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({},
  6347. k, d.p.inlineData, f.extraparam));
  6348. if ("clientArray" === f.url) {
  6349. k = a.extend({},
  6350. k, y);
  6351. d.p.autoencode && a.each(k,
  6352. function (d, b) {
  6353. k[d] = a.jgrid.htmlDecode(b)
  6354. });
  6355. g = a(d).jqGrid("setRowData", c, k);
  6356. a(u).attr("editable", "0");
  6357. for (s = 0; s < d.p.savedRow.length; s++) if (String(d.p.savedRow[s].id) === String(q)) {
  6358. w = s;
  6359. break
  6360. }
  6361. 0 <= w && d.p.savedRow.splice(w, 1);
  6362. a(d).triggerHandler("jqGridInlineAfterSaveRow", [c, g, k, f]);
  6363. a.isFunction(f.aftersavefunc) && f.aftersavefunc.call(d, c, g, f);
  6364. m = !0;
  6365. a(u).removeClass("jqgrid-new-row").unbind("keydown")
  6366. } else a("#lui_" + a.jgrid.jqID(d.p.id)).show(),
  6367. v = a.extend({},
  6368. k, v),
  6369. v[s] = a.jgrid.stripPref(d.p.idPrefix, v[s]),
  6370. a.ajax(a.extend({
  6371. url: f.url,
  6372. data: a.isFunction(d.p.serializeRowData) ? d.p.serializeRowData.call(d, v) : v,
  6373. type: f.mtype,
  6374. async: !1,
  6375. complete: function (b, e) {
  6376. a("#lui_" + a.jgrid.jqID(d.p.id)).hide();
  6377. if ("success" === e) {
  6378. var g = !0,
  6379. h;
  6380. h = a(d).triggerHandler("jqGridInlineSuccessSaveRow", [b, c, f]);
  6381. a.isArray(h) || (h = [!0, k]);
  6382. h[0] && a.isFunction(f.successfunc) && (h = f.successfunc.call(d, b));
  6383. a.isArray(h) ? (g = h[0], k = h[1] || k) : g = h;
  6384. if (!0 === g) {
  6385. d.p.autoencode && a.each(k,
  6386. function (b, d) {
  6387. k[b] = a.jgrid.htmlDecode(d)
  6388. });
  6389. k = a.extend({},
  6390. k, y);
  6391. a(d).jqGrid("setRowData", c, k);
  6392. a(u).attr("editable", "0");
  6393. for (g = 0; g < d.p.savedRow.length; g++) if (String(d.p.savedRow[g].id) === String(c)) {
  6394. w = g;
  6395. break
  6396. }
  6397. 0 <= w && d.p.savedRow.splice(w, 1);
  6398. a(d).triggerHandler("jqGridInlineAfterSaveRow", [c, b, k, f]);
  6399. a.isFunction(f.aftersavefunc) && f.aftersavefunc.call(d, c, b);
  6400. m = !0;
  6401. a(u).removeClass("jqgrid-new-row").unbind("keydown")
  6402. } else a(d).triggerHandler("jqGridInlineErrorSaveRow", [c, b, e, null, f]),
  6403. a.isFunction(f.errorfunc) && f.errorfunc.call(d, c, b, e, null),
  6404. !0 === f.restoreAfterError && a(d).jqGrid("restoreRow", c, f.afterrestorefunc)
  6405. }
  6406. },
  6407. error: function (b, e, g) {
  6408. a("#lui_" + a.jgrid.jqID(d.p.id)).hide();
  6409. a(d).triggerHandler("jqGridInlineErrorSaveRow", [c, b, e, g, f]);
  6410. if (a.isFunction(f.errorfunc)) f.errorfunc.call(d, c, b, e, g);
  6411. else {
  6412. b = b.responseText || b.statusText;
  6413. try {
  6414. a.jgrid.info_dialog(a.jgrid.errors.errcap, '<div class="ui-state-error">' + b + "</div>", a.jgrid.edit.bClose, {
  6415. buttonalign: "right"
  6416. })
  6417. } catch (h) {
  6418. alert(b)
  6419. }
  6420. } !0 === f.restoreAfterError && a(d).jqGrid("restoreRow", c, f.afterrestorefunc)
  6421. }
  6422. },
  6423. a.jgrid.ajaxOptions, d.p.ajaxRowOptions || {}))
  6424. }
  6425. return m
  6426. }
  6427. },
  6428. restoreRow: function (c, e) {
  6429. var b = a.makeArray(arguments).slice(1),
  6430. l = {};
  6431. "object" === a.type(b[0]) ? l = b[0] : a.isFunction(e) && (l.afterrestorefunc = e);
  6432. l = a.extend(!0, {},
  6433. a.jgrid.inlineEdit, l);
  6434. return this.each(function () {
  6435. var b = this,
  6436. e = -1,
  6437. p, g = {},
  6438. f;
  6439. 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))) {
  6440. for (f = 0; f < b.p.savedRow.length; f++) if (String(b.p.savedRow[f].id) === String(c)) {
  6441. e = f;
  6442. break
  6443. }
  6444. if (0 <= e) {
  6445. if (a.isFunction(a.fn.datepicker)) try {
  6446. a("input.hasDatepicker", "#" + a.jgrid.jqID(p.id)).datepicker("hide")
  6447. } catch (m) { }
  6448. a.each(b.p.colModel,
  6449. function () {
  6450. !0 === this.editable && b.p.savedRow[e].hasOwnProperty(this.name) && (g[this.name] = b.p.savedRow[e][this.name])
  6451. });
  6452. a(b).jqGrid("setRowData", c, g);
  6453. a(p).attr("editable", "0").unbind("keydown");
  6454. b.p.savedRow.splice(e, 1);
  6455. a("#" + a.jgrid.jqID(c), "#" + a.jgrid.jqID(b.p.id)).hasClass("jqgrid-new-row") && setTimeout(function () {
  6456. a(b).jqGrid("delRowData", c);
  6457. a(b).jqGrid("showAddEditButtons")
  6458. },
  6459. 0)
  6460. }
  6461. a(b).triggerHandler("jqGridInlineAfterRestoreRow", [c]);
  6462. a.isFunction(l.afterrestorefunc) && l.afterrestorefunc.call(b, c)
  6463. }
  6464. })
  6465. },
  6466. addRow: function (c) {
  6467. c = a.extend(!0, {
  6468. rowID: null,
  6469. initdata: {},
  6470. position: "first",
  6471. useDefValues: !0,
  6472. useFormatter: !1,
  6473. addRowParams: {
  6474. extraparam: {}
  6475. }
  6476. },
  6477. c || {});
  6478. return this.each(function () {
  6479. if (this.grid) {
  6480. var e = this,
  6481. b = a.isFunction(c.beforeAddRow) ? c.beforeAddRow.call(e, c.addRowParams) : void 0;
  6482. void 0 === b && (b = !0);
  6483. 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 () {
  6484. if (this.editoptions && this.editoptions.defaultValue) {
  6485. var b = this.editoptions.defaultValue,
  6486. b = a.isFunction(b) ? b.call(e) : b;
  6487. c.initdata[this.name] = b
  6488. }
  6489. }), 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)))
  6490. }
  6491. })
  6492. },
  6493. inlineNav: function (c, e) {
  6494. e = a.extend(!0, {
  6495. edit: !0,
  6496. editicon: "ui-icon-pencil",
  6497. add: !0,
  6498. addicon: "ui-icon-plus",
  6499. save: !0,
  6500. saveicon: "ui-icon-disk",
  6501. cancel: !0,
  6502. cancelicon: "ui-icon-cancel",
  6503. addParams: {
  6504. addRowParams: {
  6505. extraparam: {}
  6506. }
  6507. },
  6508. editParams: {},
  6509. restoreAfterSelect: !0
  6510. },
  6511. a.jgrid.nav, e || {});
  6512. return this.each(function () {
  6513. if (this.grid) {
  6514. var b = this,
  6515. l, h = a.jgrid.jqID(b.p.id);
  6516. b.p._inlinenav = !0;
  6517. if (!0 === e.addParams.useFormatter) {
  6518. var n = b.p.colModel,
  6519. p;
  6520. for (p = 0; p < n.length; p++) if (n[p].formatter && "actions" === n[p].formatter) {
  6521. n[p].formatoptions && (n = a.extend({
  6522. keys: !1,
  6523. onEdit: null,
  6524. onSuccess: null,
  6525. afterSave: null,
  6526. onError: null,
  6527. afterRestore: null,
  6528. extraparam: {},
  6529. url: null
  6530. },
  6531. n[p].formatoptions), e.addParams.addRowParams = {
  6532. keys: n.keys,
  6533. oneditfunc: n.onEdit,
  6534. successfunc: n.onSuccess,
  6535. url: n.url,
  6536. extraparam: n.extraparam,
  6537. aftersavefunc: n.afterSave,
  6538. errorfunc: n.onError,
  6539. afterrestorefunc: n.afterRestore
  6540. });
  6541. break
  6542. }
  6543. }
  6544. e.add && a(b).jqGrid("navButtonAdd", c, {
  6545. caption: e.addtext,
  6546. title: e.addtitle,
  6547. buttonicon: e.addicon,
  6548. id: b.p.id + "_iladd",
  6549. onClickButton: function () {
  6550. a(b).jqGrid("addRow", e.addParams);
  6551. 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"))
  6552. }
  6553. });
  6554. e.edit && a(b).jqGrid("navButtonAdd", c, {
  6555. caption: e.edittext,
  6556. title: e.edittitle,
  6557. buttonicon: e.editicon,
  6558. id: b.p.id + "_iledit",
  6559. onClickButton: function () {
  6560. var c = a(b).jqGrid("getGridParam", "selrow");
  6561. 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", {
  6562. gbox: "#gbox_" + h,
  6563. jqm: !0
  6564. }), a("#jqg_alrt").focus())
  6565. }
  6566. });
  6567. e.save && (a(b).jqGrid("navButtonAdd", c, {
  6568. caption: e.savetext || "",
  6569. title: e.savetitle || "Save row",
  6570. buttonicon: e.saveicon,
  6571. id: b.p.id + "_ilsave",
  6572. onClickButton: function () {
  6573. var c = b.p.savedRow[0].id;
  6574. if (c) {
  6575. var f = b.p.prmNames,
  6576. m = f.oper,
  6577. d = e.editParams;
  6578. 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);
  6579. a(b).jqGrid("saveRow", c, d) && a(b).jqGrid("showAddEditButtons")
  6580. } else a.jgrid.viewModal("#alertmod", {
  6581. gbox: "#gbox_" + h,
  6582. jqm: !0
  6583. }),
  6584. a("#jqg_alrt").focus()
  6585. }
  6586. }), a("#" + h + "_ilsave").addClass("ui-state-disabled"));
  6587. e.cancel && (a(b).jqGrid("navButtonAdd", c, {
  6588. caption: e.canceltext || "",
  6589. title: e.canceltitle || "Cancel row editing",
  6590. buttonicon: e.cancelicon,
  6591. id: b.p.id + "_ilcancel",
  6592. onClickButton: function () {
  6593. var c = b.p.savedRow[0].id,
  6594. f = e.editParams;
  6595. 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", {
  6596. gbox: "#gbox_" + h,
  6597. jqm: !0
  6598. }), a("#jqg_alrt").focus())
  6599. }
  6600. }), 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) {
  6601. var h = !0;
  6602. 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"));
  6603. l && (h = l.call(b, c, f));
  6604. return h
  6605. })
  6606. }
  6607. })
  6608. },
  6609. showAddEditButtons: function () {
  6610. return this.each(function () {
  6611. if (this.grid) {
  6612. var c = a.jgrid.jqID(this.p.id);
  6613. a("#" + c + "_ilsave").addClass("ui-state-disabled");
  6614. a("#" + c + "_ilcancel").addClass("ui-state-disabled");
  6615. a("#" + c + "_iladd").removeClass("ui-state-disabled");
  6616. a("#" + c + "_iledit").removeClass("ui-state-disabled")
  6617. }
  6618. })
  6619. }
  6620. })
  6621. })(jQuery); (function (b) {
  6622. b.jgrid.extend({
  6623. editCell: function (d, f, a) {
  6624. return this.each(function () {
  6625. var c = this,
  6626. g, e, h, k;
  6627. if (c.grid && !0 === c.p.cellEdit) {
  6628. f = parseInt(f, 10);
  6629. c.p.selrow = c.rows[d].id;
  6630. c.p.knv || b(c).jqGrid("GridNav");
  6631. if (0 < c.p.savedRow.length) {
  6632. if (!0 === a && d == c.p.iRow && f == c.p.iCol) return;
  6633. b(c).jqGrid("saveCell", c.p.savedRow[0].id, c.p.savedRow[0].ic)
  6634. } else window.setTimeout(function () {
  6635. b("#" + b.jgrid.jqID(c.p.knv)).attr("tabindex", "-1").focus()
  6636. },
  6637. 0);
  6638. k = c.p.colModel[f];
  6639. g = k.name;
  6640. if ("subgrid" !== g && "cb" !== g && "rn" !== g) {
  6641. h = b("td:eq(" + f + ")", c.rows[d]);
  6642. 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")),
  6643. h.addClass("edit-cell ui-state-highlight"),
  6644. b(c.rows[d]).addClass("selected-row ui-state-hover"),
  6645. e = h.html().replace(/\&#160\;/ig, ""),
  6646. b(c).triggerHandler("jqGridSelectCell", [c.rows[d].id, g, e, d, f]),
  6647. b.isFunction(c.p.onSelectCell) && c.p.onSelectCell.call(c, c.rows[d].id, g, e, d, f);
  6648. else {
  6649. 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"));
  6650. b(h).addClass("edit-cell ui-state-highlight");
  6651. b(c.rows[d]).addClass("selected-row ui-state-hover");
  6652. try {
  6653. e = b.unformat.call(c, h, {
  6654. rowId: c.rows[d].id,
  6655. colModel: k
  6656. },
  6657. f)
  6658. } catch (m) {
  6659. e = k.edittype && "textarea" === k.edittype ? b(h).text() : b(h).html()
  6660. }
  6661. c.p.autoencode && (e = b.jgrid.htmlDecode(e));
  6662. k.edittype || (k.edittype = "text");
  6663. c.p.savedRow.push({
  6664. id: d,
  6665. ic: f,
  6666. name: g,
  6667. v: e
  6668. });
  6669. if ("&nbsp;" === e || "&#160;" === e || 1 === e.length && 160 === e.charCodeAt(0)) e = "";
  6670. if (b.isFunction(c.p.formatCell)) {
  6671. var l = c.p.formatCell.call(c, c.rows[d].id, g, e, d, f);
  6672. void 0 !== l && (e = l)
  6673. }
  6674. b(c).triggerHandler("jqGridBeforeEditCell", [c.rows[d].id, g, e, d, f]);
  6675. b.isFunction(c.p.beforeEditCell) && c.p.beforeEditCell.call(c, c.rows[d].id, g, e, d, f);
  6676. var l = b.extend({},
  6677. k.editoptions || {},
  6678. {
  6679. id: d + "_" + g,
  6680. name: g
  6681. }),
  6682. q = b.jgrid.createEl.call(c, k.edittype, l, e, !0, b.extend({},
  6683. b.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
  6684. b(h).html("").append(q).attr("tabindex", "0");
  6685. b.jgrid.bindEv.call(c, q, l);
  6686. window.setTimeout(function () {
  6687. b(q).focus()
  6688. },
  6689. 0);
  6690. b("input, select, textarea", h).bind("keydown",
  6691. function (a) {
  6692. 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));
  6693. if (13 === a.keyCode) return b(c).jqGrid("saveCell", d, f),
  6694. !1;
  6695. if (9 === a.keyCode) {
  6696. if (c.grid.hDiv.loading) return !1;
  6697. a.shiftKey ? b(c).jqGrid("prevCell", d, f) : b(c).jqGrid("nextCell", d, f)
  6698. }
  6699. a.stopPropagation()
  6700. });
  6701. b(c).triggerHandler("jqGridAfterEditCell", [c.rows[d].id, g, e, d, f]);
  6702. b.isFunction(c.p.afterEditCell) && c.p.afterEditCell.call(c, c.rows[d].id, g, e, d, f)
  6703. }
  6704. c.p.iCol = f;
  6705. c.p.iRow = d
  6706. }
  6707. }
  6708. })
  6709. },
  6710. saveCell: function (d, f) {
  6711. return this.each(function () {
  6712. var a = this,
  6713. c;
  6714. if (a.grid && !0 === a.p.cellEdit) {
  6715. c = 1 <= a.p.savedRow.length ? 0 : null;
  6716. if (null !== c) {
  6717. var g = b("td:eq(" + f + ")", a.rows[d]),
  6718. e,
  6719. h,
  6720. k = a.p.colModel[f],
  6721. m = k.name,
  6722. l = b.jgrid.jqID(m);
  6723. switch (k.edittype) {
  6724. case "select":
  6725. if (k.editoptions.multiple) {
  6726. var l = b("#" + d + "_" + l, a.rows[d]),
  6727. q = []; (e = b(l).val()) ? e.join(",") : e = "";
  6728. b("option:selected", l).each(function (a, c) {
  6729. q[a] = b(c).text()
  6730. });
  6731. h = q.join(",")
  6732. } else e = b("#" + d + "_" + l + " option:selected", a.rows[d]).val(),
  6733. h = b("#" + d + "_" + l + " option:selected", a.rows[d]).text();
  6734. k.formatter && (h = e);
  6735. break;
  6736. case "checkbox":
  6737. var n = ["Yes", "No"];
  6738. k.editoptions && (n = k.editoptions.value.split(":"));
  6739. h = e = b("#" + d + "_" + l, a.rows[d]).is(":checked") ? n[0] : n[1];
  6740. break;
  6741. case "password":
  6742. case "text":
  6743. case "textarea":
  6744. case "button":
  6745. h = e = b("#" + d + "_" + l, a.rows[d]).val();
  6746. break;
  6747. case "custom":
  6748. try {
  6749. if (k.editoptions && b.isFunction(k.editoptions.custom_value)) {
  6750. e = k.editoptions.custom_value.call(a, b(".customelement", g), "get");
  6751. if (void 0 === e) throw "e2";
  6752. h = e
  6753. } else throw "e1";
  6754. } catch (r) {
  6755. "e1" === r && b.jgrid.info_dialog(b.jgrid.errors.errcap, "function 'custom_value' " + b.jgrid.edit.msg.nodefined, b.jgrid.edit.bClose),
  6756. "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)
  6757. }
  6758. }
  6759. if (h !== a.p.savedRow[c].v) {
  6760. if (c = b(a).triggerHandler("jqGridBeforeSaveCell", [a.rows[d].id, m, e, d, f])) h = e = c;
  6761. b.isFunction(a.p.beforeSaveCell) && (c = a.p.beforeSaveCell.call(a, a.rows[d].id, m, e, d, f)) && (h = e = c);
  6762. var s = b.jgrid.checkValues.call(a, e, f);
  6763. if (!0 === s[0]) {
  6764. c = b(a).triggerHandler("jqGridBeforeSubmitCell", [a.rows[d].id, m, e, d, f]) || {};
  6765. b.isFunction(a.p.beforeSubmitCell) && ((c = a.p.beforeSubmitCell.call(a, a.rows[d].id, m, e, d, f)) || (c = {}));
  6766. 0 < b("input.hasDatepicker", g).length && b("input.hasDatepicker", g).datepicker("hide");
  6767. if ("remote" === a.p.cellsubmit) if (a.p.cellurl) {
  6768. var p = {};
  6769. a.p.autoencode && (e = b.jgrid.htmlEncode(e));
  6770. p[m] = e;
  6771. n = a.p.prmNames;
  6772. k = n.id;
  6773. l = n.oper;
  6774. p[k] = b.jgrid.stripPref(a.p.idPrefix, a.rows[d].id);
  6775. p[l] = n.editoper;
  6776. p = b.extend(c, p);
  6777. b("#lui_" + b.jgrid.jqID(a.p.id)).show();
  6778. a.grid.hDiv.loading = !0;
  6779. b.ajax(b.extend({
  6780. url: a.p.cellurl,
  6781. data: b.isFunction(a.p.serializeCellData) ? a.p.serializeCellData.call(a, p) : p,
  6782. type: "POST",
  6783. complete: function (c, k) {
  6784. b("#lui_" + a.p.id).hide();
  6785. a.grid.hDiv.loading = !1;
  6786. if ("success" === k) {
  6787. 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))
  6788. }
  6789. },
  6790. error: function (c, e, h) {
  6791. b("#lui_" + b.jgrid.jqID(a.p.id)).hide();
  6792. a.grid.hDiv.loading = !1;
  6793. b(a).triggerHandler("jqGridErrorCell", [c, e, h]);
  6794. 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);
  6795. b(a).jqGrid("restoreCell", d, f)
  6796. }
  6797. },
  6798. b.jgrid.ajaxOptions, a.p.ajaxCellOptions || {}))
  6799. } else try {
  6800. b.jgrid.info_dialog(b.jgrid.errors.errcap, b.jgrid.errors.nourl, b.jgrid.edit.bClose),
  6801. b(a).jqGrid("restoreCell", d, f)
  6802. } catch (t) { }
  6803. "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))
  6804. } else try {
  6805. window.setTimeout(function () {
  6806. b.jgrid.info_dialog(b.jgrid.errors.errcap, e + " " + s[1], b.jgrid.edit.bClose)
  6807. },
  6808. 100),
  6809. b(a).jqGrid("restoreCell", d, f)
  6810. } catch (u) { }
  6811. } else b(a).jqGrid("restoreCell", d, f)
  6812. }
  6813. window.setTimeout(function () {
  6814. b("#" + b.jgrid.jqID(a.p.knv)).attr("tabindex", "-1").focus()
  6815. },
  6816. 0)
  6817. }
  6818. })
  6819. },
  6820. restoreCell: function (d, f) {
  6821. return this.each(function () {
  6822. var a = this,
  6823. c;
  6824. if (a.grid && !0 === a.p.cellEdit) {
  6825. c = 1 <= a.p.savedRow.length ? 0 : null;
  6826. if (null !== c) {
  6827. var g = b("td:eq(" + f + ")", a.rows[d]);
  6828. if (b.isFunction(b.fn.datepicker)) try {
  6829. b("input.hasDatepicker", g).datepicker("hide")
  6830. } catch (e) { }
  6831. b(g).empty().attr("tabindex", "-1");
  6832. b(a).jqGrid("setCell", a.rows[d].id, f, a.p.savedRow[c].v, !1, !1, !0);
  6833. b(a).triggerHandler("jqGridAfterRestoreCell", [a.rows[d].id, a.p.savedRow[c].v, d, f]);
  6834. b.isFunction(a.p.afterRestoreCell) && a.p.afterRestoreCell.call(a, a.rows[d].id, a.p.savedRow[c].v, d, f);
  6835. a.p.savedRow.splice(0, 1)
  6836. }
  6837. window.setTimeout(function () {
  6838. b("#" + a.p.knv).attr("tabindex", "-1").focus()
  6839. },
  6840. 0)
  6841. }
  6842. })
  6843. },
  6844. nextCell: function (d, f) {
  6845. return this.each(function () {
  6846. var a = !1,
  6847. c;
  6848. if (this.grid && !0 === this.p.cellEdit) {
  6849. for (c = f + 1; c < this.p.colModel.length; c++) if (!0 === this.p.colModel[c].editable) {
  6850. a = c;
  6851. break
  6852. } !1 !== a ? b(this).jqGrid("editCell", d, a, !0) : 0 < this.p.savedRow.length && b(this).jqGrid("saveCell", d, f)
  6853. }
  6854. })
  6855. },
  6856. prevCell: function (d, f) {
  6857. return this.each(function () {
  6858. var a = !1,
  6859. c;
  6860. if (this.grid && !0 === this.p.cellEdit) {
  6861. for (c = f - 1; 0 <= c; c--) if (!0 === this.p.colModel[c].editable) {
  6862. a = c;
  6863. break
  6864. } !1 !== a ? b(this).jqGrid("editCell", d, a, !0) : 0 < this.p.savedRow.length && b(this).jqGrid("saveCell", d, f)
  6865. }
  6866. })
  6867. },
  6868. GridNav: function () {
  6869. return this.each(function () {
  6870. function d(c, d, e) {
  6871. if ("v" === e.substr(0, 1)) {
  6872. var f = b(a.grid.bDiv)[0].clientHeight,
  6873. g = b(a.grid.bDiv)[0].scrollTop,
  6874. n = a.rows[c].offsetTop + a.rows[c].clientHeight,
  6875. r = a.rows[c].offsetTop;
  6876. "vd" === e && n >= f && (b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop + a.rows[c].clientHeight);
  6877. "vu" === e && r < g && (b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop - a.rows[c].clientHeight)
  6878. }
  6879. "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))
  6880. }
  6881. function f(b, c) {
  6882. var d, e;
  6883. if ("lft" === c) for (d = b + 1, e = b; 0 <= e; e--) if (!0 !== a.p.colModel[e].hidden) {
  6884. d = e;
  6885. break
  6886. }
  6887. if ("rgt" === c) for (d = b - 1, e = b; e < a.p.colModel.length; e++) if (!0 !== a.p.colModel[e].hidden) {
  6888. d = e;
  6889. break
  6890. }
  6891. return d
  6892. }
  6893. var a = this;
  6894. if (a.grid && !0 === a.p.cellEdit) {
  6895. a.p.knv = a.p.id + "_kn";
  6896. 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>"),
  6897. g,
  6898. e;
  6899. b(c).insertBefore(a.grid.cDiv);
  6900. b("#" + a.p.knv).focus().keydown(function (c) {
  6901. e = c.keyCode;
  6902. "rtl" === a.p.direction && (37 === e ? e = 39 : 39 === e && (e = 37));
  6903. switch (e) {
  6904. case 38:
  6905. 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));
  6906. break;
  6907. case 40:
  6908. 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));
  6909. break;
  6910. case 37:
  6911. 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));
  6912. break;
  6913. case 39:
  6914. 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));
  6915. break;
  6916. case 13:
  6917. 0 <= parseInt(a.p.iCol, 10) && 0 <= parseInt(a.p.iRow, 10) && b(a).jqGrid("editCell", a.p.iRow, a.p.iCol, !0);
  6918. break;
  6919. default:
  6920. return !0
  6921. }
  6922. return !1
  6923. })
  6924. }
  6925. })
  6926. },
  6927. getChangedCells: function (d) {
  6928. var f = [];
  6929. d || (d = "all");
  6930. this.each(function () {
  6931. var a = this,
  6932. c;
  6933. a.grid && !0 === a.p.cellEdit && b(a.rows).each(function (g) {
  6934. var e = {};
  6935. b(this).hasClass("edited") && (b("td", this).each(function (f) {
  6936. c = a.p.colModel[f].name;
  6937. if ("cb" !== c && "subgrid" !== c) if ("dirty" === d) {
  6938. if (b(this).hasClass("dirty-cell")) try {
  6939. e[c] = b.unformat.call(a, this, {
  6940. rowId: a.rows[g].id,
  6941. colModel: a.p.colModel[f]
  6942. },
  6943. f)
  6944. } catch (k) {
  6945. e[c] = b.jgrid.htmlDecode(b(this).html())
  6946. }
  6947. } else try {
  6948. e[c] = b.unformat.call(a, this, {
  6949. rowId: a.rows[g].id,
  6950. colModel: a.p.colModel[f]
  6951. },
  6952. f)
  6953. } catch (m) {
  6954. e[c] = b.jgrid.htmlDecode(b(this).html())
  6955. }
  6956. }), e.id = this.id, f.push(e))
  6957. })
  6958. });
  6959. return f
  6960. }
  6961. })
  6962. })(jQuery); (function (c) {
  6963. c.fn.jqm = function (a) {
  6964. var k = {
  6965. overlay: 50,
  6966. closeoverlay: !0,
  6967. overlayClass: "jqmOverlay",
  6968. closeClass: "jqmClose",
  6969. trigger: ".jqModal",
  6970. ajax: d,
  6971. ajaxText: "",
  6972. target: d,
  6973. modal: d,
  6974. toTop: d,
  6975. onShow: d,
  6976. onHide: d,
  6977. onLoad: d
  6978. };
  6979. return this.each(function () {
  6980. if (this._jqm) return l[this._jqm].c = c.extend({},
  6981. l[this._jqm].c, a);
  6982. n++;
  6983. this._jqm = n;
  6984. l[n] = {
  6985. c: c.extend(k, c.jqm.params, a),
  6986. a: d,
  6987. w: c(this).addClass("jqmID" + n),
  6988. s: n
  6989. };
  6990. k.trigger && c(this).jqmAddTrigger(k.trigger)
  6991. })
  6992. };
  6993. c.fn.jqmAddClose = function (a) {
  6994. return r(this, a, "jqmHide")
  6995. };
  6996. c.fn.jqmAddTrigger = function (a) {
  6997. return r(this, a, "jqmShow")
  6998. };
  6999. c.fn.jqmShow = function (a) {
  7000. return this.each(function () {
  7001. c.jqm.open(this._jqm, a)
  7002. })
  7003. };
  7004. c.fn.jqmHide = function (a) {
  7005. return this.each(function () {
  7006. c.jqm.close(this._jqm, a)
  7007. })
  7008. };
  7009. c.jqm = {
  7010. hash: {},
  7011. open: function (a, k) {
  7012. var b = l[a],
  7013. e = b.c,
  7014. h = "." + e.closeClass,
  7015. f = parseInt(b.w.css("z-index")),
  7016. f = 0 < f ? f : 3E3,
  7017. g = c("<div></div>").css({
  7018. height: "100%",
  7019. width: "100%",
  7020. position: "fixed",
  7021. left: 0,
  7022. top: 0,
  7023. "z-index": f - 1,
  7024. opacity: e.overlay / 100
  7025. });
  7026. if (b.a) return d;
  7027. b.t = k;
  7028. b.a = !0;
  7029. b.w.css("z-index", f);
  7030. e.modal ? (m[0] || setTimeout(function () {
  7031. s("bind")
  7032. },
  7033. 1), m.push(a)) : 0 < e.overlay ? e.closeoverlay && b.w.jqmAddClose(g) : g = d;
  7034. b.o = g ? g.addClass(e.overlayClass).prependTo("body") : d;
  7035. 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,
  7036. function () {
  7037. e.onLoad && e.onLoad.call(this, b);
  7038. h && b.w.jqmAddClose(c(h, b.w));
  7039. p(b)
  7040. })) : h && b.w.jqmAddClose(c(h, b.w));
  7041. e.toTop && b.o && b.w.before('<span id="jqmP' + b.w[0]._jqm + '"></span>').insertAfter(b.o);
  7042. e.onShow ? e.onShow(b) : b.w.show();
  7043. p(b);
  7044. return d
  7045. },
  7046. close: function (a) {
  7047. a = l[a];
  7048. if (!a.a) return d;
  7049. a.a = d;
  7050. m[0] && (m.pop(), m[0] || s("unbind"));
  7051. a.c.toTop && a.o && c("#jqmP" + a.w[0]._jqm).after(a.w).remove();
  7052. if (a.c.onHide) a.c.onHide(a);
  7053. else a.w.hide(),
  7054. a.o && a.o.remove();
  7055. return d
  7056. },
  7057. params: {}
  7058. };
  7059. var n = 0,
  7060. l = c.jqm.hash,
  7061. m = [],
  7062. d = !1,
  7063. p = function (a) {
  7064. try {
  7065. c(":input:visible", a.w)[0].focus()
  7066. } catch (d) { }
  7067. },
  7068. s = function (a) {
  7069. c(document)[a]("keypress", q)[a]("keydown", q)[a]("mousedown", q)
  7070. },
  7071. q = function (a) {
  7072. var d = l[m[m.length - 1]],
  7073. b = !c(a.target).parents(".jqmID" + d.s)[0];
  7074. b && (c(".jqmID" + d.s).each(function () {
  7075. var d = c(this),
  7076. h = d.offset();
  7077. if (h.top <= a.pageY && a.pageY <= h.top + d.height() && h.left <= a.pageX && a.pageX <= h.left + d.width()) return b = !1
  7078. }), p(d));
  7079. return !b
  7080. },
  7081. r = function (a, k, b) {
  7082. return a.each(function () {
  7083. var a = this._jqm;
  7084. c(k).each(function () {
  7085. this[b] || (this[b] = [], c(this).click(function () {
  7086. for (var a in {
  7087. jqmShow: 1,
  7088. jqmHide: 1
  7089. }) for (var b in this[a]) if (l[this[a][b]]) l[this[a][b]].w[a](this);
  7090. return d
  7091. }));
  7092. this[b].push(a)
  7093. })
  7094. })
  7095. }
  7096. })(jQuery); (function (b) {
  7097. b.fn.jqDrag = function (a) {
  7098. return h(this, a, "d")
  7099. };
  7100. b.fn.jqResize = function (a, b) {
  7101. return h(this, a, "r", b)
  7102. };
  7103. b.jqDnR = {
  7104. dnr: {},
  7105. e: 0,
  7106. drag: function (a) {
  7107. "d" == d.k ? e.css({
  7108. left: d.X + a.pageX - d.pX,
  7109. top: d.Y + a.pageY - d.pY
  7110. }) : (e.css({
  7111. width: Math.max(a.pageX - d.pX + d.W, 0),
  7112. height: Math.max(a.pageY - d.pY + d.H, 0)
  7113. }), f && g.css({
  7114. width: Math.max(a.pageX - f.pX + f.W, 0),
  7115. height: Math.max(a.pageY - f.pY + f.H, 0)
  7116. }));
  7117. return !1
  7118. },
  7119. stop: function () {
  7120. b(document).unbind("mousemove", c.drag).unbind("mouseup", c.stop)
  7121. }
  7122. };
  7123. var c = b.jqDnR,
  7124. d = c.dnr,
  7125. e = c.e,
  7126. g, f, h = function (a, c, h, n) {
  7127. return a.each(function () {
  7128. c = c ? b(c, a) : a;
  7129. c.bind("mousedown", {
  7130. e: a,
  7131. k: h
  7132. },
  7133. function (a) {
  7134. var c = a.data,
  7135. k = {};
  7136. e = c.e;
  7137. g = n ? b(n) : !1;
  7138. if ("relative" != e.css("position")) try {
  7139. e.position(k)
  7140. } catch (h) { }
  7141. d = {
  7142. X: k.left || l("left") || 0,
  7143. Y: k.top || l("top") || 0,
  7144. W: l("width") || e[0].scrollWidth || 0,
  7145. H: l("height") || e[0].scrollHeight || 0,
  7146. pX: a.pageX,
  7147. pY: a.pageY,
  7148. k: c.k
  7149. };
  7150. f = g && "d" != c.k ? {
  7151. X: k.left || m("left") || 0,
  7152. Y: k.top || m("top") || 0,
  7153. W: g[0].offsetWidth || m("width") || 0,
  7154. H: g[0].offsetHeight || m("height") || 0,
  7155. pX: a.pageX,
  7156. pY: a.pageY,
  7157. k: c.k
  7158. } : !1;
  7159. if (b("input.hasDatepicker", e[0])[0]) try {
  7160. b("input.hasDatepicker", e[0]).datepicker("hide")
  7161. } catch (p) { }
  7162. b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);
  7163. return !1
  7164. })
  7165. })
  7166. },
  7167. l = function (a) {
  7168. return parseInt(e.css(a), 10) || !1
  7169. },
  7170. m = function (a) {
  7171. return parseInt(g.css(a), 10) || !1
  7172. }
  7173. })(jQuery); (function (b) {
  7174. b.jgrid.extend({
  7175. setSubGrid: function () {
  7176. return this.each(function () {
  7177. var d, c;
  7178. this.p.subGridOptions = b.extend({
  7179. plusicon: "ui-icon-plus",
  7180. minusicon: "ui-icon-minus",
  7181. openicon: "ui-icon-carat-1-sw",
  7182. expandOnLoad: !1,
  7183. delayOnLoad: 50,
  7184. selectOnExpand: !1,
  7185. selectOnCollapse: !1,
  7186. reloadOnExpand: !0
  7187. },
  7188. this.p.subGridOptions || {});
  7189. this.p.colNames.unshift("");
  7190. this.p.colModel.unshift({
  7191. name: "subgrid",
  7192. width: b.jgrid.cell_width ? this.p.subGridWidth + this.p.cellLayout : this.p.subGridWidth,
  7193. sortable: !1,
  7194. resizable: !1,
  7195. hidedlg: !0,
  7196. search: !1,
  7197. fixed: !0
  7198. });
  7199. d = this.p.subGridModel;
  7200. 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"
  7201. })
  7202. },
  7203. addSubGridCell: function (b, c) {
  7204. var a = "",
  7205. p, n;
  7206. this.each(function () {
  7207. a = this.formatCol(b, c);
  7208. n = this.p.id;
  7209. p = this.p.subGridOptions.plusicon
  7210. });
  7211. 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>"
  7212. },
  7213. addSubGrid: function (d, c) {
  7214. return this.each(function () {
  7215. var a = this;
  7216. if (a.grid) {
  7217. var p = function (c, d, h) {
  7218. d = b("<td align='" + a.p.subGridModel[0].align[h] + "'></td>").html(d);
  7219. b(c).append(d)
  7220. },
  7221. n = function (c, d) {
  7222. var h, f, e, g = b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  7223. k = b("<tr></tr>");
  7224. 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>"),
  7225. b(h).html(a.p.subGridModel[0].name[f]),
  7226. b(h).width(a.p.subGridModel[0].width[f]),
  7227. b(k).append(h);
  7228. b(g).append(k);
  7229. c && (e = a.p.xmlReader.subgrid, b(e.root + " " + e.row, c).each(function () {
  7230. k = b("<tr class='ui-widget-content ui-subtblcell'></tr>");
  7231. if (!0 === e.repeatitems) b(e.cell, this).each(function (a) {
  7232. p(k, b(this).text() || "&#160;", a)
  7233. });
  7234. else {
  7235. var c = a.p.subGridModel[0].mapping || a.p.subGridModel[0].name;
  7236. if (c) for (f = 0; f < c.length; f++) p(k, b(c[f], this).text() || "&#160;", f)
  7237. }
  7238. b(g).append(k)
  7239. }));
  7240. h = b("table:first", a.grid.bDiv).attr("id") + "_";
  7241. b("#" + b.jgrid.jqID(h + d)).append(g);
  7242. a.grid.hDiv.loading = !1;
  7243. b("#load_" + b.jgrid.jqID(a.p.id)).hide();
  7244. return !1
  7245. },
  7246. r = function (c, d) {
  7247. var h, f, e, g, k, m = b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  7248. l = b("<tr></tr>");
  7249. 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>"),
  7250. b(h).html(a.p.subGridModel[0].name[f]),
  7251. b(h).width(a.p.subGridModel[0].width[f]),
  7252. b(l).append(h);
  7253. b(m).append(l);
  7254. if (c && (g = a.p.jsonReader.subgrid, h = b.jgrid.getAccessor(c, g.root), void 0 !== h)) for (f = 0; f < h.length; f++) {
  7255. e = h[f];
  7256. l = b("<tr class='ui-widget-content ui-subtblcell'></tr>");
  7257. if (!0 === g.repeatitems) for (g.cell && (e = e[g.cell]), k = 0; k < e.length; k++) p(l, e[k] || "&#160;", k);
  7258. else {
  7259. var n = a.p.subGridModel[0].mapping || a.p.subGridModel[0].name;
  7260. if (n.length) for (k = 0; k < n.length; k++) p(l, e[n[k]] || "&#160;", k)
  7261. }
  7262. b(m).append(l)
  7263. }
  7264. f = b("table:first", a.grid.bDiv).attr("id") + "_";
  7265. b("#" + b.jgrid.jqID(f + d)).append(m);
  7266. a.grid.hDiv.loading = !1;
  7267. b("#load_" + b.jgrid.jqID(a.p.id)).hide();
  7268. return !1
  7269. },
  7270. v = function (c) {
  7271. var e, d, f, g;
  7272. e = b(c).attr("id");
  7273. d = {
  7274. nd_: (new Date).getTime()
  7275. };
  7276. d[a.p.prmNames.subgridid] = e;
  7277. if (!a.p.subGridModel[0]) return !1;
  7278. 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, ""));
  7279. 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) {
  7280. case "xml":
  7281. case "json":
  7282. b.ajax(b.extend({
  7283. type:
  7284. a.p.mtype,
  7285. url: a.p.subGridUrl,
  7286. dataType: a.p.subgridtype,
  7287. data: b.isFunction(a.p.serializeSubGridData) ? a.p.serializeSubGridData.call(a, d) : d,
  7288. complete: function (c) {
  7289. "xml" === a.p.subgridtype ? n(c.responseXML, e) : r(b.jgrid.parse(c.responseText), e)
  7290. }
  7291. },
  7292. b.jgrid.ajaxOptions, a.p.ajaxSubgridOptions || {}))
  7293. }
  7294. return !1
  7295. },
  7296. e,
  7297. m,
  7298. s,
  7299. t = 0,
  7300. g,
  7301. l;
  7302. b.each(a.p.colModel,
  7303. function () {
  7304. !0 !== this.hidden && "rn" !== this.name && "cb" !== this.name || t++
  7305. });
  7306. var u = a.rows.length,
  7307. q = 1;
  7308. void 0 !== c && 0 < c && (q = c, u = c + 1);
  7309. for (; q < u;) b(a.rows[q]).hasClass("jqgrow") && b(a.rows[q].cells[d]).bind("click",
  7310. function () {
  7311. var c = b(this).parent("tr")[0];
  7312. l = c.nextSibling;
  7313. if (b(this).hasClass("sgcollapsed")) {
  7314. m = a.p.id;
  7315. e = c.id;
  7316. if (!0 === a.p.subGridOptions.reloadOnExpand || !1 === a.p.subGridOptions.reloadOnExpand && !b(l).hasClass("ui-subgrid")) {
  7317. s = 1 <= d ? "<td colspan='" + d + "'>&#160;</td>" : "";
  7318. 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));
  7319. if (!1 === g) return !1;
  7320. 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>");
  7321. b(a).triggerHandler("jqGridSubGridRowExpanded", [m + "_" + e, e]);
  7322. b.isFunction(a.p.subGridRowExpanded) ? a.p.subGridRowExpanded.call(a, m + "_" + e, e) : v(c)
  7323. } else b(l).show();
  7324. b(this).html("<a style='cursor:pointer;'><span class='ui-icon " + a.p.subGridOptions.minusicon + "'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
  7325. a.p.subGridOptions.selectOnExpand && b(a).jqGrid("setSelection", e)
  7326. } else if (b(this).hasClass("sgexpanded")) {
  7327. g = b(a).triggerHandler("jqGridSubGridRowColapsed", [m + "_" + e, e]);
  7328. g = !1 === g || "stop" === g ? !1 : !0;
  7329. e = c.id;
  7330. g && b.isFunction(a.p.subGridRowColapsed) && (g = a.p.subGridRowColapsed.call(a, m + "_" + e, e));
  7331. if (!1 === g) return !1; !0 === a.p.subGridOptions.reloadOnExpand ? b(l).remove(".ui-subgrid") : b(l).hasClass("ui-subgrid") && b(l).hide();
  7332. b(this).html("<a style='cursor:pointer;'><span class='ui-icon " + a.p.subGridOptions.plusicon + "'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
  7333. a.p.subGridOptions.selectOnCollapse && b(a).jqGrid("setSelection", e)
  7334. }
  7335. return !1
  7336. }),
  7337. q++; !0 === a.p.subGridOptions.expandOnLoad && b(a.rows).filter(".jqgrow").each(function (a, c) {
  7338. b(c.cells[0]).click()
  7339. });
  7340. a.subGridXml = function (a, b) {
  7341. n(a, b)
  7342. };
  7343. a.subGridJson = function (a, b) {
  7344. r(a, b)
  7345. }
  7346. }
  7347. })
  7348. },
  7349. expandSubGridRow: function (d) {
  7350. return this.each(function () {
  7351. if ((this.grid || d) && !0 === this.p.subGrid) {
  7352. var c = b(this).jqGrid("getInd", d, !0);
  7353. c && (c = b("td.sgcollapsed", c)[0]) && b(c).trigger("click")
  7354. }
  7355. })
  7356. },
  7357. collapseSubGridRow: function (d) {
  7358. return this.each(function () {
  7359. if ((this.grid || d) && !0 === this.p.subGrid) {
  7360. var c = b(this).jqGrid("getInd", d, !0);
  7361. c && (c = b("td.sgexpanded", c)[0]) && b(c).trigger("click")
  7362. }
  7363. })
  7364. },
  7365. toggleSubGridRow: function (d) {
  7366. return this.each(function () {
  7367. if ((this.grid || d) && !0 === this.p.subGrid) {
  7368. var c = b(this).jqGrid("getInd", d, !0);
  7369. if (c) {
  7370. var a = b("td.sgcollapsed", c)[0];
  7371. a ? b(a).trigger("click") : (a = b("td.sgexpanded", c)[0]) && b(a).trigger("click")
  7372. }
  7373. }
  7374. })
  7375. }
  7376. })
  7377. })(jQuery); (function (d) {
  7378. d.extend(d.jgrid, {
  7379. template: function (b) {
  7380. var k = d.makeArray(arguments).slice(1),
  7381. a,
  7382. c = k.length;
  7383. null == b && (b = "");
  7384. return b.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
  7385. function (b, m) {
  7386. if (!isNaN(parseInt(m, 10))) return k[parseInt(m, 10)];
  7387. 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
  7388. })
  7389. }
  7390. });
  7391. d.jgrid.extend({
  7392. groupingSetup: function () {
  7393. return this.each(function () {
  7394. var b, k, a = this.p.colModel,
  7395. c = this.p.groupingView;
  7396. if (null === c || "object" !== typeof c && !d.isFunction(c)) this.p.grouping = !1;
  7397. else if (c.groupField.length) {
  7398. void 0 === c.visibiltyOnNextGrouping && (c.visibiltyOnNextGrouping = []);
  7399. c.lastvalues = [];
  7400. c._locgr || (c.groups = []);
  7401. c.counters = [];
  7402. for (b = 0; b < c.groupField.length; b++) c.groupOrder[b] || (c.groupOrder[b] = "asc"),
  7403. c.groupText[b] || (c.groupText[b] = "{0}"),
  7404. "boolean" !== typeof c.groupColumnShow[b] && (c.groupColumnShow[b] = !0),
  7405. "boolean" !== typeof c.groupSummary[b] && (c.groupSummary[b] = !1),
  7406. c.groupSummaryPos[b] || (c.groupSummaryPos[b] = "footer"),
  7407. !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]));
  7408. c.summary = [];
  7409. c.hideFirstGroupCol && (c.formatDisplayField[0] = function (a) {
  7410. return a
  7411. });
  7412. b = 0;
  7413. for (k = a.length; b < k; b++) c.hideFirstGroupCol && !a[b].hidden && c.groupField[0] === a[b].name && (a[b].formatter = function () {
  7414. return ""
  7415. }),
  7416. a[b].summaryType && (a[b].summaryDivider ? c.summary.push({
  7417. nm: a[b].name,
  7418. st: a[b].summaryType,
  7419. v: "",
  7420. sd: a[b].summaryDivider,
  7421. vd: "",
  7422. sr: a[b].summaryRound,
  7423. srt: a[b].summaryRoundType || "round"
  7424. }) : c.summary.push({
  7425. nm: a[b].name,
  7426. st: a[b].summaryType,
  7427. v: "",
  7428. sr: a[b].summaryRound,
  7429. srt: a[b].summaryRoundType || "round"
  7430. }))
  7431. } else this.p.grouping = !1
  7432. })
  7433. },
  7434. groupingPrepare: function (b, k) {
  7435. this.each(function () {
  7436. var a = this.p.groupingView,
  7437. c = this,
  7438. g, m = a.groupField.length,
  7439. e, f, h, p = 0;
  7440. for (g = 0; g < m; g++) e = a.groupField[g],
  7441. h = a.displayField[g],
  7442. f = b[e],
  7443. h = null == h ? null : b[h],
  7444. null == h && (h = f),
  7445. void 0 !== f && (0 === k ? (a.groups.push({
  7446. idx: g,
  7447. dataIndex: e,
  7448. value: f,
  7449. displayValue: h,
  7450. startRow: k,
  7451. cnt: 1,
  7452. summary: []
  7453. }), a.lastvalues[g] = f, a.counters[g] = {
  7454. cnt: 1,
  7455. pos: a.groups.length - 1,
  7456. summary: d.extend(!0, [], a.summary)
  7457. }) : "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({
  7458. idx: g,
  7459. dataIndex: e,
  7460. value: f,
  7461. displayValue: h,
  7462. startRow: k,
  7463. cnt: 1,
  7464. summary: []
  7465. }), a.lastvalues[g] = f, a.counters[g] = {
  7466. cnt: 1,
  7467. pos: a.groups.length - 1,
  7468. summary: d.extend(!0, [], a.summary)
  7469. }) : (a.counters[g].cnt += 1, a.groups[a.counters[g].pos].cnt = a.counters[g].cnt) : (a.groups.push({
  7470. idx: g,
  7471. dataIndex: e,
  7472. value: f,
  7473. displayValue: h,
  7474. startRow: k,
  7475. cnt: 1,
  7476. summary: []
  7477. }), a.lastvalues[g] = f, p = 1, a.counters[g] = {
  7478. cnt: 1,
  7479. pos: a.groups.length - 1,
  7480. summary: d.extend(!0, [], a.summary)
  7481. }), d.each(a.counters[g].summary,
  7482. function () {
  7483. 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)))
  7484. }), a.groups[a.counters[g].pos].summary = a.counters[g].summary)
  7485. });
  7486. return this
  7487. },
  7488. groupingToggle: function (b) {
  7489. this.each(function () {
  7490. var k = this.p.groupingView,
  7491. a = b.split("_"),
  7492. c = parseInt(a[a.length - 2], 10);
  7493. a.splice(a.length - 2, 2);
  7494. var g = a.join("_"),
  7495. a = k.minusicon,
  7496. m = k.plusicon,
  7497. e = d("#" + d.jgrid.jqID(b)),
  7498. e = e.length ? e[0].nextSibling : null,
  7499. f = d("#" + d.jgrid.jqID(b) + " span.tree-wrap-" + this.p.direction),
  7500. h = function (a) {
  7501. a = d.map(a.split(" "),
  7502. function (a) {
  7503. if (a.substring(0, g.length + 1) === g + "_") return parseInt(a.substring(g.length + 1), 10)
  7504. });
  7505. return 0 < a.length ? a[0] : void 0
  7506. },
  7507. p,
  7508. r = !1,
  7509. q = this.p.frozenColumns ? this.p.id + "_frozen" : !1,
  7510. n = q ? d("#" + d.jgrid.jqID(b), "#" + d.jgrid.jqID(q)) : !1,
  7511. n = n && n.length ? n[0].nextSibling : null;
  7512. if (f.hasClass(a)) {
  7513. if (k.showSummaryOnHide) {
  7514. if (e) for (; e && !(d(e).hasClass("jqfoot") && parseInt(d(e).attr("jqfootlevel"), 10) <= c) ;) d(e).hide(),
  7515. e = e.nextSibling,
  7516. q && (d(n).hide(), n = n.nextSibling)
  7517. } else if (e) for (; e;) {
  7518. k = h(e.className);
  7519. if (void 0 !== k && k <= c) break;
  7520. d(e).hide();
  7521. e = e.nextSibling;
  7522. q && (d(n).hide(), n = n.nextSibling)
  7523. }
  7524. f.removeClass(a).addClass(m);
  7525. r = !0
  7526. } else {
  7527. if (e) for (p = void 0; e;) {
  7528. k = h(e.className);
  7529. void 0 === p && (p = void 0 === k);
  7530. if (void 0 !== k) {
  7531. if (k <= c) break;
  7532. 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))
  7533. } else p && (d(e).show(), q && d(n).show());
  7534. e = e.nextSibling;
  7535. q && (n = n.nextSibling)
  7536. }
  7537. f.removeClass(m).addClass(a)
  7538. }
  7539. d(this).triggerHandler("jqGridGroupingClickGroup", [b, r]);
  7540. d.isFunction(this.p.onClickGroup) && this.p.onClickGroup.call(this, b, r)
  7541. });
  7542. return !1
  7543. },
  7544. groupingRender: function (b, k, a, c) {
  7545. return this.each(function () {
  7546. function g(a, b, c) {
  7547. var d = !1;
  7548. if (0 === b) d = c[a];
  7549. else {
  7550. var e = c[a].idx;
  7551. if (0 === e) d = c[a];
  7552. else for (; 0 <= a; a--) if (c[a].idx === e - b) {
  7553. d = c[a];
  7554. break
  7555. }
  7556. }
  7557. return d
  7558. }
  7559. function m(a, b, c, f) {
  7560. var h = g(a, b, c),
  7561. m = e.p.colModel,
  7562. n,
  7563. q = h.cnt;
  7564. a = "";
  7565. var p;
  7566. for (p = f; p < k; p++) {
  7567. var r = "<td " + e.formatCol(p, 1, "") + ">&#160;</td>",
  7568. t = "{0}";
  7569. d.each(h.summary,
  7570. function () {
  7571. if (this.nm === m[p].name) {
  7572. m[p].summaryTpl && (t = m[p].summaryTpl);
  7573. "string" === typeof this.st && "avg" === this.st.toLowerCase() && (this.sd && this.vd ? this.v /= this.vd : this.v && 0 < q && (this.v /= q));
  7574. try {
  7575. this.groupCount = h.cnt,
  7576. this.groupIndex = h.dataIndex,
  7577. this.groupValue = h.value,
  7578. n = e.formatter("", this.v, p, this)
  7579. } catch (a) {
  7580. n = this.v
  7581. }
  7582. r = "<td " + e.formatCol(p, 1, "") + ">" + d.jgrid.format(t, n) + "</td>";
  7583. return !1
  7584. }
  7585. });
  7586. a += r
  7587. }
  7588. return a
  7589. }
  7590. var e = this,
  7591. f = e.p.groupingView,
  7592. h = "",
  7593. p = "",
  7594. r, q, n = f.groupCollapse ? f.plusicon : f.minusicon,
  7595. t,
  7596. y = [],
  7597. z = f.groupField.length,
  7598. n = n + (" tree-wrap-" + e.p.direction);
  7599. d.each(e.p.colModel,
  7600. function (a, b) {
  7601. var c;
  7602. for (c = 0; c < z; c++) if (f.groupField[c] === b.name) {
  7603. y[c] = a;
  7604. break
  7605. }
  7606. });
  7607. var x = 0,
  7608. A = d.makeArray(f.groupSummary);
  7609. A.reverse();
  7610. d.each(f.groups,
  7611. function (g, l) {
  7612. if (f._locgr && !(l.startRow + l.cnt > (a - 1) * c && l.startRow < a * c)) return !0;
  7613. x++;
  7614. q = e.p.id + "ghead_" + l.idx;
  7615. r = q + "_" + g;
  7616. p = "<span style='cursor:pointer;' class='ui-icon " + n + "' onclick=\"jQuery('#" + d.jgrid.jqID(e.p.id) + "').jqGrid('groupingToggle','" + r + "');return false;\"></span>";
  7617. try {
  7618. 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)
  7619. } catch (C) {
  7620. t = l.displayValue
  7621. }
  7622. "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>";
  7623. if (z - 1 === l.idx) {
  7624. var s = f.groups[g + 1],
  7625. v,
  7626. u = 0;
  7627. v = l.startRow;
  7628. var B = void 0 !== s ? f.groups[g + 1].startRow : b.length;
  7629. f._locgr && (u = (a - 1) * c, u > l.startRow && (v = u));
  7630. for (; v < B && b[v - u]; v++) h += b[v - u].join("");
  7631. if ("header" !== f.groupSummaryPos[l.idx]) {
  7632. var w;
  7633. if (void 0 !== s) {
  7634. for (w = 0; w < f.groupField.length && s.dataIndex !== f.groupField[w]; w++);
  7635. x = f.groupField.length - w
  7636. }
  7637. 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>");
  7638. x = w
  7639. }
  7640. }
  7641. });
  7642. d("#" + d.jgrid.jqID(e.p.id) + " tbody:first").append(h);
  7643. h = null
  7644. })
  7645. },
  7646. groupingGroupBy: function (b, k) {
  7647. return this.each(function () {
  7648. "string" === typeof b && (b = [b]);
  7649. var a = this.p.groupingView;
  7650. this.p.grouping = !0;
  7651. void 0 === a.visibiltyOnNextGrouping && (a.visibiltyOnNextGrouping = []);
  7652. var c;
  7653. for (c = 0; c < a.groupField.length; c++) !a.groupColumnShow[c] && a.visibiltyOnNextGrouping[c] && d(this).jqGrid("showCol", a.groupField[c]);
  7654. for (c = 0; c < b.length; c++) a.visibiltyOnNextGrouping[c] = d("#" + d.jgrid.jqID(this.p.id) + "_" + d.jgrid.jqID(b[c])).is(":visible");
  7655. this.p.groupingView = d.extend(this.p.groupingView, k || {});
  7656. a.groupField = b;
  7657. d(this).trigger("reloadGrid")
  7658. })
  7659. },
  7660. groupingRemove: function (b) {
  7661. return this.each(function () {
  7662. void 0 === b && (b = !0);
  7663. this.p.grouping = !1;
  7664. if (!0 === b) {
  7665. var k = this.p.groupingView,
  7666. a;
  7667. for (a = 0; a < k.groupField.length; a++) !k.groupColumnShow[a] && k.visibiltyOnNextGrouping[a] && d(this).jqGrid("showCol", k.groupField);
  7668. d("tr.jqgroup, tr.jqfoot", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").remove();
  7669. d("tr.jqgrow:hidden", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").show()
  7670. } else d(this).trigger("reloadGrid")
  7671. })
  7672. },
  7673. groupingCalculations: {
  7674. handler: function (b, d, a, c, g, m) {
  7675. var e = {
  7676. sum: function () {
  7677. return parseFloat(d || 0) + parseFloat(m[a] || 0)
  7678. },
  7679. min: function () {
  7680. return "" === d ? parseFloat(m[a] || 0) : Math.min(parseFloat(d), parseFloat(m[a] || 0))
  7681. },
  7682. max: function () {
  7683. return "" === d ? parseFloat(m[a] || 0) : Math.max(parseFloat(d), parseFloat(m[a] || 0))
  7684. },
  7685. count: function () {
  7686. "" === d && (d = 0);
  7687. return m.hasOwnProperty(a) ? d + 1 : 0
  7688. },
  7689. avg: function () {
  7690. return e.sum()
  7691. }
  7692. };
  7693. if (!e[b]) throw "jqGrid Grouping No such method: " + b;
  7694. b = e[b]();
  7695. null != c && ("fixed" === g ? b = b.toFixed(c) : (c = Math.pow(10, c), b = Math.round(b * c) / c));
  7696. return b
  7697. }
  7698. }
  7699. })
  7700. })(jQuery); (function (d) {
  7701. d.jgrid.extend({
  7702. setTreeNode: function (b, c) {
  7703. return this.each(function () {
  7704. var a = this;
  7705. if (a.grid && a.p.treeGrid) for (var h = a.p.expColInd,
  7706. e = a.p.treeReader.expanded_field,
  7707. k = a.p.treeReader.leaf_field,
  7708. g = a.p.treeReader.level_field,
  7709. f = a.p.treeReader.icon_field,
  7710. n = a.p.treeReader.loaded,
  7711. m, p, q, l; b < c;) l = d.jgrid.stripPref(a.p.idPrefix, a.rows[b].id),
  7712. l = a.p.data[a.p._index[l]],
  7713. "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]),
  7714. m = parseInt(l[g], 10),
  7715. 0 === a.p.tree_root_level ? (q = m + 1, p = m) : (q = m, p = m - 1),
  7716. q = "<div class='tree-wrap tree-wrap-" + a.p.direction + "' style='width:" + 18 * q + "px;'>",
  7717. q += "<div style='" + ("rtl" === a.p.direction ? "right:" : "left:") + 18 * p + "px;' class='ui-icon ",
  7718. void 0 !== l[n] && (l[n] = "true" === l[n] || !0 === l[n] ? !0 : !1),
  7719. "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 = ""),
  7720. l[e] = ("true" === l[e] || !0 === l[e] ? !0 : !1) && (l[n] || void 0 === l[n]),
  7721. 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'"),
  7722. q += "></div></div>",
  7723. d(a.rows[b].cells[h]).wrapInner("<span class='cell-wrapper" + p + "'></span>").prepend(q),
  7724. 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")),
  7725. d(a.rows[b].cells[h]).find("div.treeclick").bind("click",
  7726. function (b) {
  7727. b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
  7728. b = a.p._index[b];
  7729. 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])));
  7730. return !1
  7731. }),
  7732. !0 === a.p.ExpandColClick && d(a.rows[b].cells[h]).find("span.cell-wrapper").css("cursor", "pointer").bind("click",
  7733. function (b) {
  7734. b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
  7735. var c = a.p._index[b];
  7736. 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])));
  7737. d(a).jqGrid("setSelection", b);
  7738. return !1
  7739. }),
  7740. b++
  7741. })
  7742. },
  7743. setTreeGrid: function () {
  7744. return this.each(function () {
  7745. var b = this,
  7746. c = 0,
  7747. a, h = !1,
  7748. e, k, g = [];
  7749. if (b.p.treeGrid) {
  7750. b.p.treedatatype || d.extend(b.p, {
  7751. treedatatype: b.p.datatype
  7752. });
  7753. b.p.subGrid = !1;
  7754. b.p.altRows = !1;
  7755. b.p.pgbuttons = !1;
  7756. b.p.pginput = !1;
  7757. b.p.gridview = !0;
  7758. null === b.p.rowTotal && (b.p.rowNum = 1E4);
  7759. b.p.multiselect = !1;
  7760. b.p.rowList = [];
  7761. b.p.expColInd = 0;
  7762. a = "ui-icon-triangle-1-" + ("rtl" === b.p.direction ? "w" : "e");
  7763. b.p.treeIcons = d.extend({
  7764. plus: a,
  7765. minus: "ui-icon-triangle-1-s",
  7766. leaf: "ui-icon-radio-off"
  7767. },
  7768. b.p.treeIcons || {});
  7769. "nested" === b.p.treeGridModel ? b.p.treeReader = d.extend({
  7770. level_field: "level",
  7771. left_field: "lft",
  7772. right_field: "rgt",
  7773. leaf_field: "isLeaf",
  7774. expanded_field: "expanded",
  7775. loaded: "loaded",
  7776. icon_field: "icon"
  7777. },
  7778. b.p.treeReader) : "adjacency" === b.p.treeGridModel && (b.p.treeReader = d.extend({
  7779. level_field: "level",
  7780. parent_id_field: "parent",
  7781. leaf_field: "isLeaf",
  7782. expanded_field: "expanded",
  7783. loaded: "loaded",
  7784. icon_field: "icon"
  7785. },
  7786. b.p.treeReader));
  7787. 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);
  7788. d.each(b.p.treeReader,
  7789. function (a, e) {
  7790. e && -1 === d.inArray(e, g) && ("leaf_field" === a && (b.p._treeleafpos = c), c++, b.p.colNames.push(e), b.p.colModel.push({
  7791. name: e,
  7792. width: 1,
  7793. hidden: !0,
  7794. sortable: !1,
  7795. resizable: !1,
  7796. hidedlg: !0,
  7797. editable: !0,
  7798. search: !1
  7799. }))
  7800. })
  7801. }
  7802. })
  7803. },
  7804. expandRow: function (b) {
  7805. this.each(function () {
  7806. var c = this;
  7807. if (c.grid && c.p.treeGrid) {
  7808. var a = d(c).jqGrid("getNodeChildren", b),
  7809. h = c.p.treeReader.expanded_field;
  7810. d(a).each(function () {
  7811. var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
  7812. d(d(c).jqGrid("getGridRowById", a)).css("display", "");
  7813. this[h] && d(c).jqGrid("expandRow", this)
  7814. })
  7815. }
  7816. })
  7817. },
  7818. collapseRow: function (b) {
  7819. this.each(function () {
  7820. var c = this;
  7821. if (c.grid && c.p.treeGrid) {
  7822. var a = d(c).jqGrid("getNodeChildren", b),
  7823. h = c.p.treeReader.expanded_field;
  7824. d(a).each(function () {
  7825. var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
  7826. d(d(c).jqGrid("getGridRowById", a)).css("display", "none");
  7827. this[h] && d(c).jqGrid("collapseRow", this)
  7828. })
  7829. }
  7830. })
  7831. },
  7832. getRootNodes: function () {
  7833. var b = [];
  7834. this.each(function () {
  7835. var c = this;
  7836. if (c.grid && c.p.treeGrid) switch (c.p.treeGridModel) {
  7837. case "nested":
  7838. var a = c.p.treeReader.level_field;
  7839. d(c.p.data).each(function () {
  7840. parseInt(this[a], 10) === parseInt(c.p.tree_root_level, 10) && b.push(this)
  7841. });
  7842. break;
  7843. case "adjacency":
  7844. var h = c.p.treeReader.parent_id_field;
  7845. d(c.p.data).each(function () {
  7846. null !== this[h] && "null" !== String(this[h]).toLowerCase() || b.push(this)
  7847. })
  7848. }
  7849. });
  7850. return b
  7851. },
  7852. getNodeDepth: function (b) {
  7853. var c = null;
  7854. this.each(function () {
  7855. if (this.grid && this.p.treeGrid) switch (this.p.treeGridModel) {
  7856. case "nested":
  7857. c = parseInt(b[this.p.treeReader.level_field], 10) - parseInt(this.p.tree_root_level, 10);
  7858. break;
  7859. case "adjacency":
  7860. c = d(this).jqGrid("getNodeAncestors", b).length
  7861. }
  7862. });
  7863. return c
  7864. },
  7865. getNodeParent: function (b) {
  7866. var c = null;
  7867. this.each(function () {
  7868. var a = this;
  7869. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7870. case "nested":
  7871. var h = a.p.treeReader.left_field,
  7872. e = a.p.treeReader.right_field,
  7873. k = a.p.treeReader.level_field,
  7874. g = parseInt(b[h], 10),
  7875. f = parseInt(b[e], 10),
  7876. n = parseInt(b[k], 10);
  7877. d(this.p.data).each(function () {
  7878. if (parseInt(this[k], 10) === n - 1 && parseInt(this[h], 10) < g && parseInt(this[e], 10) > f) return c = this,
  7879. !1
  7880. });
  7881. break;
  7882. case "adjacency":
  7883. var m = a.p.treeReader.parent_id_field,
  7884. p = a.p.localReader.id;
  7885. d(this.p.data).each(function () {
  7886. if (this[p] === d.jgrid.stripPref(a.p.idPrefix, b[m])) return c = this,
  7887. !1
  7888. })
  7889. }
  7890. });
  7891. return c
  7892. },
  7893. getNodeChildren: function (b) {
  7894. var c = [];
  7895. this.each(function () {
  7896. var a = this;
  7897. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7898. case "nested":
  7899. var h = a.p.treeReader.left_field,
  7900. e = a.p.treeReader.right_field,
  7901. k = a.p.treeReader.level_field,
  7902. g = parseInt(b[h], 10),
  7903. f = parseInt(b[e], 10),
  7904. n = parseInt(b[k], 10);
  7905. d(this.p.data).each(function () {
  7906. parseInt(this[k], 10) === n + 1 && parseInt(this[h], 10) > g && parseInt(this[e], 10) < f && c.push(this)
  7907. });
  7908. break;
  7909. case "adjacency":
  7910. var m = a.p.treeReader.parent_id_field,
  7911. p = a.p.localReader.id;
  7912. d(this.p.data).each(function () {
  7913. this[m] == d.jgrid.stripPref(a.p.idPrefix, b[p]) && c.push(this)
  7914. })
  7915. }
  7916. });
  7917. return c
  7918. },
  7919. getFullTreeNode: function (b) {
  7920. var c = [];
  7921. this.each(function () {
  7922. var a = this,
  7923. h;
  7924. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7925. case "nested":
  7926. var e = a.p.treeReader.left_field,
  7927. k = a.p.treeReader.right_field,
  7928. g = a.p.treeReader.level_field,
  7929. f = parseInt(b[e], 10),
  7930. n = parseInt(b[k], 10),
  7931. m = parseInt(b[g], 10);
  7932. d(this.p.data).each(function () {
  7933. parseInt(this[g], 10) >= m && parseInt(this[e], 10) >= f && parseInt(this[e], 10) <= n && c.push(this)
  7934. });
  7935. break;
  7936. case "adjacency":
  7937. if (b) {
  7938. c.push(b);
  7939. var p = a.p.treeReader.parent_id_field,
  7940. q = a.p.localReader.id;
  7941. d(this.p.data).each(function (b) {
  7942. h = c.length;
  7943. for (b = 0; b < h; b++) if (d.jgrid.stripPref(a.p.idPrefix, c[b][q]) === this[p]) {
  7944. c.push(this);
  7945. break
  7946. }
  7947. })
  7948. }
  7949. }
  7950. });
  7951. return c
  7952. },
  7953. getNodeAncestors: function (b) {
  7954. var c = [];
  7955. this.each(function () {
  7956. if (this.grid && this.p.treeGrid) for (var a = d(this).jqGrid("getNodeParent", b) ; a;) c.push(a),
  7957. a = d(this).jqGrid("getNodeParent", a)
  7958. });
  7959. return c
  7960. },
  7961. isVisibleNode: function (b) {
  7962. var c = !0;
  7963. this.each(function () {
  7964. if (this.grid && this.p.treeGrid) {
  7965. var a = d(this).jqGrid("getNodeAncestors", b),
  7966. h = this.p.treeReader.expanded_field;
  7967. d(a).each(function () {
  7968. c = c && this[h];
  7969. if (!c) return !1
  7970. })
  7971. }
  7972. });
  7973. return c
  7974. },
  7975. isNodeLoaded: function (b) {
  7976. var c;
  7977. this.each(function () {
  7978. if (this.grid && this.p.treeGrid) {
  7979. var a = this.p.treeReader.leaf_field,
  7980. h = this.p.treeReader.loaded;
  7981. c = void 0 !== b ? void 0 !== b[h] ? b[h] : b[a] || 0 < d(this).jqGrid("getNodeChildren", b).length ? !0 : !1 : !1
  7982. }
  7983. });
  7984. return c
  7985. },
  7986. expandNode: function (b) {
  7987. return this.each(function () {
  7988. if (this.grid && this.p.treeGrid) {
  7989. var c = this.p.treeReader.expanded_field,
  7990. a = this.p.treeReader.parent_id_field,
  7991. h = this.p.treeReader.loaded,
  7992. e = this.p.treeReader.level_field,
  7993. k = this.p.treeReader.left_field,
  7994. g = this.p.treeReader.right_field;
  7995. if (!b[c]) {
  7996. var f = d.jgrid.getAccessor(b, this.p.localReader.id),
  7997. n = d("#" + this.p.idPrefix + d.jgrid.jqID(f), this.grid.bDiv)[0],
  7998. m = this.p._index[f];
  7999. 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", {
  8000. postData: {
  8001. nodeid: f,
  8002. n_left: b[k],
  8003. n_right: b[g],
  8004. n_level: b[e]
  8005. }
  8006. }) : d(this).jqGrid("setGridParam", {
  8007. postData: {
  8008. nodeid: f,
  8009. parentid: b[a],
  8010. n_level: b[e]
  8011. }
  8012. }), d(this).trigger("reloadGrid"), b[h] = !0, "nested" === this.p.treeGridModel ? d(this).jqGrid("setGridParam", {
  8013. postData: {
  8014. nodeid: "",
  8015. n_left: "",
  8016. n_right: "",
  8017. n_level: ""
  8018. }
  8019. }) : d(this).jqGrid("setGridParam", {
  8020. postData: {
  8021. nodeid: "",
  8022. parentid: "",
  8023. n_level: ""
  8024. }
  8025. }))
  8026. }
  8027. }
  8028. })
  8029. },
  8030. collapseNode: function (b) {
  8031. return this.each(function () {
  8032. if (this.grid && this.p.treeGrid) {
  8033. var c = this.p.treeReader.expanded_field;
  8034. 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"))
  8035. }
  8036. })
  8037. },
  8038. SortTree: function (b, c, a, h) {
  8039. return this.each(function () {
  8040. if (this.grid && this.p.treeGrid) {
  8041. var e, k, g, f = [],
  8042. n = this,
  8043. m;
  8044. e = d(this).jqGrid("getRootNodes");
  8045. e = d.jgrid.from(e);
  8046. e.orderBy(b, c, a, h);
  8047. m = e.select();
  8048. e = 0;
  8049. for (k = m.length; e < k; e++) g = m[e],
  8050. f.push(g),
  8051. d(this).jqGrid("collectChildrenSortTree", f, g, b, c, a, h);
  8052. d.each(f,
  8053. function (a) {
  8054. var b = d.jgrid.getAccessor(this, n.p.localReader.id);
  8055. d("#" + d.jgrid.jqID(n.p.id) + " tbody tr:eq(" + a + ")").after(d("tr#" + d.jgrid.jqID(b), n.grid.bDiv))
  8056. });
  8057. f = m = e = null
  8058. }
  8059. })
  8060. },
  8061. collectChildrenSortTree: function (b, c, a, h, e, k) {
  8062. return this.each(function () {
  8063. if (this.grid && this.p.treeGrid) {
  8064. var g, f, n, m;
  8065. g = d(this).jqGrid("getNodeChildren", c);
  8066. g = d.jgrid.from(g);
  8067. g.orderBy(a, h, e, k);
  8068. m = g.select();
  8069. g = 0;
  8070. for (f = m.length; g < f; g++) n = m[g],
  8071. b.push(n),
  8072. d(this).jqGrid("collectChildrenSortTree", b, n, a, h, e, k)
  8073. }
  8074. })
  8075. },
  8076. setTreeRow: function (b, c) {
  8077. var a = !1;
  8078. this.each(function () {
  8079. this.grid && this.p.treeGrid && (a = d(this).jqGrid("setRowData", b, c))
  8080. });
  8081. return a
  8082. },
  8083. delTreeNode: function (b) {
  8084. return this.each(function () {
  8085. var c = this.p.localReader.id,
  8086. a, h = this.p.treeReader.left_field,
  8087. e = this.p.treeReader.right_field,
  8088. k, g, f;
  8089. if (this.grid && this.p.treeGrid && (a = this.p._index[b], void 0 !== a)) {
  8090. k = parseInt(this.p.data[a][e], 10);
  8091. g = k - parseInt(this.p.data[a][h], 10) + 1;
  8092. var n = d(this).jqGrid("getFullTreeNode", this.p.data[a]);
  8093. if (0 < n.length) for (a = 0; a < n.length; a++) d(this).jqGrid("delRowData", n[a][c]);
  8094. if ("nested" === this.p.treeGridModel) {
  8095. c = d.jgrid.from(this.p.data).greater(h, k, {
  8096. stype: "integer"
  8097. }).select();
  8098. if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][h] = parseInt(c[f][h], 10) - g);
  8099. c = d.jgrid.from(this.p.data).greater(e, k, {
  8100. stype: "integer"
  8101. }).select();
  8102. if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][e] = parseInt(c[f][e], 10) - g)
  8103. }
  8104. }
  8105. })
  8106. },
  8107. addChildNode: function (b, c, a, h) {
  8108. var e = this[0];
  8109. if (a) {
  8110. var k = e.p.treeReader.expanded_field,
  8111. g = e.p.treeReader.leaf_field,
  8112. f = e.p.treeReader.level_field,
  8113. n = e.p.treeReader.parent_id_field,
  8114. m = e.p.treeReader.left_field,
  8115. p = e.p.treeReader.right_field,
  8116. q = e.p.treeReader.loaded,
  8117. l, u, t, w, s;
  8118. l = 0;
  8119. var v = c,
  8120. x;
  8121. void 0 === h && (h = !1);
  8122. if (void 0 === b || null === b) {
  8123. s = e.p.data.length - 1;
  8124. if (0 <= s) for (; 0 <= s;) l = Math.max(l, parseInt(e.p.data[s][e.p.localReader.id], 10)),
  8125. s--;
  8126. b = l + 1
  8127. }
  8128. var y = d(e).jqGrid("getInd", c);
  8129. x = !1;
  8130. 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));
  8131. u = s + 1;
  8132. void 0 === a[k] && (a[k] = !1);
  8133. void 0 === a[q] && (a[q] = !1);
  8134. a[f] = w;
  8135. void 0 === a[g] && (a[g] = !0);
  8136. "adjacency" === e.p.treeGridModel && (a[n] = c);
  8137. if ("nested" === e.p.treeGridModel) {
  8138. var r;
  8139. if (null !== c) {
  8140. g = parseInt(t[p], 10);
  8141. f = d.jgrid.from(e.p.data);
  8142. f = f.greaterOrEquals(p, g, {
  8143. stype: "integer"
  8144. });
  8145. f = f.select();
  8146. 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]);
  8147. a[m] = g;
  8148. a[p] = g + 1
  8149. } else {
  8150. g = parseInt(d(e).jqGrid("getCol", p, !1, "max"), 10);
  8151. f = d.jgrid.from(e.p.data).greater(m, g, {
  8152. stype: "integer"
  8153. }).select();
  8154. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][m] = parseInt(f[r][m], 10) + 2);
  8155. f = d.jgrid.from(e.p.data).greater(p, g, {
  8156. stype: "integer"
  8157. }).select();
  8158. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][p] = parseInt(f[r][p], 10) + 2);
  8159. a[m] = g + 1;
  8160. a[p] = g + 2
  8161. }
  8162. }
  8163. if (null === c || d(e).jqGrid("isNodeLoaded", t) || x) d(e).jqGrid("addRowData", b, a, l, v),
  8164. d(e).jqGrid("setTreeNode", s, u);
  8165. t && !t[k] && h && d(e.rows[y]).find("div.treeclick").click()
  8166. }
  8167. }
  8168. })
  8169. })(jQuery); (function (d) {
  8170. function I(d, n) {
  8171. var h, e, v = [],
  8172. r;
  8173. if (!this || "function" !== typeof d || d instanceof RegExp) throw new TypeError;
  8174. r = this.length;
  8175. for (h = 0; h < r; h++) if (this.hasOwnProperty(h) && (e = this[h], d.call(n, e, h, this))) {
  8176. v.push(e);
  8177. break
  8178. }
  8179. return v
  8180. }
  8181. d.assocArraySize = function (d) {
  8182. var n = 0,
  8183. h;
  8184. for (h in d) d.hasOwnProperty(h) && n++;
  8185. return n
  8186. };
  8187. d.jgrid.extend({
  8188. pivotSetup: function (q, n) {
  8189. var h = [],
  8190. e = [],
  8191. v = [],
  8192. r = [],
  8193. b = {
  8194. grouping: !0,
  8195. groupingView: {
  8196. groupField: [],
  8197. groupSummary: [],
  8198. groupSummaryPos: []
  8199. }
  8200. },
  8201. f = [],
  8202. c = d.extend({
  8203. rowTotals: !1,
  8204. rowTotalsText: "Total",
  8205. colTotals: !1,
  8206. groupSummary: !0,
  8207. groupSummaryPos: "header",
  8208. frozenStaticCols: !1
  8209. },
  8210. n || {});
  8211. this.each(function () {
  8212. function n(C, c, a) {
  8213. C = I.call(C, c, a);
  8214. return 0 < C.length ? C[0] : null
  8215. }
  8216. function J(c, a) {
  8217. var d = 0,
  8218. f = !0,
  8219. h;
  8220. for (h in c) {
  8221. if (c[h] != this[d]) {
  8222. f = !1;
  8223. break
  8224. }
  8225. d++;
  8226. if (d >= this.length) break
  8227. }
  8228. f && (D = a);
  8229. return f
  8230. }
  8231. function E(c, a, f, h) {
  8232. var g = a.length,
  8233. b, k, e, l;
  8234. l = d.isArray(f) ? f.length : 1;
  8235. r = [];
  8236. for (e = r.root = 0; e < l; e++) {
  8237. var n = [],
  8238. m;
  8239. for (b = 0; b < g; b++) {
  8240. if (null == f) m = k = d.trim(a[b].member) + "_" + a[b].aggregator;
  8241. else {
  8242. m = f[e].replace(/\s+/g, "");
  8243. try {
  8244. k = 1 === g ? m : m + "_" + a[b].aggregator + "_" + b
  8245. } catch (v) { }
  8246. }
  8247. var t = h,
  8248. u = k,
  8249. x = n,
  8250. y = k,
  8251. w = h[k],
  8252. p = a[b].member,
  8253. q = c,
  8254. s = void 0;
  8255. switch (a[b].aggregator) {
  8256. case "sum":
  8257. s = parseFloat(w || 0) + parseFloat(q[p] || 0);
  8258. break;
  8259. case "count":
  8260. if ("" === w || null == w) w = 0;
  8261. s = q.hasOwnProperty(p) ? w + 1 : 0;
  8262. break;
  8263. case "min":
  8264. s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.min(parseFloat(w), parseFloat(q[p] || 0));
  8265. break;
  8266. case "max":
  8267. s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.max(parseFloat(w), parseFloat(q[p] || 0))
  8268. }
  8269. t[u] = x[y] = s
  8270. }
  8271. r[m] = n
  8272. }
  8273. return h
  8274. }
  8275. function H(a) {
  8276. var d, b, g, k, e;
  8277. for (g in a) if (a.hasOwnProperty(g)) {
  8278. 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] = {
  8279. useColSpanStyle: !1,
  8280. groupHeaders: []
  8281. })), F[a.level] !== a.text && a.children.length && "_r_Totals" !== a.text && 0 < a.level && (f[a.level - 1].groupHeaders.push({
  8282. titleText: a.text
  8283. }), 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) {
  8284. b = 1;
  8285. for (d in a.fields) 1 === b && f[l - 1].groupHeaders.push({
  8286. startColumnName: d,
  8287. numberOfColumns: 1,
  8288. titleText: a.text
  8289. }),
  8290. b++;
  8291. f[l - 1].groupHeaders[f[l - 1].groupHeaders.length - 1].numberOfColumns = b - 1
  8292. } else f.splice(l - 1, 1);
  8293. null != a[g] && "object" === typeof a[g] && H(a[g]);
  8294. if ("level" === g && 0 < a.level) for (d in b = 0, a.fields) {
  8295. e = {};
  8296. for (k in c.aggregates[b]) if (c.aggregates[b].hasOwnProperty(k)) switch (k) {
  8297. case "member":
  8298. case "label":
  8299. case "aggregator":
  8300. break;
  8301. default:
  8302. e[k] = c.aggregates[b][k]
  8303. }
  8304. 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);
  8305. h.push(e);
  8306. b++
  8307. }
  8308. }
  8309. }
  8310. var m, D, a, y = q.length,
  8311. s, l, z, k, p = 0;
  8312. c.rowTotals && 0 < c.yDimension.length && (c.yDimension.splice(0, 0, {
  8313. dataName: c.yDimension[0].dataName
  8314. }), c.yDimension[0].converter = function () {
  8315. return "_r_Totals"
  8316. });
  8317. s = d.isArray(c.xDimension) ? c.xDimension.length : 0;
  8318. l = c.yDimension.length;
  8319. z = d.isArray(c.aggregates) ? c.aggregates.length : 0;
  8320. if (0 === s || 0 === z) throw "xDimension or aggregates optiona are not set!";
  8321. var x;
  8322. for (a = 0; a < s; a++) x = {
  8323. name: c.xDimension[a].dataName,
  8324. frozen: c.frozenStaticCols
  8325. },
  8326. x = d.extend(!0, x, c.xDimension[a]),
  8327. h.push(x);
  8328. x = s - 1;
  8329. for (var A = {}; p < y;) {
  8330. m = q[p];
  8331. var t = [],
  8332. u = [];
  8333. k = {};
  8334. a = 0;
  8335. do t[a] = d.trim(m[c.xDimension[a].dataName]),
  8336. k[c.xDimension[a].dataName] = t[a],
  8337. a++;
  8338. while (a < s);
  8339. var g = 0;
  8340. D = -1;
  8341. a = n(e, J, t);
  8342. if (!a) {
  8343. g = 0;
  8344. if (1 <= l) {
  8345. for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
  8346. c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
  8347. k = E(m, c.aggregates, u, k)
  8348. } else 0 === l && (k = E(m, c.aggregates, null, k));
  8349. e.push(k)
  8350. } else if (0 <= D) {
  8351. g = 0;
  8352. if (1 <= l) {
  8353. for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
  8354. c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
  8355. a = E(m, c.aggregates, u, a)
  8356. } else 0 === l && (a = E(m, c.aggregates, null, a));
  8357. e[D] = a
  8358. }
  8359. m = 0;
  8360. var t = k = null,
  8361. B;
  8362. for (B in r) {
  8363. if (0 === m) A.children && void 0 !== A.children || (A = {
  8364. text: B,
  8365. level: 0,
  8366. children: []
  8367. }),
  8368. k = A.children;
  8369. else {
  8370. t = null;
  8371. for (a = 0; a < k.length; a++) if (k[a].text === B) {
  8372. t = k[a];
  8373. break
  8374. }
  8375. t ? k = t.children : (k.push({
  8376. children: [],
  8377. text: B,
  8378. level: m,
  8379. fields: r[B]
  8380. }), k = k[k.length - 1].children)
  8381. }
  8382. m++
  8383. }
  8384. p++
  8385. }
  8386. var F = [],
  8387. G = h.length,
  8388. K = G;
  8389. 0 < l && (f[l - 1] = {
  8390. useColSpanStyle: !1,
  8391. groupHeaders: []
  8392. });
  8393. H(A, 0);
  8394. if (c.colTotals) for (p = e.length; p--;) for (a = s; a < h.length; a++) y = h[a].name,
  8395. v[y] = v[y] ? v[y] + parseFloat(e[p][y] || 0) : parseFloat(e[p][y] || 0);
  8396. if (0 < x) for (a = 0; a < x; a++) b.groupingView.groupField[a] = h[a].name,
  8397. b.groupingView.groupSummary[a] = c.groupSummary,
  8398. b.groupingView.groupSummaryPos[a] = c.groupSummaryPos;
  8399. else b.grouping = !1;
  8400. b.sortname = h[x].name;
  8401. b.groupingView.hideFirstGroupCol = !0
  8402. });
  8403. return {
  8404. colModel: h,
  8405. rows: e,
  8406. groupOptions: b,
  8407. groupHeaders: f,
  8408. summary: v
  8409. }
  8410. },
  8411. jqPivot: function (q, n, h, e) {
  8412. return this.each(function () {
  8413. function v(b) {
  8414. var f = jQuery(r).jqGrid("pivotSetup", b, n),
  8415. c = 0 < d.assocArraySize(f.summary) ? !0 : !1,
  8416. e = d.jgrid.from(f.rows);
  8417. for (b = 0; b < f.groupOptions.groupingView.groupField.length; b++) e.orderBy(f.groupOptions.groupingView.groupField[b], "a", "text", "");
  8418. jQuery(r).jqGrid(d.extend({
  8419. datastr: d.extend(e.select(), c ? {
  8420. userdata: f.summary
  8421. } : {}),
  8422. datatype: "jsonstring",
  8423. footerrow: c,
  8424. userDataOnFooter: c,
  8425. colModel: f.colModel,
  8426. viewrecords: !0,
  8427. sortname: n.xDimension[0].dataName
  8428. },
  8429. h || {},
  8430. f.groupOptions));
  8431. f = f.groupHeaders;
  8432. if (f.length) for (b = 0; b < f.length; b++) f[b] && f[b].groupHeaders.length && jQuery(r).jqGrid("setGroupHeaders", f[b]);
  8433. n.frozenStaticCols && jQuery(r).jqGrid("setFrozenColumns")
  8434. }
  8435. var r = this;
  8436. "string" === typeof q ? d.ajax(d.extend({
  8437. url: q,
  8438. dataType: "json",
  8439. success: function (b) {
  8440. v(d.jgrid.getAccessor(b, e && e.reader ? e.reader : "rows"))
  8441. }
  8442. },
  8443. e || {})) : v(q)
  8444. })
  8445. }
  8446. })
  8447. })(jQuery); (function (c) {
  8448. c.jgrid.extend({
  8449. jqGridImport: function (a) {
  8450. a = c.extend({
  8451. imptype: "xml",
  8452. impstring: "",
  8453. impurl: "",
  8454. mtype: "GET",
  8455. impData: {},
  8456. xmlGrid: {
  8457. config: "roots>grid",
  8458. data: "roots>rows"
  8459. },
  8460. jsonGrid: {
  8461. config: "grid",
  8462. data: "data"
  8463. },
  8464. ajaxOptions: {}
  8465. },
  8466. a || {});
  8467. return this.each(function () {
  8468. var d = this,
  8469. f = function (a, b) {
  8470. var e = c(b.xmlGrid.config, a)[0],
  8471. h = c(b.xmlGrid.data, a)[0],
  8472. f,
  8473. g;
  8474. if (xmlJsonClass.xml2json && c.jgrid.parse) {
  8475. e = xmlJsonClass.xml2json(e, " ");
  8476. e = c.jgrid.parse(e);
  8477. for (g in e) e.hasOwnProperty(g) && (f = e[g]);
  8478. h ? (h = e.grid.datatype, e.grid.datatype = "xmlstring", e.grid.datastr = a, c(d).jqGrid(f).jqGrid("setGridParam", {
  8479. datatype: h
  8480. })) : c(d).jqGrid(f)
  8481. } else alert("xml2json or parse are not present")
  8482. },
  8483. b = function (a, b) {
  8484. if (a && "string" === typeof a) {
  8485. var e = !1;
  8486. c.jgrid.useJSON && (c.jgrid.useJSON = !1, e = !0);
  8487. var f = c.jgrid.parse(a);
  8488. e && (c.jgrid.useJSON = !0);
  8489. e = f[b.jsonGrid.config];
  8490. if (f = f[b.jsonGrid.data]) {
  8491. var g = e.datatype;
  8492. e.datatype = "jsonstring";
  8493. e.datastr = f;
  8494. c(d).jqGrid(e).jqGrid("setGridParam", {
  8495. datatype: g
  8496. })
  8497. } else c(d).jqGrid(e)
  8498. }
  8499. };
  8500. switch (a.imptype) {
  8501. case "xml":
  8502. c.ajax(c.extend({
  8503. url:
  8504. a.impurl,
  8505. type: a.mtype,
  8506. data: a.impData,
  8507. dataType: "xml",
  8508. complete: function (b, g) {
  8509. "success" === g && (f(b.responseXML, a), c(d).triggerHandler("jqGridImportComplete", [b, a]), c.isFunction(a.importComplete) && a.importComplete(b))
  8510. }
  8511. },
  8512. a.ajaxOptions));
  8513. break;
  8514. case "xmlstring":
  8515. if (a.impstring && "string" === typeof a.impstring) {
  8516. var g = c.parseXML(a.impstring);
  8517. g && (f(g, a), c(d).triggerHandler("jqGridImportComplete", [g, a]), c.isFunction(a.importComplete) && a.importComplete(g), a.impstring = null);
  8518. g = null
  8519. }
  8520. break;
  8521. case "json":
  8522. c.ajax(c.extend({
  8523. url:
  8524. a.impurl,
  8525. type: a.mtype,
  8526. data: a.impData,
  8527. dataType: "json",
  8528. complete: function (f) {
  8529. try {
  8530. b(f.responseText, a),
  8531. c(d).triggerHandler("jqGridImportComplete", [f, a]),
  8532. c.isFunction(a.importComplete) && a.importComplete(f)
  8533. } catch (g) { }
  8534. }
  8535. },
  8536. a.ajaxOptions));
  8537. break;
  8538. case "jsonstring":
  8539. 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)
  8540. }
  8541. })
  8542. },
  8543. jqGridExport: function (a) {
  8544. a = c.extend({
  8545. exptype: "xmlstring",
  8546. root: "grid",
  8547. ident: "\t"
  8548. },
  8549. a || {});
  8550. var d = null;
  8551. this.each(function () {
  8552. if (this.grid) {
  8553. var f, b = c.extend(!0, {},
  8554. c(this).jqGrid("getGridParam"));
  8555. b.rownumbers && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8556. b.multiselect && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8557. b.subGrid && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8558. b.knv = null;
  8559. 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));
  8560. switch (a.exptype) {
  8561. case "xmlstring":
  8562. d = "<" + a.root + ">" + xmlJsonClass.json2xml(b, a.ident) + "</" + a.root + ">";
  8563. break;
  8564. case "jsonstring":
  8565. d = "{" + xmlJsonClass.toJson(b, a.root, a.ident, !1) + "}",
  8566. void 0 !== b.postData.filters && (d = d.replace(/filters":"/, 'filters":'), d = d.replace(/}]}"/, "}]}"))
  8567. }
  8568. }
  8569. });
  8570. return d
  8571. },
  8572. excelExport: function (a) {
  8573. a = c.extend({
  8574. exptype: "remote",
  8575. url: null,
  8576. oper: "oper",
  8577. tag: "excel",
  8578. exportOptions: {}
  8579. },
  8580. a || {});
  8581. return this.each(function () {
  8582. if (this.grid) {
  8583. var d;
  8584. "remote" === a.exptype && (d = c.extend({},
  8585. 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)
  8586. }
  8587. })
  8588. }
  8589. })
  8590. })(jQuery);
  8591. var xmlJsonClass = {
  8592. xml2json: function (a, b) {
  8593. 9 === a.nodeType && (a = a.documentElement);
  8594. var g = this.removeWhite(a),
  8595. g = this.toObj(g),
  8596. g = this.toJson(g, a.nodeName, "\t");
  8597. return "{\n" + b + (b ? g.replace(/\t/g, b) : g.replace(/\t|\n/g, "")) + "\n}"
  8598. },
  8599. json2xml: function (a, b) {
  8600. var g = function (a, b, e) {
  8601. var d = "",
  8602. f, k;
  8603. if (a instanceof Array) if (0 === a.length) d += e + "<" + b + ">__EMPTY_ARRAY_</" + b + ">\n";
  8604. else for (f = 0, k = a.length; f < k; f += 1) var n = e + g(a[f], b, e + "\t") + "\n",
  8605. d = d + n;
  8606. else if ("object" === typeof a) {
  8607. f = !1;
  8608. d += e + "<" + b;
  8609. for (k in a) a.hasOwnProperty(k) && ("@" === k.charAt(0) ? d += " " + k.substr(1) + '="' + a[k].toString() + '"' : f = !0);
  8610. d += f ? ">" : "/>";
  8611. if (f) {
  8612. 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")));
  8613. d += ("\n" === d.charAt(d.length - 1) ? e : "") + "</" + b + ">"
  8614. }
  8615. } 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 + ">"));
  8616. return d
  8617. },
  8618. f = "",
  8619. e;
  8620. for (e in a) a.hasOwnProperty(e) && (f += g(a[e], e, ""));
  8621. return b ? f.replace(/\t/g, b) : f.replace(/\t|\n/g, "")
  8622. },
  8623. toObj: function (a) {
  8624. var b = {},
  8625. g = /function/i;
  8626. if (1 === a.nodeType) {
  8627. if (a.attributes.length) {
  8628. var f;
  8629. for (f = 0; f < a.attributes.length; f += 1) b["@" + a.attributes[f].nodeName] = (a.attributes[f].nodeValue || "").toString()
  8630. }
  8631. if (a.firstChild) {
  8632. var e = f = 0,
  8633. h = !1,
  8634. c;
  8635. 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);
  8636. 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);
  8637. else a.attributes.length ? b["#text"] = this.escape(this.innerXml(a)) : b = this.escape(this.innerXml(a));
  8638. 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 = ""));
  8639. else if (e) if (1 < e) b = this.escape(this.innerXml(a));
  8640. else for (c = a.firstChild; c; c = c.nextSibling) if (g.test(a.firstChild.nodeValue)) {
  8641. b = a.firstChild.nodeValue;
  8642. break
  8643. } else b["#cdata"] = this.escape(c.nodeValue)
  8644. }
  8645. a.attributes.length || a.firstChild || (b = null)
  8646. } else 9 === a.nodeType ? b = this.toObj(a.documentElement) : alert("unhandled node type: " + a.nodeType);
  8647. return b
  8648. },
  8649. toJson: function (a, b, g, f) {
  8650. void 0 === f && (f = !0);
  8651. var e = b ? '"' + b + '"' : "",
  8652. h = "\t",
  8653. c = "\n";
  8654. f || (c = h = "");
  8655. if ("[]" === a) e += b ? ":[]" : "[]";
  8656. else if (a instanceof Array) {
  8657. var l, d, m = [];
  8658. d = 0;
  8659. for (l = a.length; d < l; d += 1) m[d] = this.toJson(a[d], "", g + h, f);
  8660. e += (b ? ":[" : "[") + (1 < m.length ? c + g + h + m.join("," + c + g + h) + c + g : m.join("")) + "]"
  8661. } else if (null === a) e += (b && ":") + "null";
  8662. else if ("object" === typeof a) {
  8663. l = [];
  8664. for (d in a) a.hasOwnProperty(d) && (l[l.length] = this.toJson(a[d], d, g + h, f));
  8665. e += (b ? ":{" : "{") + (1 < l.length ? c + g + h + l.join("," + c + g + h) + c + g : l.join("")) + "}"
  8666. } else e = "string" === typeof a ? e + ((b && ":") + '"' + a.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"') : e + ((b && ":") + a.toString());
  8667. return e
  8668. },
  8669. innerXml: function (a) {
  8670. var b = "";
  8671. if ("innerHTML" in a) b = a.innerHTML;
  8672. else {
  8673. var g = function (a) {
  8674. var b = "",
  8675. h;
  8676. if (1 === a.nodeType) {
  8677. b += "<" + a.nodeName;
  8678. for (h = 0; h < a.attributes.length; h += 1) b += " " + a.attributes[h].nodeName + '="' + (a.attributes[h].nodeValue || "").toString() + '"';
  8679. if (a.firstChild) {
  8680. b += ">";
  8681. for (h = a.firstChild; h; h = h.nextSibling) b += g(h);
  8682. b += "</" + a.nodeName + ">"
  8683. } else b += "/>"
  8684. } else 3 === a.nodeType ? b += a.nodeValue : 4 === a.nodeType && (b += "<![CDATA[" + a.nodeValue + "]]\x3e");
  8685. return b
  8686. };
  8687. for (a = a.firstChild; a; a = a.nextSibling) b += g(a)
  8688. }
  8689. return b
  8690. },
  8691. escape: function (a) {
  8692. return a.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, "\\n").replace(/[\r]/g, "\\r")
  8693. },
  8694. removeWhite: function (a) {
  8695. a.normalize();
  8696. var b;
  8697. for (b = a.firstChild; b;) if (3 === b.nodeType) if (b.nodeValue.match(/[^ \f\n\r\t\v]/)) b = b.nextSibling;
  8698. else {
  8699. var g = b.nextSibling;
  8700. a.removeChild(b);
  8701. b = g
  8702. } else 1 === b.nodeType && this.removeWhite(b),
  8703. b = b.nextSibling;
  8704. return a
  8705. }
  8706. };
  8707. function tableToGrid(l, m) {
  8708. jQuery(l).each(function () {
  8709. if (!this.grid) {
  8710. jQuery(this).width("99%");
  8711. var b = jQuery(this).width(),
  8712. c = jQuery("tr td:first-child input[type=checkbox]:first", jQuery(this)),
  8713. a = jQuery("tr td:first-child input[type=radio]:first", jQuery(this)),
  8714. c = 0 < c.length,
  8715. a = !c && 0 < a.length,
  8716. k = c || a,
  8717. d = [],
  8718. e = [];
  8719. jQuery("th", jQuery(this)).each(function () {
  8720. 0 === d.length && k ? (d.push({
  8721. name: "__selection__",
  8722. index: "__selection__",
  8723. width: 0,
  8724. hidden: !0
  8725. }), e.push("__selection__")) : (d.push({
  8726. name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  8727. index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  8728. width: jQuery(this).width() || 150
  8729. }), e.push(jQuery(this).html()))
  8730. });
  8731. var f = [],
  8732. g = [],
  8733. h = [];
  8734. jQuery("tbody > tr", jQuery(this)).each(function () {
  8735. var b = {},
  8736. a = 0;
  8737. jQuery("td", jQuery(this)).each(function () {
  8738. if (0 === a && k) {
  8739. var c = jQuery("input", jQuery(this)),
  8740. e = c.attr("value");
  8741. g.push(e || f.length);
  8742. c.is(":checked") && h.push(e);
  8743. b[d[a].name] = c.attr("value")
  8744. } else b[d[a].name] = jQuery(this).html();
  8745. a++
  8746. });
  8747. 0 < a && f.push(b)
  8748. });
  8749. jQuery(this).empty();
  8750. jQuery(this).addClass("scroll");
  8751. jQuery(this).jqGrid(jQuery.extend({
  8752. datatype: "local",
  8753. width: b,
  8754. colNames: e,
  8755. colModel: d,
  8756. multiselect: c
  8757. },
  8758. m || {}));
  8759. for (b = 0; b < f.length; b++) a = null,
  8760. 0 < g.length && (a = g[b]) && a.replace && (a = encodeURIComponent(a).replace(/[.\-%]/g, "_")),
  8761. null === a && (a = b + 1),
  8762. jQuery(this).jqGrid("addRowData", a, f[b]);
  8763. for (b = 0; b < h.length; b++) jQuery(this).jqGrid("setSelection", h[b])
  8764. }
  8765. })
  8766. }; (function (b) {
  8767. b.jgrid.msie && 8 === b.jgrid.msiever() && (b.expr[":"].hidden = function (b) {
  8768. return 0 === b.offsetWidth || 0 === b.offsetHeight || "none" === b.style.display
  8769. });
  8770. b.jgrid._multiselect = !1;
  8771. if (b.ui && b.ui.multiselect) {
  8772. if (b.ui.multiselect.prototype._setSelected) {
  8773. var r = b.ui.multiselect.prototype._setSelected;
  8774. b.ui.multiselect.prototype._setSelected = function (a, d) {
  8775. var c = r.call(this, a, d);
  8776. if (d && this.selectedList) {
  8777. var e = this.element;
  8778. this.selectedList.find("li").each(function () {
  8779. b(this).data("optionLink") && b(this).data("optionLink").remove().appendTo(e)
  8780. })
  8781. }
  8782. return c
  8783. }
  8784. }
  8785. b.ui.multiselect.prototype.destroy && (b.ui.multiselect.prototype.destroy = function () {
  8786. this.element.show();
  8787. this.container.remove();
  8788. void 0 === b.Widget ? b.widget.prototype.destroy.apply(this, arguments) : b.Widget.prototype.destroy.apply(this, arguments)
  8789. });
  8790. b.jgrid._multiselect = !0
  8791. }
  8792. b.jgrid.extend({
  8793. sortableColumns: function (a) {
  8794. return this.each(function () {
  8795. function d() {
  8796. c.p.disableClick = !0
  8797. }
  8798. var c = this,
  8799. e = b.jgrid.jqID(c.p.id),
  8800. e = {
  8801. tolerance: "pointer",
  8802. axis: "x",
  8803. scrollSensitivity: "1",
  8804. items: ">th:not(:has(#jqgh_" + e + "_cb,#jqgh_" + e + "_rn,#jqgh_" + e + "_subgrid),:hidden)",
  8805. placeholder: {
  8806. element: function (a) {
  8807. return b(document.createElement(a[0].nodeName)).addClass(a[0].className + " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]
  8808. },
  8809. update: function (b, a) {
  8810. a.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10));
  8811. a.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10))
  8812. }
  8813. },
  8814. update: function (a, e) {
  8815. var d = b(e.item).parent(),
  8816. d = b(">th", d),
  8817. f = {},
  8818. g = c.p.id + "_";
  8819. b.each(c.p.colModel,
  8820. function (b) {
  8821. f[this.name] = b
  8822. });
  8823. var l = [];
  8824. d.each(function () {
  8825. var a = b(">div", this).get(0).id.replace(/^jqgh_/, "").replace(g, "");
  8826. f.hasOwnProperty(a) && l.push(f[a])
  8827. });
  8828. b(c).jqGrid("remapColumns", l, !0, !0);
  8829. b.isFunction(c.p.sortable.update) && c.p.sortable.update(l);
  8830. setTimeout(function () {
  8831. c.p.disableClick = !1
  8832. },
  8833. 50)
  8834. }
  8835. };
  8836. c.p.sortable.options ? b.extend(e, c.p.sortable.options) : b.isFunction(c.p.sortable) && (c.p.sortable = {
  8837. update: c.p.sortable
  8838. });
  8839. if (e.start) {
  8840. var g = e.start;
  8841. e.start = function (b, a) {
  8842. d();
  8843. g.call(this, b, a)
  8844. }
  8845. } else e.start = d;
  8846. c.p.sortable.exclude && (e.items += ":not(" + c.p.sortable.exclude + ")");
  8847. a.sortable(e).data("sortable").floating = !0
  8848. })
  8849. },
  8850. columnChooser: function (a) {
  8851. function d(a, c) {
  8852. 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)))
  8853. }
  8854. var c = this;
  8855. if (!b("#colchooser_" + b.jgrid.jqID(c[0].p.id)).length) {
  8856. var e = b('<div id="colchooser_' + c[0].p.id + '" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
  8857. g = b("select", e);
  8858. a = b.extend({
  8859. width: 420,
  8860. height: 240,
  8861. classname: null,
  8862. done: function (b) {
  8863. b && c.jqGrid("remapColumns", b, !0)
  8864. },
  8865. msel: "multiselect",
  8866. dlog: "dialog",
  8867. dialog_opts: {
  8868. minWidth: 470
  8869. },
  8870. dlog_opts: function (a) {
  8871. var c = {};
  8872. c[a.bSubmit] = function () {
  8873. a.apply_perm();
  8874. a.cleanup(!1)
  8875. };
  8876. c[a.bCancel] = function () {
  8877. a.cleanup(!0)
  8878. };
  8879. return b.extend(!0, {
  8880. buttons: c,
  8881. close: function () {
  8882. a.cleanup(!0)
  8883. },
  8884. modal: a.modal || !1,
  8885. resizable: a.resizable || !0,
  8886. width: a.width + 20
  8887. },
  8888. a.dialog_opts || {})
  8889. },
  8890. apply_perm: function () {
  8891. b("option", g).each(function () {
  8892. this.selected ? c.jqGrid("showCol", k[this.value].name) : c.jqGrid("hideCol", k[this.value].name)
  8893. });
  8894. var e = [];
  8895. b("option:selected", g).each(function () {
  8896. e.push(parseInt(this.value, 10))
  8897. });
  8898. b.each(e,
  8899. function () {
  8900. delete p[k[parseInt(this, 10)].name]
  8901. });
  8902. b.each(p,
  8903. function () {
  8904. var b = parseInt(this, 10);
  8905. var a = e,
  8906. c = b;
  8907. if (0 <= c) {
  8908. var d = a.slice(),
  8909. k = d.splice(c, Math.max(a.length - c, c));
  8910. c > a.length && (c = a.length);
  8911. d[c] = b;
  8912. e = d.concat(k)
  8913. } else e = void 0
  8914. });
  8915. a.done && a.done.call(c, e)
  8916. },
  8917. cleanup: function (b) {
  8918. d(a.dlog, e, "destroy");
  8919. d(a.msel, g, "destroy");
  8920. e.remove();
  8921. b && a.done && a.done.call(c)
  8922. },
  8923. msel_opts: {}
  8924. },
  8925. b.jgrid.col, a || {});
  8926. if (b.ui && b.ui.multiselect && "multiselect" === a.msel) {
  8927. if (!b.jgrid._multiselect) {
  8928. alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
  8929. return
  8930. }
  8931. a.msel_opts = b.extend(b.ui.multiselect.defaults, a.msel_opts)
  8932. }
  8933. a.caption && e.attr("title", a.caption);
  8934. a.classname && (e.addClass(a.classname), g.addClass(a.classname));
  8935. a.width && (b(">div", e).css({
  8936. width: a.width,
  8937. margin: "0 auto"
  8938. }), g.css("width", a.width));
  8939. a.height && (b(">div", e).css("height", a.height), g.css("height", a.height - 10));
  8940. var k = c.jqGrid("getGridParam", "colModel"),
  8941. t = c.jqGrid("getGridParam", "colNames"),
  8942. p = {},
  8943. f = [];
  8944. g.empty();
  8945. b.each(k,
  8946. function (a) {
  8947. p[this.name] = a;
  8948. this.hidedlg ? this.hidden || f.push(a) : g.append("<option value='" + a + "' " + (this.hidden ? "" : "selected='selected'") + ">" + b.jgrid.stripHtml(t[a]) + "</option>")
  8949. });
  8950. var q = b.isFunction(a.dlog_opts) ? a.dlog_opts.call(c, a) : a.dlog_opts;
  8951. d(a.dlog, e, q);
  8952. q = b.isFunction(a.msel_opts) ? a.msel_opts.call(c, a) : a.msel_opts;
  8953. d(a.msel, g, q)
  8954. }
  8955. },
  8956. sortableRows: function (a) {
  8957. return this.each(function () {
  8958. var d = this;
  8959. d.grid && !d.p.treeGrid && b.fn.sortable && (a = b.extend({
  8960. cursor: "move",
  8961. axis: "y",
  8962. items: ".jqgrow"
  8963. },
  8964. 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) {
  8965. b(e.item).css("border-width", "0");
  8966. b("td", e.item).each(function (b) {
  8967. this.style.width = d.grid.cols[b].style.width
  8968. });
  8969. if (d.p.subGrid) {
  8970. var g = b(e.item).attr("id");
  8971. try {
  8972. b(d).jqGrid("collapseSubGridRow", g)
  8973. } catch (k) { }
  8974. }
  8975. a._start_ && a._start_.apply(this, [c, e])
  8976. },
  8977. a.update = function (c, e) {
  8978. b(e.item).css("border-width", ""); !0 === d.p.rownumbers && b("td.jqgrid-rownum", d.rows).each(function (a) {
  8979. b(this).html(a + 1 + (parseInt(d.p.page, 10) - 1) * parseInt(d.p.rowNum, 10))
  8980. });
  8981. a._update_ && a._update_.apply(this, [c, e])
  8982. },
  8983. b("tbody:first", d).sortable(a), b("tbody:first", d).disableSelection())
  8984. })
  8985. },
  8986. gridDnD: function (a) {
  8987. return this.each(function () {
  8988. function d() {
  8989. var a = b.data(c, "dnd");
  8990. b("tr.jqgrow:not(.ui-draggable)", c).draggable(b.isFunction(a.drag) ? a.drag.call(b(c), a) : a.drag)
  8991. }
  8992. var c = this,
  8993. e, g;
  8994. 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();
  8995. else if (a = b.extend({
  8996. drag: function (a) {
  8997. return b.extend({
  8998. start: function (e, d) {
  8999. var f;
  9000. if (c.p.subGrid) {
  9001. f = b(d.helper).attr("id");
  9002. try {
  9003. b(c).jqGrid("collapseSubGridRow", f)
  9004. } catch (g) { }
  9005. }
  9006. 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", {});
  9007. d.helper.addClass("ui-state-highlight");
  9008. b("td", d.helper).each(function (b) {
  9009. this.style.width = c.grid.headers[b].width + "px"
  9010. });
  9011. a.onstart && b.isFunction(a.onstart) && a.onstart.call(b(c), e, d)
  9012. },
  9013. stop: function (e, d) {
  9014. var f;
  9015. d.helper.dropped && !a.dragcopy && (f = b(d.helper).attr("id"), void 0 === f && (f = b(this).attr("id")), b(c).jqGrid("delRowData", f));
  9016. for (f = 0; f < b.data(c, "dnd").connectWith.length; f++) b(b.data(c, "dnd").connectWith[f]).jqGrid("delRowData", "jqg_empty_row");
  9017. a.onstop && b.isFunction(a.onstop) && a.onstop.call(b(c), e, d)
  9018. }
  9019. },
  9020. a.drag_opts || {})
  9021. },
  9022. drop: function (a) {
  9023. return b.extend({
  9024. accept: function (a) {
  9025. if (!b(a).hasClass("jqgrow")) return a;
  9026. a = b(a).closest("table.ui-jqgrid-btable");
  9027. 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
  9028. },
  9029. drop: function (e, d) {
  9030. if (b(d.draggable).hasClass("jqgrow")) {
  9031. var f = b(d.draggable).attr("id"),
  9032. f = d.draggable.parent().parent().jqGrid("getRowData", f);
  9033. if (!a.dropbyname) {
  9034. var g = 0,
  9035. l = {},
  9036. h, n, s = b("#" + b.jgrid.jqID(this.id)).jqGrid("getGridParam", "colModel");
  9037. try {
  9038. 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++);
  9039. f = l
  9040. } catch (r) { }
  9041. }
  9042. d.helper.dropped = !0;
  9043. 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));
  9044. if (d.helper.dropped) {
  9045. var m;
  9046. a.autoid && (b.isFunction(a.autoid) ? m = a.autoid.call(this, f) : (m = Math.ceil(1E3 * Math.random()), m = a.autoidprefix + m));
  9047. b("#" + b.jgrid.jqID(this.id)).jqGrid("addRowData", m, f, a.droppos)
  9048. }
  9049. a.ondrop && b.isFunction(a.ondrop) && a.ondrop.call(this, e, d, f)
  9050. }
  9051. }
  9052. },
  9053. a.drop_opts || {})
  9054. },
  9055. onstart: null,
  9056. onstop: null,
  9057. beforedrop: null,
  9058. ondrop: null,
  9059. drop_opts: {
  9060. activeClass: "ui-state-active",
  9061. hoverClass: "ui-state-hover"
  9062. },
  9063. drag_opts: {
  9064. revert: "invalid",
  9065. helper: "clone",
  9066. cursor: "move",
  9067. appendTo: "#jqgrid_dnd",
  9068. zIndex: 5E3
  9069. },
  9070. dragcopy: !1,
  9071. dropbyname: !1,
  9072. droppos: "first",
  9073. autoid: !0,
  9074. autoidprefix: "dnd_"
  9075. },
  9076. a || {}), a.connectWith) for (a.connectWith = a.connectWith.split(","), a.connectWith = b.map(a.connectWith,
  9077. function (a) {
  9078. return b.trim(a)
  9079. }), 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],
  9080. b(g).droppable(b.isFunction(a.drop) ? a.drop.call(b(c), a) : a.drop)
  9081. })
  9082. },
  9083. gridResize: function (a) {
  9084. return this.each(function () {
  9085. var d = this,
  9086. c = b.jgrid.jqID(d.p.id);
  9087. d.grid && b.fn.resizable && (a = b.extend({},
  9088. 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) {
  9089. b(d).jqGrid("setGridParam", {
  9090. height: b("#gview_" + c + " .ui-jqgrid-bdiv").height()
  9091. });
  9092. b(d).jqGrid("setGridWidth", g.size.width, a.shrinkToFit);
  9093. a._stop_ && a._stop_.call(d, e, g)
  9094. },
  9095. 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))
  9096. })
  9097. }
  9098. })
  9099. })(jQuery);