jqgrid.js 510 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100
  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. D += "<th id='" + a.p.id + "_" + a.p.colModel[g].name + "' style='text-align:center;' role='columnheader' class='ui-state-default ui-th-column ui-th-" + f + "'" + F + ">",
  1822. F = a.p.colModel[g].index || a.p.colModel[g].name,
  1823. D += "<div id='jqgh_" + a.p.id + "_" + a.p.colModel[g].name + "' " + ta + ">" + a.p.colNames[g],
  1824. a.p.colModel[g].width = bc ? parseInt(bc, 10) : 150,
  1825. "boolean" !== typeof a.p.colModel[g].title && (a.p.colModel[g].title = !0),
  1826. a.p.colModel[g].lso = "",
  1827. F === a.p.sortname && (a.p.lastsort = g),
  1828. a.p.multiSort && (F = b.inArray(F, ga), -1 !== F && (a.p.colModel[g].lso = va[F])),
  1829. D += ba + "</div></th>"
  1830. }
  1831. D += "</tr></thead>";
  1832. ba = null;
  1833. b(this).append(D);
  1834. function widthCount(a, b) {
  1835. return a
  1836. };
  1837. b("thead tr:first th", this).hover(function () { },
  1838. function () {
  1839. b(this).removeClass("ui-state-hover")
  1840. });
  1841. if (this.p.multiselect) {
  1842. var bd = [],
  1843. ca;
  1844. b("#cb_" + b.jgrid.jqID(a.p.id), this).bind("click",
  1845. function () {
  1846. a.p.selarrrow = [];
  1847. var c = !0 === a.p.frozenColumns ? a.p.id + "_frozen" : "";
  1848. this.checked ? (b(a.rows).each(function (d) {
  1849. 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")))
  1850. }), ca = !0, bd = []) : (b(a.rows).each(function (d) {
  1851. 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")))
  1852. }), a.p.selrow = null, ca = !1);
  1853. b(a).triggerHandler("jqGridSelectAll", [ca ? a.p.selarrrow : bd, ca]);
  1854. b.isFunction(a.p.onSelectAll) && a.p.onSelectAll.call(a, ca ? a.p.selarrrow : bd, ca)
  1855. })
  1856. } !0 === a.p.autowidth && (D = b(m).innerWidth(), a.p.width = 0 < D ? D : "nw"); (function () {
  1857. var d = 0,
  1858. e = b.jgrid.cell_width ? 0 : r(a.p.cellLayout, 0),
  1859. g = 0,
  1860. f,
  1861. h = r(a.p.scrollOffset, 0),
  1862. k,
  1863. m = !1,
  1864. n,
  1865. p = 0,
  1866. q;
  1867. b.each(a.p.colModel,
  1868. function () {
  1869. void 0 === this.hidden && (this.hidden = !1);
  1870. if (a.p.grouping && a.p.autowidth) {
  1871. var c = b.inArray(this.name, a.p.groupingView.groupField);
  1872. 0 <= c && a.p.groupingView.groupColumnShow.length > c && (this.hidden = !a.p.groupingView.groupColumnShow[c])
  1873. }
  1874. this.widthOrg = k = r(this.width, 0); !1 === this.hidden && (d += k + e, this.fixed ? p += k + e : g++)
  1875. });
  1876. isNaN(a.p.width) && (a.p.width = d + (!1 !== a.p.shrinkToFit || isNaN(a.p.height) ? 0 : h));
  1877. c.width = a.p.width;
  1878. 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,
  1879. function (b) {
  1880. !1 !== this.hidden || this.fixed || (this.width = k = Math.round(n * this.width / (a.p.tblwidth - e * g - p)), d += k, f = b)
  1881. }), 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))
  1882. })();
  1883. b(m).css("width", c.width + "px").append("<div class='ui-jqgrid-resize-mark' id='rs_m" + a.p.id + "'>&#160;</div>");
  1884. b(k).css("width", c.width + "px");
  1885. var D = b("thead:first", a).get(0),
  1886. V = "";
  1887. 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 + "'>");
  1888. var k = b("tr:first", D),
  1889. be = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
  1890. a.p.disableClick = !1;
  1891. b("th", k).each(function (d) {
  1892. ja = a.p.colModel[d].width;
  1893. void 0 === a.p.colModel[d].resizable && (a.p.colModel[d].resizable = !0);
  1894. 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 = "";
  1895. b(this).css("width", ja + "px").prepend(fa);
  1896. fa = null;
  1897. var e = "";
  1898. a.p.colModel[d].hidden && (b(this).css("display", "none"), e = "display:none;");
  1899. be += "<td role='gridcell' style='height:0px;width:" + ja + "px;" + e + "'></td>";
  1900. c.headers[d] = {
  1901. width: ja,
  1902. el: this
  1903. };
  1904. ka = a.p.colModel[d].sortable;
  1905. "boolean" !== typeof ka && (ka = a.p.colModel[d].sortable = !0);
  1906. e = a.p.colModel[d].name;
  1907. "cb" !== e && "subgrid" !== e && "rn" !== e && a.p.viewsortcols[2] && b(">div", this).addClass("ui-jqgrid-sortable");
  1908. 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")));
  1909. a.p.footerrow && (V += "<td role='gridcell' " + p(d, 0, "", null, "", !1) + ">&#160;</td>")
  1910. }).mousedown(function (d) {
  1911. if (1 === b(d.target).closest("th>span.ui-jqgrid-resize").length) {
  1912. var e = sa(this);
  1913. if (!0 === a.p.forceFit) {
  1914. var g = a.p,
  1915. f = e,
  1916. h;
  1917. for (h = e + 1; h < a.p.colModel.length; h++) if (!0 !== a.p.colModel[h].hidden) {
  1918. f = h;
  1919. break
  1920. }
  1921. g.nv = f - e
  1922. }
  1923. c.dragStart(e, d, xa(e));
  1924. return !1
  1925. }
  1926. }).click(function (c) {
  1927. if (a.p.disableClick) return a.p.disableClick = !1;
  1928. var d = "th>div.ui-jqgrid-sortable",
  1929. e, g;
  1930. a.p.viewsortcols[2] || (d = "th>div>span>span.ui-grid-ico-sort");
  1931. c = b(c.target).closest(d);
  1932. if (1 === c.length) {
  1933. var f;
  1934. if (a.p.frozenColumns) {
  1935. var h = b(this)[0].id.substring(a.p.id.length + 1);
  1936. b(a.p.colModel).each(function (a) {
  1937. if (this.name === h) return f = a,
  1938. !1
  1939. })
  1940. } else f = sa(this);
  1941. a.p.viewsortcols[2] || (e = !0, g = c.attr("sort"));
  1942. null != f && ra(b("div", this)[0].id, f, e, g, this);
  1943. return !1
  1944. }
  1945. });
  1946. if (a.p.sortable && b.fn.sortable) try {
  1947. b(a).jqGrid("sortableColumns", k)
  1948. } catch (Ba) { }
  1949. a.p.footerrow && (V += "</tr></tbody></table>");
  1950. be += "</tr>";
  1951. k = document.createElement("tbody");
  1952. this.appendChild(k);
  1953. b(this).addClass("ui-jqgrid-btable").append(be);
  1954. var be = null,
  1955. 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),
  1956. J = a.p.caption && !0 === a.p.hiddengrid ? !0 : !1;
  1957. g = b("<div class='ui-jqgrid-hbox" + ("rtl" === f ? "-rtl" : "") + "'><div class='edit_items' title='编辑显示字段'>...</div></div>");
  1958. D = null;
  1959. c.hDiv = document.createElement("div");
  1960. b(c.hDiv).css({
  1961. width: c.width + "px"
  1962. }).addClass("ui-state-default ui-jqgrid-hdiv").append(g);
  1963. b(g).append(k);
  1964. k = null;
  1965. J && b(c.hDiv).hide();
  1966. 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({
  1967. width: c.width + "px"
  1968. }).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",
  1969. function (a) {
  1970. t = b(a.target).closest("tr.jqgrow");
  1971. "ui-subgrid" !== b(t).attr("class") && b(t).addClass("ui-state-hover")
  1972. }).bind("mouseout",
  1973. function (a) {
  1974. t = b(a.target).closest("tr.jqgrow");
  1975. b(t).removeClass("ui-state-hover")
  1976. });
  1977. var B, N, ma;
  1978. b(a).before(c.hDiv).click(function (c) {
  1979. y = c.target;
  1980. t = b(y, a.rows).closest("tr.jqgrow");
  1981. 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;
  1982. var d = b(y).hasClass("cbox"),
  1983. 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));
  1984. 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);
  1985. else {
  1986. B = t[0].rowIndex;
  1987. try {
  1988. b(a).jqGrid("editCell", B, N, !0)
  1989. } catch (g) { }
  1990. } 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));
  1991. else {
  1992. if (a.p.multiselect && a.p.multiboxonly && !d) {
  1993. var f = a.p.frozenColumns ? a.p.id + "_frozen" : "";
  1994. b(a.p.selarrrow).each(function (c, d) {
  1995. var e = b(a).jqGrid("getGridRowById", d);
  1996. b(e).removeClass("ui-state-highlight");
  1997. b("#jqg_" + b.jgrid.jqID(a.p.id) + "_" + b.jgrid.jqID(d))[a.p.useProp ? "prop" : "attr"]("checked", !1);
  1998. 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))
  1999. });
  2000. a.p.selarrrow = []
  2001. }
  2002. b(a).jqGrid("setSelection", B, !0, c)
  2003. }
  2004. }).bind("reloadGrid",
  2005. function (c, d) {
  2006. !0 === a.p.treeGrid && (a.p.datatype = a.p.treedatatype);
  2007. d && d.current && a.grid.selectionPreserver(a);
  2008. "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 = []);
  2009. a.p.scroll && X.call(a, !0, !1);
  2010. if (d && d.page) {
  2011. var e = d.page;
  2012. e > a.p.lastpage && (e = a.p.lastpage);
  2013. 1 > e && (e = 1);
  2014. a.p.page = e;
  2015. a.grid.bDiv.scrollTop = a.grid.prevRowHeight ? (e - 1) * a.grid.prevRowHeight * a.p.rowNum : 0
  2016. }
  2017. a.grid.prevRowHeight && a.p.scroll ? (delete a.p.lastpage, a.grid.populateVisible()) : a.grid.populate(); !0 === a.p._inlinenav && b(a).jqGrid("showAddEditButtons");
  2018. return !1
  2019. }).dblclick(function (c) {
  2020. y = c.target;
  2021. t = b(y, a.rows).closest("tr.jqgrow");
  2022. 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))
  2023. }).bind("contextmenu",
  2024. function (c) { });
  2025. c.bDiv = document.createElement("div");
  2026. n && "auto" === String(a.p.height).toLowerCase() && (a.p.height = "100%");
  2027. 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({
  2028. height: a.p.height + (isNaN(a.p.height) ? "" : "px"),
  2029. width: c.width + "px"
  2030. }).scroll(c.scrollGrid);
  2031. b("table:first", c.bDiv).css({
  2032. width: a.p.tblwidth + "px"
  2033. });
  2034. b.support.tbody || 2 === b("tbody", this).length && b("tbody:gt(0)", this).remove();
  2035. a.p.multikey && (b.jgrid.msie ? b(c.bDiv).bind("selectstart",
  2036. function () {
  2037. return !1
  2038. }) : b(c.bDiv).bind("mousedown",
  2039. function () {
  2040. return !1
  2041. }));
  2042. J && b(c.bDiv).hide();
  2043. c.cDiv = document.createElement("div");
  2044. var bf = !0 === a.p.hidegrid ? b("<a role='link' class='ui-jqgrid-titlebar-close ui-corner-all HeaderButton' />").hover(function () {
  2045. bf.addClass("ui-state-hover")
  2046. },
  2047. function () {
  2048. bf.removeClass("ui-state-hover")
  2049. }).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl" === f ? "left" : "right", "0px") : "";
  2050. 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");
  2051. b(c.cDiv).insertBefore(c.hDiv);
  2052. 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());
  2053. 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"));
  2054. 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());
  2055. g = null;
  2056. if (a.p.caption) {
  2057. var bg = a.p.datatype; !0 === a.p.hidegrid && (b(".ui-jqgrid-titlebar-close", c.cDiv).click(function (d) {
  2058. var e = b.isFunction(a.p.onHeaderClick),
  2059. g = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
  2060. f,
  2061. h = this; !0 === a.p.toolbar[0] && ("both" === a.p.toolbar[1] && (g += ", #" + b(c.ubDiv).attr("id")), g += ", #" + b(c.uDiv).attr("id"));
  2062. f = b(g, "#gview_" + b.jgrid.jqID(a.p.id)).length;
  2063. "visible" === a.p.gridstate ? b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideUp("fast",
  2064. function () {
  2065. f--;
  2066. 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)))
  2067. }) : "hidden" === a.p.gridstate && b(g, "#gbox_" + b.jgrid.jqID(a.p.id)).slideDown("fast",
  2068. function () {
  2069. f--;
  2070. 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)))
  2071. });
  2072. return !1
  2073. }), J && (a.p.datatype = "local", b(".ui-jqgrid-titlebar-close", c.cDiv).trigger("click")))
  2074. } else b(c.cDiv).hide();
  2075. b(c.hDiv).after(c.bDiv).mousemove(function (a) {
  2076. if (c.resizing) return c.dragMove(a),
  2077. !1
  2078. });
  2079. b(".ui-jqgrid-labels", c.hDiv).bind("selectstart",
  2080. function () {
  2081. return !1
  2082. });
  2083. b(document).bind("mouseup.jqGrid" + a.p.id,
  2084. function () {
  2085. return c.resizing ? (c.dragEnd(), !1) : !0
  2086. });
  2087. a.formatCol = p;
  2088. a.sortData = ra;
  2089. a.updatepager = function (c, d) {
  2090. var e, g, f, h, k, l, m, n = "",
  2091. p = a.p.pager ? "_" + b.jgrid.jqID(a.p.pager.substr(1)) : "",
  2092. q = a.p.toppager ? "_" + a.p.toppager.substr(1) : "";
  2093. f = parseInt(a.p.page, 10) - 1;
  2094. 0 > f && (f = 0);
  2095. f *= parseInt(a.p.rowNum, 10);
  2096. k = f + a.p.reccount;
  2097. if (a.p.scroll) {
  2098. e = b("tbody:first > tr:gt(0)", a.grid.bDiv);
  2099. f = k - e.length;
  2100. a.p.reccount = e.length;
  2101. if (e = e.outerHeight() || a.grid.prevRowHeight) g = f * e,
  2102. m = parseInt(a.p.records, 10) * e,
  2103. b(">div:first", a.grid.bDiv).css({
  2104. height: m
  2105. }).children("div:first").css({
  2106. height: g,
  2107. display: g ? "" : "none"
  2108. }),
  2109. 0 == a.grid.bDiv.scrollTop && 1 < a.p.page && (a.grid.bDiv.scrollTop = a.p.rowNum * (a.p.page - 1) * e);
  2110. a.grid.bDiv.scrollLeft = a.grid.hDiv.scrollLeft
  2111. }
  2112. n = a.p.pager || "";
  2113. if (n += a.p.toppager ? n ? "," + a.p.toppager : a.p.toppager : "") m = b.jgrid.formatter.integer || {},
  2114. e = r(a.p.page),
  2115. g = r(a.p.lastpage),
  2116. b(".selbox", n)[this.p.useProp ? "prop" : "attr"]("disabled", !1),
  2117. !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)),
  2118. 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)))))),
  2119. !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) {
  2120. b(this).html(f + 1 + a)
  2121. });
  2122. d && a.p.jqgdnd && b(a).jqGrid("gridDnD", "updateDnD");
  2123. b(a).triggerHandler("jqGridGridComplete");
  2124. b.isFunction(a.p.gridComplete) && a.p.gridComplete.call(a);
  2125. b(a).triggerHandler("jqGridAfterGridComplete")
  2126. };
  2127. a.refreshIndex = O;
  2128. a.setHeadCheckBox = ha;
  2129. a.constructTr = $;
  2130. a.formatter = function (a, b, c, d, e) {
  2131. return x(a, b, c, d, e)
  2132. };
  2133. b.extend(c, {
  2134. populate: Q,
  2135. emptyRows: X,
  2136. beginReq: P,
  2137. endReq: T
  2138. });
  2139. this.grid = c;
  2140. a.addXmlData = function (b) {
  2141. K(b, a.grid.bDiv)
  2142. };
  2143. a.addJSONData = function (b) {
  2144. Y(b, a.grid.bDiv)
  2145. };
  2146. this.grid.cols = this.rows[0].cells;
  2147. b(a).triggerHandler("jqGridInitGrid");
  2148. b.isFunction(a.p.onInitGrid) && a.p.onInitGrid.call(a);
  2149. Q();
  2150. a.p.hiddengrid = !1
  2151. }
  2152. }
  2153. }
  2154. })
  2155. };
  2156. b.jgrid.extend({
  2157. getGridParam: function (b) {
  2158. var f = this[0];
  2159. if (f && f.grid) return b ? void 0 !== f.p[b] ? f.p[b] : null : f.p
  2160. },
  2161. setGridParam: function (e) {
  2162. return this.each(function () {
  2163. this.grid && "object" === typeof e && b.extend(!0, this.p, e)
  2164. })
  2165. },
  2166. getGridRowById: function (e) {
  2167. var f;
  2168. this.each(function () {
  2169. try {
  2170. for (var c = this.rows.length; c--;) if (e.toString() === this.rows[c].id) {
  2171. f = this.rows[c];
  2172. break
  2173. }
  2174. } catch (d) {
  2175. f = b(this.grid.bDiv).find("#" + b.jgrid.jqID(e))
  2176. }
  2177. });
  2178. return f
  2179. },
  2180. getDataIDs: function () {
  2181. var e = [],
  2182. f = 0,
  2183. c,
  2184. d = 0;
  2185. this.each(function () {
  2186. if ((c = this.rows.length) && 0 < c) for (; f < c;) b(this.rows[f]).hasClass("jqgrow") && (e[d] = this.rows[f].id, d++),
  2187. f++
  2188. });
  2189. return e
  2190. },
  2191. setSelection: function (e, f, c) {
  2192. return this.each(function () {
  2193. var d, a, l, g, h, k;
  2194. 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({
  2195. "aria-selected": "false",
  2196. tabindex: "-1"
  2197. }), b(a).addClass("ui-state-highlight").attr({
  2198. "aria-selected": "true",
  2199. tabindex: "0"
  2200. }), 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)))))
  2201. })
  2202. },
  2203. resetSelection: function (e) {
  2204. return this.each(function () {
  2205. var f = this,
  2206. c, d; !0 === f.p.frozenColumns && (d = f.p.id + "_frozen");
  2207. if (void 0 !== e) {
  2208. c = e === f.p.selrow ? f.p.selrow : e;
  2209. b("#" + b.jgrid.jqID(f.p.id) + " tbody:first tr#" + b.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
  2210. d && b("#" + b.jgrid.jqID(c), "#" + b.jgrid.jqID(d)).removeClass("ui-state-highlight");
  2211. if (f.p.multiselect) {
  2212. 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);
  2213. 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);
  2214. f.setHeadCheckBox(!1)
  2215. }
  2216. c = null
  2217. } else f.p.multiselect ? (b(f.p.selarrrow).each(function (a, c) {
  2218. b(b(f).jqGrid("getGridRowById", c)).removeClass("ui-state-highlight").attr("aria-selected", "false");
  2219. b("#jqg_" + b.jgrid.jqID(f.p.id) + "_" + b.jgrid.jqID(c))[f.p.useProp ? "prop" : "attr"]("checked", !1);
  2220. 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))
  2221. }), 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"));
  2222. f.p.savedRow = []
  2223. })
  2224. },
  2225. getRowData: function (e) {
  2226. var f = {},
  2227. c, d = !1,
  2228. a, l = 0;
  2229. this.each(function () {
  2230. var g = this,
  2231. h, k;
  2232. if (void 0 === e) d = !0,
  2233. c = [],
  2234. a = g.rows.length;
  2235. else {
  2236. k = b(g).jqGrid("getGridRowById", e);
  2237. if (!k) return f;
  2238. a = 2
  2239. }
  2240. for (; l < a;) d && (k = g.rows[l]),
  2241. b(k).hasClass("jqgrow") && (b('td[role="gridcell"]', k).each(function (a) {
  2242. h = g.p.colModel[a].name;
  2243. 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());
  2244. else try {
  2245. f[h] = b.unformat.call(g, this, {
  2246. rowId: k.id,
  2247. colModel: g.p.colModel[a]
  2248. },
  2249. a)
  2250. } catch (c) {
  2251. f[h] = b.jgrid.htmlDecode(b(this).html())
  2252. }
  2253. }), d && (c.push(f), f = {})),
  2254. l++
  2255. });
  2256. return c || f
  2257. },
  2258. delRowData: function (e) {
  2259. var f = !1,
  2260. c, d;
  2261. this.each(function () {
  2262. c = b(this).jqGrid("getGridRowById", e);
  2263. if (!c) return !1;
  2264. b(c).remove();
  2265. this.p.records--;
  2266. this.p.reccount--;
  2267. this.updatepager(!0, !1);
  2268. f = !0;
  2269. this.p.multiselect && (d = b.inArray(e, this.p.selarrrow), -1 !== d && this.p.selarrrow.splice(d, 1));
  2270. this.p.selrow = this.p.multiselect && 0 < this.p.selarrrow.length ? this.p.selarrrow[this.p.selarrrow.length - 1] : null;
  2271. if ("local" === this.p.datatype) {
  2272. var a = b.jgrid.stripPref(this.p.idPrefix, e),
  2273. a = this.p._index[a];
  2274. void 0 !== a && (this.p.data.splice(a, 1), this.refreshIndex())
  2275. }
  2276. if (!0 === this.p.altRows && f) {
  2277. var l = this.p.altclass;
  2278. b(this.rows).each(function (a) {
  2279. 1 === a % 2 ? b(this).addClass(l) : b(this).removeClass(l)
  2280. })
  2281. }
  2282. });
  2283. return f
  2284. },
  2285. setRowData: function (e, f, c) {
  2286. var d, a = !0,
  2287. l;
  2288. this.each(function () {
  2289. if (!this.grid) return !1;
  2290. var g = this,
  2291. h, k, n = typeof c,
  2292. m = {};
  2293. k = b(this).jqGrid("getGridRowById", e);
  2294. if (!k) return !1;
  2295. if (f) try {
  2296. if (b(this.p.colModel).each(function (a) {
  2297. d = this.name;
  2298. var c = b.jgrid.getAccessor(f, d);
  2299. 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 ? {
  2300. title: b.jgrid.stripHtml(h)
  2301. } : {},
  2302. !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))
  2303. }), "local" === g.p.datatype) {
  2304. var r = b.jgrid.stripPref(g.p.idPrefix, e),
  2305. p = g.p._index[r],
  2306. q;
  2307. if (g.p.treeGrid) for (q in g.p.treeReader) g.p.treeReader.hasOwnProperty(q) && delete m[g.p.treeReader[q]];
  2308. void 0 !== p && (g.p.data[p] = b.extend(!0, g.p.data[p], m));
  2309. m = null
  2310. }
  2311. } catch (x) {
  2312. a = !1
  2313. }
  2314. a && ("string" === n ? b(k).addClass(c) : null !== c && "object" === n && b(k).css(c), b(g).triggerHandler("jqGridAfterGridComplete"))
  2315. });
  2316. return a
  2317. },
  2318. addRowData: function (e, f, c, d) {
  2319. c || (c = "last");
  2320. var a = !1,
  2321. l, g, h, k, n, m, r, p, q = "",
  2322. x, G, U, M, ea, W;
  2323. f && (b.isArray(f) ? (x = !0, c = "last", G = e) : (f = [f], x = !1), this.each(function () {
  2324. var X = f.length;
  2325. n = !0 === this.p.rownumbers ? 1 : 0;
  2326. h = !0 === this.p.multiselect ? 1 : 0;
  2327. k = !0 === this.p.subGrid ? 1 : 0;
  2328. 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]))));
  2329. U = this.p.altclass;
  2330. for (var O = 0,
  2331. $ = "",
  2332. K = {},
  2333. Y = b.isFunction(this.p.afterInsertRow) ? !0 : !1; O < X;) {
  2334. M = f[O];
  2335. g = [];
  2336. if (x) {
  2337. try {
  2338. e = M[G],
  2339. void 0 === e && (e = b.jgrid.randId())
  2340. } catch (oa) {
  2341. e = b.jgrid.randId()
  2342. }
  2343. $ = !0 === this.p.altRows ? 0 === (this.rows.length - 1) % 2 ? U : "" : ""
  2344. }
  2345. W = e;
  2346. e = this.p.idPrefix + e;
  2347. n && (q = this.formatCol(0, 1, "", null, e, !0), g[g.length] = '<td role="gridcell" class="ui-state-default jqgrid-rownum" ' + q + ">0</td>");
  2348. 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>");
  2349. k && (g[g.length] = b(this).jqGrid("addSubGridCell", h + n, 1));
  2350. for (r = h + k + n; r < this.p.colModel.length; r++) ea = this.p.colModel[r],
  2351. l = ea.name,
  2352. K[l] = M[l],
  2353. p = this.formatter(e, b.jgrid.getAccessor(M, l), r, M),
  2354. q = this.formatCol(r, 1, p, M, e, K),
  2355. g[g.length] = '<td role="gridcell" ' + q + ">" + p + "</td>";
  2356. g.unshift(this.constructTr(e, !1, $, K, M, !1));
  2357. g[g.length] = "</tr>";
  2358. if (0 === this.rows.length) b("table:first", this.grid.bDiv).append(g.join(""));
  2359. else switch (c) {
  2360. case "last":
  2361. b(this.rows[this.rows.length - 1]).after(g.join(""));
  2362. m = this.rows.length - 1;
  2363. break;
  2364. case "first":
  2365. b(this.rows[0]).after(g.join(""));
  2366. m = 1;
  2367. break;
  2368. case "after":
  2369. 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("")),
  2370. m = m.rowIndex + 1;
  2371. break;
  2372. case "before":
  2373. if (m = b(this).jqGrid("getGridRowById", d)) b(m).before(g.join("")),
  2374. m = m.rowIndex - 1
  2375. } !0 === this.p.subGrid && b(this).jqGrid("addSubGrid", h + n, m);
  2376. this.p.records++;
  2377. this.p.reccount++;
  2378. b(this).triggerHandler("jqGridAfterInsertRow", [e, M, M]);
  2379. Y && this.p.afterInsertRow.call(this, e, M, M);
  2380. O++;
  2381. "local" === this.p.datatype && (K[this.p.localReader.id] = W, this.p._index[W] = this.p.data.length, this.p.data.push(K), K = {})
  2382. } !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) {
  2383. 1 === a % 2 ? b(this).addClass(U) : b(this).removeClass(U)
  2384. }));
  2385. this.updatepager(!0, !0);
  2386. a = !0
  2387. }));
  2388. return a
  2389. },
  2390. footerData: function (e, f, c) {
  2391. function d(a) {
  2392. for (var b in a) if (a.hasOwnProperty(b)) return !1;
  2393. return !0
  2394. }
  2395. var a, l = !1,
  2396. g = {},
  2397. h;
  2398. void 0 == e && (e = "get");
  2399. "boolean" !== typeof c && (c = !0);
  2400. e = e.toLowerCase();
  2401. this.each(function () {
  2402. var k = this,
  2403. n;
  2404. if (!k.grid || !k.p.footerrow || "set" === e && d(f)) return !1;
  2405. l = !0;
  2406. b(this.p.colModel).each(function (d) {
  2407. a = this.name;
  2408. "set" === e ? void 0 !== f[a] && (n = c ? k.formatter("", f[a], d, f, "edit") : f[a], h = this.title ? {
  2409. title: b.jgrid.stripHtml(n)
  2410. } : {},
  2411. 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())
  2412. })
  2413. });
  2414. return "get" === e ? g : l
  2415. },
  2416. showHideCol: function (e, f) {
  2417. return this.each(function () {
  2418. var c = this,
  2419. d = !1,
  2420. a = b.jgrid.cell_width ? 0 : c.p.cellLayout,
  2421. l;
  2422. if (c.grid) {
  2423. "string" === typeof e && (e = [e]);
  2424. f = "none" !== f ? "" : "none";
  2425. var g = "" === f ? !0 : !1,
  2426. h = c.p.groupHeader && ("object" === typeof c.p.groupHeader || b.isFunction(c.p.groupHeader));
  2427. h && b(c).jqGrid("destroyGroupHeader", !1);
  2428. b(this.p.colModel).each(function (h) {
  2429. if (-1 !== b.inArray(this.name, e) && this.hidden === g) {
  2430. if (!0 === c.p.frozenColumns && !0 === this.frozen) return !0;
  2431. b("tr[role=rowheader]", c.grid.hDiv).each(function () {
  2432. b(this.cells[h]).css("display", f)
  2433. });
  2434. b(c.rows).each(function () {
  2435. b(this).hasClass("jqgroup") || b(this.cells[h]).css("display", f)
  2436. });
  2437. c.p.footerrow && b("tr.footrow td:eq(" + h + ")", c.grid.sDiv).css("display", f);
  2438. l = parseInt(this.width, 10);
  2439. c.p.tblwidth = "none" === f ? c.p.tblwidth - (l + a) : c.p.tblwidth + (l + a);
  2440. this.hidden = !g;
  2441. d = !0;
  2442. b(c).triggerHandler("jqGridShowHideCol", [g, this.name, h])
  2443. }
  2444. }); !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));
  2445. h && b(c).jqGrid("setGroupHeaders", c.p.groupHeader)
  2446. }
  2447. })
  2448. },
  2449. hideCol: function (e) {
  2450. return this.each(function () {
  2451. b(this).jqGrid("showHideCol", e, "none")
  2452. })
  2453. },
  2454. showCol: function (e) {
  2455. return this.each(function () {
  2456. b(this).jqGrid("showHideCol", e, "")
  2457. })
  2458. },
  2459. remapColumns: function (e, f, c) {
  2460. function d(a) {
  2461. var c;
  2462. c = a.length ? b.makeArray(a) : b.extend({},
  2463. a);
  2464. b.each(e,
  2465. function (b) {
  2466. a[b] = c[this]
  2467. })
  2468. }
  2469. function a(a, c) {
  2470. b(">tr" + (c || ""), a).each(function () {
  2471. var a = this,
  2472. c = b.makeArray(a.cells);
  2473. b.each(e,
  2474. function () {
  2475. var b = c[this];
  2476. b && a.appendChild(b)
  2477. })
  2478. })
  2479. }
  2480. var l = this.get(0);
  2481. d(l.p.colModel);
  2482. d(l.p.colNames);
  2483. d(l.grid.headers);
  2484. a(b("thead:first", l.grid.hDiv), c && ":not(.ui-jqgrid-labels)");
  2485. f && a(b("#" + b.jgrid.jqID(l.p.id) + " tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
  2486. l.p.footerrow && a(b("tbody:first", l.grid.sDiv));
  2487. l.p.remapColumns && (l.p.remapColumns.length ? d(l.p.remapColumns) : l.p.remapColumns = b.makeArray(e));
  2488. l.p.lastsort = b.inArray(l.p.lastsort, e);
  2489. l.p.treeGrid && (l.p.expColInd = b.inArray(l.p.expColInd, e));
  2490. b(l).triggerHandler("jqGridRemapColumns", [e, f, c])
  2491. },
  2492. setGridWidth: function (e, f) {
  2493. return this.each(function () {
  2494. if (this.grid) {
  2495. var c = this,
  2496. d, a = 0,
  2497. l = b.jgrid.cell_width ? 0 : c.p.cellLayout,
  2498. g,
  2499. h = 0,
  2500. k = !1,
  2501. n = c.p.scrollOffset,
  2502. m,
  2503. r = 0,
  2504. p;
  2505. "boolean" !== typeof f && (f = c.p.shrinkToFit);
  2506. if (!isNaN(e)) {
  2507. e = parseInt(e, 10);
  2508. c.grid.width = c.p.width = e;
  2509. b("#gbox_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
  2510. b("#gview_" + b.jgrid.jqID(c.p.id)).css("width", e + "px");
  2511. b(c.grid.bDiv).css("width", e + "px");
  2512. b(c.grid.hDiv).css("width", e + "px");
  2513. c.p.pager && b(c.p.pager).css("width", e + "px");
  2514. 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"));
  2515. c.p.footerrow && b(c.grid.sDiv).css("width", e + "px"); !1 === f && !0 === c.p.forceFit && (c.p.forceFit = !1);
  2516. if (!0 === f) {
  2517. b.each(c.p.colModel,
  2518. function () {
  2519. !1 === this.hidden && (d = this.widthOrg, a += d + l, this.fixed ? r += d + l : h++)
  2520. });
  2521. if (0 === h) return;
  2522. c.p.tblwidth = a;
  2523. 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);
  2524. var a = 0,
  2525. q = 0 < c.grid.cols.length;
  2526. b.each(c.p.colModel,
  2527. function (b) {
  2528. !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))
  2529. });
  2530. if (!g) return;
  2531. p = 0;
  2532. 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));
  2533. c.p.colModel[g].width += p;
  2534. c.p.tblwidth = a + p + l * h + r;
  2535. 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;
  2536. c.grid.headers[g].width = d;
  2537. c.grid.headers[g].el.style.width = d + "px";
  2538. q && (c.grid.cols[g].style.width = d + "px");
  2539. c.p.footerrow && (c.grid.footers[g].style.width = d + "px")
  2540. }
  2541. 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"))
  2542. }
  2543. }
  2544. })
  2545. },
  2546. setGridHeight: function (e) {
  2547. return this.each(function () {
  2548. if (this.grid) {
  2549. var f = b(this.grid.bDiv);
  2550. f.css({
  2551. height: e + (isNaN(e) ? "" : "px")
  2552. }); !0 === this.p.frozenColumns && b("#" + b.jgrid.jqID(this.p.id) + "_frozen").parent().height(f.height() - 16);
  2553. this.p.height = e;
  2554. this.p.scroll && this.grid.populateVisible()
  2555. }
  2556. })
  2557. },
  2558. setCaption: function (e) {
  2559. return this.each(function () {
  2560. this.p.caption = e;
  2561. b("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl", this.grid.cDiv).html(e);
  2562. b(this.grid.cDiv).show()
  2563. })
  2564. },
  2565. setLabel: function (e, f, c, d) {
  2566. return this.each(function () {
  2567. var a = -1;
  2568. if (this.grid && void 0 !== e && (b(this.p.colModel).each(function (b) {
  2569. if (this.name === e) return a = b,
  2570. !1
  2571. }), 0 <= a)) {
  2572. var l = b("tr.ui-jqgrid-labels th:eq(" + a + ")", this.grid.hDiv);
  2573. if (f) {
  2574. var g = b(".s-ico", l);
  2575. b("[id^=jqgh_]", l).empty().html(f).append(g);
  2576. this.p.colNames[a] = f
  2577. }
  2578. c && ("string" === typeof c ? b(l).addClass(c) : b(l).css(c));
  2579. "object" === typeof d && b(l).attr(d)
  2580. }
  2581. })
  2582. },
  2583. setCell: function (e, f, c, d, a, l) {
  2584. return this.each(function () {
  2585. var g = -1,
  2586. h, k;
  2587. if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
  2588. if (this.name === f) return g = a,
  2589. !1
  2590. }) : g = parseInt(f, 10), 0 <= g && (h = b(this).jqGrid("getGridRowById", e)))) {
  2591. var n = b("td:eq(" + g + ")", h);
  2592. if ("" !== c || !0 === l) h = this.formatter(e, c, g, h, "edit"),
  2593. k = this.p.colModel[g].title ? {
  2594. title: b.jgrid.stripHtml(h)
  2595. } : {},
  2596. this.p.treeGrid && 0 < b(".tree-wrap", b(n)).length ? b("span", b(n)).html(h).attr(k) : b(n).html(h).attr(k),
  2597. "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));
  2598. "string" === typeof d ? b(n).addClass(d) : d && b(n).css(d);
  2599. "object" === typeof a && b(n).attr(a)
  2600. }
  2601. })
  2602. },
  2603. getCell: function (e, f) {
  2604. var c = !1;
  2605. this.each(function () {
  2606. var d = -1;
  2607. if (this.grid && (isNaN(f) ? b(this.p.colModel).each(function (a) {
  2608. if (this.name === f) return d = a,
  2609. !1
  2610. }) : d = parseInt(f, 10), 0 <= d)) {
  2611. var a = b(this).jqGrid("getGridRowById", e);
  2612. if (a) try {
  2613. c = b.unformat.call(this, b("td:eq(" + d + ")", a), {
  2614. rowId: a.id,
  2615. colModel: this.p.colModel[d]
  2616. },
  2617. d)
  2618. } catch (l) {
  2619. c = b.jgrid.htmlDecode(b("td:eq(" + d + ")", a).html())
  2620. }
  2621. }
  2622. });
  2623. return c
  2624. },
  2625. getCol: function (e, f, c) {
  2626. var d = [],
  2627. a,
  2628. l = 0,
  2629. g,
  2630. h,
  2631. k;
  2632. f = "boolean" !== typeof f ? !1 : f;
  2633. void 0 === c && (c = !1);
  2634. this.each(function () {
  2635. var n = -1;
  2636. if (this.grid && (isNaN(e) ? b(this.p.colModel).each(function (a) {
  2637. if (this.name === e) return n = a,
  2638. !1
  2639. }) : n = parseInt(e, 10), 0 <= n)) {
  2640. var m = this.rows.length,
  2641. r = 0,
  2642. p = 0;
  2643. if (m && 0 < m) {
  2644. for (; r < m;) {
  2645. if (b(this.rows[r]).hasClass("jqgrow")) {
  2646. try {
  2647. a = b.unformat.call(this, b(this.rows[r].cells[n]), {
  2648. rowId: this.rows[r].id,
  2649. colModel: this.p.colModel[n]
  2650. },
  2651. n)
  2652. } catch (q) {
  2653. a = b.jgrid.htmlDecode(this.rows[r].cells[n].innerHTML)
  2654. }
  2655. 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({
  2656. id: this.rows[r].id,
  2657. value: a
  2658. }) : d.push(a)
  2659. }
  2660. r++
  2661. }
  2662. if (c) switch (c.toLowerCase()) {
  2663. case "sum":
  2664. d = l;
  2665. break;
  2666. case "avg":
  2667. d = l / p;
  2668. break;
  2669. case "count":
  2670. d = m - 1;
  2671. break;
  2672. case "min":
  2673. d = g;
  2674. break;
  2675. case "max":
  2676. d = h
  2677. }
  2678. }
  2679. }
  2680. });
  2681. return d
  2682. },
  2683. clearGridData: function (e) {
  2684. return this.each(function () {
  2685. if (this.grid) {
  2686. "boolean" !== typeof e && (e = !1);
  2687. if (this.p.deepempty) b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:gt(0)").remove();
  2688. else {
  2689. var f = b("#" + b.jgrid.jqID(this.p.id) + " tbody:first tr:first")[0];
  2690. b("#" + b.jgrid.jqID(this.p.id) + " tbody:first").empty().append(f)
  2691. }
  2692. this.p.footerrow && e && b(".ui-jqgrid-ftable td", this.grid.sDiv).html("&#160;");
  2693. this.p.selrow = null;
  2694. this.p.selarrrow = [];
  2695. this.p.savedRow = [];
  2696. this.p.records = 0;
  2697. this.p.page = 1;
  2698. this.p.lastpage = 0;
  2699. this.p.reccount = 0;
  2700. this.p.data = [];
  2701. this.p._index = {};
  2702. this.updatepager(!0, !1)
  2703. }
  2704. })
  2705. },
  2706. getInd: function (e, f) {
  2707. var c = !1,
  2708. d;
  2709. this.each(function () {
  2710. (d = b(this).jqGrid("getGridRowById", e)) && (c = !0 === f ? d : d.rowIndex)
  2711. });
  2712. return c
  2713. },
  2714. bindKeys: function (e) {
  2715. var f = b.extend({
  2716. onEnter: null,
  2717. onSpace: null,
  2718. onLeftKey: null,
  2719. onRightKey: null,
  2720. scrollingRows: !0
  2721. },
  2722. e || {});
  2723. return this.each(function () {
  2724. var c = this;
  2725. b("body").is("[role]") || b("body").attr("role", "application");
  2726. c.p.scrollrows = f.scrollingRows;
  2727. b(c).keydown(function (d) {
  2728. var a = b(c).find("tr[tabindex=0]")[0],
  2729. e,
  2730. g,
  2731. h,
  2732. k = c.p.treeReader.expanded_field;
  2733. 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) {
  2734. if (38 === d.keyCode) {
  2735. g = a.previousSibling;
  2736. e = "";
  2737. if (g) if (b(g).is(":hidden")) for (; g;) {
  2738. if (g = g.previousSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
  2739. e = g.id;
  2740. break
  2741. }
  2742. } else e = g.id;
  2743. b(c).jqGrid("setSelection", e, !0, d);
  2744. d.preventDefault()
  2745. }
  2746. if (40 === d.keyCode) {
  2747. g = a.nextSibling;
  2748. e = "";
  2749. if (g) if (b(g).is(":hidden")) for (; g;) {
  2750. if (g = g.nextSibling, !b(g).is(":hidden") && b(g).hasClass("jqgrow")) {
  2751. e = g.id;
  2752. break
  2753. }
  2754. } else e = g.id;
  2755. b(c).jqGrid("setSelection", e, !0, d);
  2756. d.preventDefault()
  2757. }
  2758. 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));
  2759. 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))
  2760. } 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))
  2761. })
  2762. })
  2763. },
  2764. unbindKeys: function () {
  2765. return this.each(function () {
  2766. b(this).unbind("keydown")
  2767. })
  2768. },
  2769. getLocalRow: function (e) {
  2770. var f = !1,
  2771. c;
  2772. this.each(function () {
  2773. void 0 !== e && (c = this.p._index[b.jgrid.stripPref(this.p.idPrefix, e)], 0 <= c && (f = this.p.data[c]))
  2774. });
  2775. return f
  2776. }
  2777. })
  2778. })(jQuery); (function (a) {
  2779. a.fmatter = {};
  2780. a.extend(a.fmatter, {
  2781. isBoolean: function (a) {
  2782. return "boolean" === typeof a
  2783. },
  2784. isObject: function (c) {
  2785. return c && ("object" === typeof c || a.isFunction(c)) || !1
  2786. },
  2787. isString: function (a) {
  2788. return "string" === typeof a
  2789. },
  2790. isNumber: function (a) {
  2791. return "number" === typeof a && isFinite(a)
  2792. },
  2793. isValue: function (a) {
  2794. return this.isObject(a) || this.isString(a) || this.isNumber(a) || this.isBoolean(a)
  2795. },
  2796. isEmpty: function (c) {
  2797. if (!this.isString(c) && this.isValue(c)) return !1;
  2798. if (!this.isValue(c)) return !0;
  2799. c = a.trim(c).replace(/\&nbsp\;/ig, "").replace(/\&#160\;/ig, "");
  2800. return "" === c
  2801. }
  2802. });
  2803. a.fn.fmatter = function (c, b, d, e, f) {
  2804. var g = b;
  2805. d = a.extend({},
  2806. a.jgrid.formatter, d);
  2807. try {
  2808. g = a.fn.fmatter[c].call(this, b, d, e, f)
  2809. } catch (h) { }
  2810. return g
  2811. };
  2812. a.fmatter.util = {
  2813. NumberFormat: function (c, b) {
  2814. a.fmatter.isNumber(c) || (c *= 1);
  2815. if (a.fmatter.isNumber(c)) {
  2816. var d = 0 > c,
  2817. e = String(c),
  2818. f = b.decimalSeparator || ".",
  2819. g;
  2820. if (a.fmatter.isNumber(b.decimalPlaces)) {
  2821. var h = b.decimalPlaces,
  2822. e = Math.pow(10, h),
  2823. e = String(Math.round(c * e) / e);
  2824. g = e.lastIndexOf(".");
  2825. if (0 < h) for (0 > g ? (e += f, g = e.length - 1) : "." !== f && (e = e.replace(".", f)) ; e.length - 1 - g < h;) e += "0"
  2826. }
  2827. if (b.thousandsSeparator) {
  2828. h = b.thousandsSeparator;
  2829. g = e.lastIndexOf(f);
  2830. g = -1 < g ? g : e.length;
  2831. var f = e.substring(g),
  2832. l = -1,
  2833. k;
  2834. for (k = g; 0 < k; k--) l++,
  2835. 0 === l % 3 && k !== g && (!d || 1 < k) && (f = h + f),
  2836. f = e.charAt(k - 1) + f;
  2837. e = f
  2838. }
  2839. e = b.prefix ? b.prefix + e : e;
  2840. return e = b.suffix ? e + b.suffix : e
  2841. }
  2842. return c
  2843. }
  2844. };
  2845. a.fn.fmatter.defaultFormat = function (c, b) {
  2846. return a.fmatter.isValue(c) && "" !== c ? c : b.defaultValue || "&#160;"
  2847. };
  2848. a.fn.fmatter.email = function (c, b) {
  2849. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : '<a href="mailto:' + c + '">' + c + "</a>"
  2850. };
  2851. a.fn.fmatter.checkbox = function (c, b) {
  2852. var d = a.extend({},
  2853. b.checkbox),
  2854. e;
  2855. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2856. d, b.colModel.formatoptions));
  2857. e = !0 === d.disabled ? 'disabled="disabled"' : "";
  2858. if (a.fmatter.isEmpty(c) || void 0 === c) c = a.fn.fmatter.defaultFormat(c, d);
  2859. c = String(c);
  2860. c = (c + "").toLowerCase();
  2861. return '<input type="checkbox" ' + (0 > c.search(/(false|f|0|no|n|off|undefined)/i) ? " checked='checked' " : "") + ' value="' + c + '" offval="no" ' + e + "/>"
  2862. };
  2863. a.fn.fmatter.link = function (c, b) {
  2864. var d = {
  2865. target: b.target
  2866. },
  2867. e = "";
  2868. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2869. d, b.colModel.formatoptions));
  2870. d.target && (e = "target=" + d.target);
  2871. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : "<a " + e + ' href="' + c + '">' + c + "</a>"
  2872. };
  2873. a.fn.fmatter.showlink = function (c, b) {
  2874. var d = {
  2875. baseLinkUrl: b.baseLinkUrl,
  2876. showAction: b.showAction,
  2877. addParam: b.addParam || "",
  2878. target: b.target,
  2879. idName: b.idName
  2880. },
  2881. e = "";
  2882. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2883. d, b.colModel.formatoptions));
  2884. d.target && (e = "target=" + d.target);
  2885. d = d.baseLinkUrl + d.showAction + "?" + d.idName + "=" + b.rowId + d.addParam;
  2886. return a.fmatter.isString(c) || a.fmatter.isNumber(c) ? "<a " + e + ' href="' + d + '">' + c + "</a>" : a.fn.fmatter.defaultFormat(c, b)
  2887. };
  2888. a.fn.fmatter.integer = function (c, b) {
  2889. var d = a.extend({},
  2890. b.integer);
  2891. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2892. d, b.colModel.formatoptions));
  2893. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2894. };
  2895. a.fn.fmatter.number = function (c, b) {
  2896. var d = a.extend({},
  2897. b.number);
  2898. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2899. d, b.colModel.formatoptions));
  2900. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2901. };
  2902. a.fn.fmatter.currency = function (c, b) {
  2903. var d = a.extend({},
  2904. b.currency);
  2905. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2906. d, b.colModel.formatoptions));
  2907. return a.fmatter.isEmpty(c) ? d.defaultValue : a.fmatter.util.NumberFormat(c, d)
  2908. };
  2909. a.fn.fmatter.date = function (c, b, d, e) {
  2910. d = a.extend({},
  2911. b.date);
  2912. void 0 !== b.colModel && void 0 !== b.colModel.formatoptions && (d = a.extend({},
  2913. d, b.colModel.formatoptions));
  2914. 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)
  2915. };
  2916. a.fn.fmatter.select = function (c, b) {
  2917. c = String(c);
  2918. var d = !1,
  2919. e = [],
  2920. f,
  2921. g;
  2922. 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);
  2923. if (d) {
  2924. var h = !0 === b.colModel.editoptions.multiple ? !0 : !1,
  2925. l = [];
  2926. h && (l = c.split(","), l = a.map(l,
  2927. function (b) {
  2928. return a.trim(b)
  2929. }));
  2930. if (a.fmatter.isString(d)) {
  2931. var k = d.split(g),
  2932. m = 0,
  2933. n;
  2934. for (n = 0; n < k.length; n++) if (g = k[n].split(f), 2 < g.length && (g[1] = a.map(g,
  2935. function (a, b) {
  2936. if (0 < b) return a
  2937. }).join(f)), h) -1 < a.inArray(g[0], l) && (e[m] = g[1], m++);
  2938. else if (a.trim(g[0]) === a.trim(c)) {
  2939. e[0] = g[1];
  2940. break
  2941. }
  2942. } else a.fmatter.isObject(d) && (h ? e = a.map(l,
  2943. function (a) {
  2944. return d[a]
  2945. }) : e[0] = d[c] || "")
  2946. }
  2947. c = e.join(", ");
  2948. return "" === c ? a.fn.fmatter.defaultFormat(c, b) : c
  2949. };
  2950. a.fn.fmatter.rowactions = function (c) {
  2951. var b = a(this).closest("tr.jqgrow"),
  2952. d = b.attr("id"),
  2953. e = a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/, "$1"),
  2954. e = a("#" + e),
  2955. f = e[0],
  2956. g = f.p,
  2957. h = g.colModel[a.jgrid.getCellIndex(this)],
  2958. l = h.frozen ? a("tr#" + d + " td:eq(" + a.jgrid.getCellIndex(this) + ") > div", e) : a(this).parent(),
  2959. k = {
  2960. extraparam: {}
  2961. },
  2962. m = function (b) {
  2963. a.isFunction(k.afterRestore) && k.afterRestore.call(f, b);
  2964. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2965. l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
  2966. };
  2967. void 0 !== h.formatoptions && (k = a.extend(k, h.formatoptions));
  2968. void 0 !== g.editOptions && (k.editOptions = g.editOptions);
  2969. void 0 !== g.delOptions && (k.delOptions = g.delOptions);
  2970. b.hasClass("jqgrid-new-row") && (k.extraparam[g.prmNames.oper] = g.prmNames.addoper);
  2971. b = {
  2972. keys: k.keys,
  2973. oneditfunc: k.onEdit,
  2974. successfunc: k.onSuccess,
  2975. url: k.url,
  2976. extraparam: k.extraparam,
  2977. aftersavefunc: function (b, c) {
  2978. a.isFunction(k.afterSave) && k.afterSave.call(f, b, c);
  2979. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  2980. l.find("div.ui-inline-save,div.ui-inline-cancel").hide()
  2981. },
  2982. errorfunc: k.onError,
  2983. afterrestorefunc: m,
  2984. restoreAfterError: k.restoreAfterError,
  2985. mtype: k.mtype
  2986. };
  2987. switch (c) {
  2988. case "edit":
  2989. e.jqGrid("editRow", d, b);
  2990. l.find("div.ui-inline-edit,div.ui-inline-del").hide();
  2991. l.find("div.ui-inline-save,div.ui-inline-cancel").show();
  2992. e.triggerHandler("jqGridAfterGridComplete");
  2993. break;
  2994. case "save":
  2995. 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"));
  2996. break;
  2997. case "cancel":
  2998. e.jqGrid("restoreRow", d, m);
  2999. l.find("div.ui-inline-edit,div.ui-inline-del").show();
  3000. l.find("div.ui-inline-save,div.ui-inline-cancel").hide();
  3001. e.triggerHandler("jqGridAfterGridComplete");
  3002. break;
  3003. case "del":
  3004. e.jqGrid("delGridRow", d, k.delOptions);
  3005. break;
  3006. case "formedit":
  3007. e.jqGrid("setSelection", d),
  3008. e.jqGrid("editGridRow", d, k.editOptions)
  3009. }
  3010. };
  3011. a.fn.fmatter.actions = function (c, b) {
  3012. var d = {
  3013. keys: !1,
  3014. editbutton: !0,
  3015. delbutton: !0,
  3016. editformbutton: !1
  3017. },
  3018. e = b.rowId,
  3019. f = "";
  3020. void 0 !== b.colModel.formatoptions && (d = a.extend(d, b.colModel.formatoptions));
  3021. if (void 0 === e || a.fmatter.isEmpty(e)) return "";
  3022. 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>");
  3023. 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>");
  3024. 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>";
  3025. 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>";
  3026. return "<div style='margin-left:8px;'>" + f + "</div>"
  3027. };
  3028. a.unformat = function (c, b, d, e) {
  3029. var f, g = b.colModel.formatter,
  3030. h = b.colModel.formatoptions || {},
  3031. l = /([\.\*\_\'\(\)\{\}\+\?\\])/g,
  3032. k = b.colModel.unformat || a.fn.fmatter[g] && a.fn.fmatter[g].unformat;
  3033. if (void 0 !== k && a.isFunction(k)) f = k.call(this, a(c).text(), b, c);
  3034. else if (void 0 !== g && a.fmatter.isString(g)) switch (f = a.jgrid.formatter || {},
  3035. g) {
  3036. case "integer":
  3037. h = a.extend({},
  3038. f.integer, h);
  3039. b = h.thousandsSeparator.replace(l, "\\$1");
  3040. b = RegExp(b, "g");
  3041. f = a(c).text().replace(b, "");
  3042. break;
  3043. case "number":
  3044. h = a.extend({},
  3045. f.number, h);
  3046. b = h.thousandsSeparator.replace(l, "\\$1");
  3047. b = RegExp(b, "g");
  3048. f = a(c).text().replace(b, "").replace(h.decimalSeparator, ".");
  3049. break;
  3050. case "currency":
  3051. h = a.extend({},
  3052. f.currency, h);
  3053. b = h.thousandsSeparator.replace(l, "\\$1");
  3054. b = RegExp(b, "g");
  3055. f = a(c).text();
  3056. h.prefix && h.prefix.length && (f = f.substr(h.prefix.length));
  3057. h.suffix && h.suffix.length && (f = f.substr(0, f.length - h.suffix.length));
  3058. f = f.replace(b, "").replace(h.decimalSeparator, ".");
  3059. break;
  3060. case "checkbox":
  3061. h = b.colModel.editoptions ? b.colModel.editoptions.value.split(":") : ["Yes", "No"];
  3062. f = a("input", c).is(":checked") ? h[0] : h[1];
  3063. break;
  3064. case "select":
  3065. f = a.unformat.select(c, b, d, e);
  3066. break;
  3067. case "actions":
  3068. return "";
  3069. default:
  3070. f = a(c).text()
  3071. }
  3072. return void 0 !== f ? f : !0 === e ? a(c).text() : a.jgrid.htmlDecode(a(c).html())
  3073. };
  3074. a.unformat.select = function (c, b, d, e) {
  3075. d = [];
  3076. c = a(c).text();
  3077. if (!0 === e) return c;
  3078. e = a.extend({},
  3079. void 0 !== b.colModel.formatoptions ? b.colModel.formatoptions : b.colModel.editoptions);
  3080. b = void 0 === e.separator ? ":" : e.separator;
  3081. var f = void 0 === e.delimiter ? ";" : e.delimiter;
  3082. if (e.value) {
  3083. var g = e.value;
  3084. e = !0 === e.multiple ? !0 : !1;
  3085. var h = [];
  3086. e && (h = c.split(","), h = a.map(h,
  3087. function (b) {
  3088. return a.trim(b)
  3089. }));
  3090. if (a.fmatter.isString(g)) {
  3091. var l = g.split(f),
  3092. k = 0,
  3093. m;
  3094. for (m = 0; m < l.length; m++) if (f = l[m].split(b), 2 < f.length && (f[1] = a.map(f,
  3095. function (a, b) {
  3096. if (0 < b) return a
  3097. }).join(b)), e) -1 < a.inArray(f[1], h) && (d[k] = f[0], k++);
  3098. else if (a.trim(f[1]) === a.trim(c)) {
  3099. d[0] = f[0];
  3100. break
  3101. }
  3102. } else if (a.fmatter.isObject(g) || a.isArray(g)) e || (h[0] = c),
  3103. d = a.map(h,
  3104. function (b) {
  3105. var c;
  3106. a.each(g,
  3107. function (a, d) {
  3108. if (d === b) return c = a,
  3109. !1
  3110. });
  3111. if (void 0 !== c) return c
  3112. });
  3113. return d.join(", ")
  3114. }
  3115. return c || ""
  3116. };
  3117. a.unformat.date = function (c, b) {
  3118. var d = a.jgrid.formatter.date || {};
  3119. void 0 !== b.formatoptions && (d = a.extend({},
  3120. d, b.formatoptions));
  3121. return a.fmatter.isEmpty(c) ? a.fn.fmatter.defaultFormat(c, b) : a.jgrid.parseDate(d.newformat, c, d.srcformat, d)
  3122. }
  3123. })(jQuery); (function (a) {
  3124. a.jgrid.extend({
  3125. getColProp: function (a) {
  3126. var c = {},
  3127. d = this[0];
  3128. if (!d.grid) return !1;
  3129. var d = d.p.colModel,
  3130. h;
  3131. for (h = 0; h < d.length; h++) if (d[h].name === a) {
  3132. c = d[h];
  3133. break
  3134. }
  3135. return c
  3136. },
  3137. setColProp: function (b, c) {
  3138. return this.each(function () {
  3139. if (this.grid && c) {
  3140. var d = this.p.colModel,
  3141. h;
  3142. for (h = 0; h < d.length; h++) if (d[h].name === b) {
  3143. a.extend(!0, this.p.colModel[h], c);
  3144. break
  3145. }
  3146. }
  3147. })
  3148. },
  3149. sortGrid: function (a, c, d) {
  3150. return this.each(function () {
  3151. var h = -1,
  3152. k, e = !1;
  3153. if (this.grid) {
  3154. a || (a = this.p.sortname);
  3155. for (k = 0; k < this.p.colModel.length; k++) if (this.p.colModel[k].index === a || this.p.colModel[k].name === a) {
  3156. h = k; !0 === this.p.frozenColumns && !0 === this.p.colModel[k].frozen && (e = this.grid.fhDiv.find("#" + this.p.id + "_" + a));
  3157. break
  3158. } -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))
  3159. }
  3160. })
  3161. },
  3162. clearBeforeUnload: function () {
  3163. return this.each(function () {
  3164. var b = this.grid;
  3165. a.isFunction(b.emptyRows) && b.emptyRows.call(this, !0, !0);
  3166. a(document).unbind("mouseup.jqGrid" + this.p.id);
  3167. a(b.hDiv).unbind("mousemove");
  3168. a(this).unbind();
  3169. b.dragEnd = null;
  3170. b.dragMove = null;
  3171. b.dragStart = null;
  3172. b.emptyRows = null;
  3173. b.populate = null;
  3174. b.populateVisible = null;
  3175. b.scrollGrid = null;
  3176. b.selectionPreserver = null;
  3177. b.bDiv = null;
  3178. b.cDiv = null;
  3179. b.hDiv = null;
  3180. b.cols = null;
  3181. var c, d = b.headers.length;
  3182. for (c = 0; c < d; c++) b.headers[c].el = null;
  3183. this.grid = this.addJSONData = this.addXmlData = this.formatter = this.constructTr = this.setHeadCheckBox = this.refreshIndex = this.updatepager = this.sortData = this.formatCol = null
  3184. })
  3185. },
  3186. GridDestroy: function () {
  3187. return this.each(function () {
  3188. if (this.grid) {
  3189. this.p.pager && a(this.p.pager).remove();
  3190. try {
  3191. a(this).jqGrid("clearBeforeUnload"),
  3192. a("#gbox_" + a.jgrid.jqID(this.id)).remove()
  3193. } catch (b) { }
  3194. }
  3195. })
  3196. },
  3197. GridUnload: function () {
  3198. return this.each(function () {
  3199. if (this.grid) {
  3200. var b = a(this).attr("id"),
  3201. c = a(this).attr("class");
  3202. this.p.pager && a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");
  3203. var d = document.createElement("table");
  3204. a(d).attr({
  3205. id: b
  3206. });
  3207. d.className = c;
  3208. b = a.jgrid.jqID(this.id);
  3209. a(d).removeClass("ui-jqgrid-btable");
  3210. 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();
  3211. a(this).jqGrid("clearBeforeUnload");
  3212. a("#gbox_" + b).remove()
  3213. }
  3214. })
  3215. },
  3216. setGridState: function (b) {
  3217. return this.each(function () {
  3218. 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"))
  3219. })
  3220. },
  3221. filterToolbar: function (b) {
  3222. b = a.extend({
  3223. autosearch: !0,
  3224. searchOnEnter: !0,
  3225. beforeSearch: null,
  3226. afterSearch: null,
  3227. beforeClear: null,
  3228. afterClear: null,
  3229. searchurl: "",
  3230. stringResult: !1,
  3231. groupOp: "AND",
  3232. defaultSearch: "bw",
  3233. searchOperators: !1,
  3234. resetIcon: "x",
  3235. operands: {
  3236. eq: "==",
  3237. ne: "!",
  3238. lt: "<",
  3239. le: "<=",
  3240. gt: ">",
  3241. ge: ">=",
  3242. bw: "^",
  3243. bn: "!^",
  3244. "in": "=",
  3245. ni: "!=",
  3246. ew: "|",
  3247. en: "!@",
  3248. cn: "~",
  3249. nc: "!~",
  3250. nu: "#",
  3251. nn: "!#"
  3252. }
  3253. },
  3254. a.jgrid.search, b || {});
  3255. return this.each(function () {
  3256. var c = this;
  3257. if (!this.ftoolbar) {
  3258. var d = function () {
  3259. var d = {},
  3260. f = 0,
  3261. g, m, e = {},
  3262. q;
  3263. a.each(c.p.colModel,
  3264. function () {
  3265. var l = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
  3266. m = this.index || this.name;
  3267. 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;
  3268. 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,
  3269. e[m] = q,
  3270. f++;
  3271. else try {
  3272. delete c.p.postData[m]
  3273. } catch (k) { }
  3274. });
  3275. var k = 0 < f ? !0 : !1;
  3276. if (!0 === b.stringResult || "local" === c.p.datatype) {
  3277. var l = '{"groupOp":"' + b.groupOp + '","rules":[',
  3278. n = 0;
  3279. a.each(d,
  3280. function (a, b) {
  3281. 0 < n && (l += ",");
  3282. l += '{"field":"' + a + '",';
  3283. l += '"op":"' + e[a] + '",';
  3284. l += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
  3285. n++
  3286. });
  3287. l += "]}";
  3288. a.extend(c.p.postData, {
  3289. filters: l
  3290. });
  3291. a.each(["searchField", "searchString", "searchOper"],
  3292. function (a, b) {
  3293. c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
  3294. })
  3295. } else a.extend(c.p.postData, d);
  3296. var r;
  3297. c.p.searchurl && (r = c.p.url, a(c).jqGrid("setGridParam", {
  3298. url: c.p.searchurl
  3299. }));
  3300. var h = "stop" === a(c).triggerHandler("jqGridToolbarBeforeSearch") ? !0 : !1; !h && a.isFunction(b.beforeSearch) && (h = b.beforeSearch.call(c));
  3301. h || a(c).jqGrid("setGridParam", {
  3302. search: k
  3303. }).trigger("reloadGrid", [{
  3304. page: 1
  3305. }]);
  3306. r && a(c).jqGrid("setGridParam", {
  3307. url: r
  3308. });
  3309. a(c).triggerHandler("jqGridToolbarAfterSearch");
  3310. a.isFunction(b.afterSearch) && b.afterSearch.call(c)
  3311. },
  3312. h = function (e, f, g) {
  3313. a("#sopt_menu").remove();
  3314. f = parseInt(f, 10);
  3315. g = parseInt(g, 10) + 18;
  3316. 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;">';
  3317. g = a(e).attr("soper");
  3318. var k, h = [],
  3319. q,
  3320. p = 0,
  3321. l = a(e).attr("colname");
  3322. for (k = c.p.colModel.length; p < k && c.p.colModel[p].name !== l;) p++;
  3323. p = c.p.colModel[p];
  3324. l = a.extend({},
  3325. p.searchoptions);
  3326. l.sopt || (l.sopt = [], l.sopt[0] = "select" === p.stype ? "eq" : b.defaultSearch);
  3327. a.each(b.odata,
  3328. function () {
  3329. h.push(this.oper)
  3330. });
  3331. for (p = 0; p < l.sopt.length; p++) q = a.inArray(l.sopt[p], h),
  3332. -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>");
  3333. f += "</ul>";
  3334. a("body").append(f);
  3335. a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");
  3336. a("#sopt_menu > li > a").hover(function () {
  3337. a(this).addClass("ui-state-hover")
  3338. },
  3339. function () {
  3340. a(this).removeClass("ui-state-hover")
  3341. }).click(function (f) {
  3342. f = a(this).attr("value");
  3343. var g = a(this).attr("oper");
  3344. a(c).triggerHandler("jqGridToolbarSelectOper", [f, g, e]);
  3345. a("#sopt_menu").hide();
  3346. 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())
  3347. })
  3348. },
  3349. k = a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),
  3350. e;
  3351. a.each(c.p.colModel,
  3352. function (h) {
  3353. var f = this,
  3354. g, m;
  3355. m = "";
  3356. var x = "=",
  3357. q, p = a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-" + c.p.direction + "'></th>"),
  3358. l = a("<div style='position:relative;height:100%;padding-right:0.3em;padding-left:0.3em;'></div>"),
  3359. 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");
  3360. this.search = !1 === this.search ? !1 : !0;
  3361. void 0 === this.stype && (this.stype = "text");
  3362. g = a.extend({},
  3363. this.searchoptions || {});
  3364. if (this.search) {
  3365. if (b.searchOperators) {
  3366. m = g.sopt ? g.sopt[0] : "select" === f.stype ? "eq" : b.defaultSearch;
  3367. for (q = 0; q < b.odata.length; q++) if (b.odata[q].oper === m) {
  3368. x = b.operands[m] || "";
  3369. break
  3370. }
  3371. m = "<a title='" + (null != g.searchtitle ? g.searchtitle : b.operandTitle) + "' style='padding-right: 0.5em;' soper='" + m + "' class='soptclass' colname='" + this.name + "'>" + x + "</a>"
  3372. }
  3373. a("td:eq(0)", n).attr("colindex", h).append(m);
  3374. void 0 === g.clearSearch && (g.clearSearch = !0);
  3375. 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();
  3376. switch (this.stype) {
  3377. case "select":
  3378. if (m = this.surl || g.dataUrl) a(l).append(n),
  3379. a.ajax(a.extend({
  3380. url: m,
  3381. dataType: "html",
  3382. success: function (e) {
  3383. void 0 !== g.buildSelect ? (e = g.buildSelect(e)) && a("td:eq(1)", n).append(e) : a("td:eq(1)", n).append(e);
  3384. void 0 !== g.defaultValue && a("select", l).val(g.defaultValue);
  3385. a("select", l).attr({
  3386. name: f.index || f.name,
  3387. id: "gs_" + f.name
  3388. });
  3389. g.attr && a("select", l).attr(g.attr);
  3390. a("select", l).css({
  3391. width: "100%"
  3392. });
  3393. a.jgrid.bindEv.call(c, a("select", l)[0], g); !0 === b.autosearch && a("select", l).change(function () {
  3394. d();
  3395. return !1
  3396. });
  3397. e = null
  3398. }
  3399. },
  3400. a.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
  3401. else {
  3402. var r, w, u;
  3403. 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);
  3404. if (r) {
  3405. var t = document.createElement("select");
  3406. t.style.width = "100%";
  3407. a(t).attr({
  3408. name: f.index || f.name,
  3409. id: "gs_" + f.name
  3410. });
  3411. var v;
  3412. if ("string" === typeof r) for (m = r.split(u), v = 0; v < m.length; v++) r = m[v].split(w),
  3413. u = document.createElement("option"),
  3414. u.value = r[0],
  3415. u.innerHTML = r[1],
  3416. t.appendChild(u);
  3417. 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));
  3418. void 0 !== g.defaultValue && a(t).val(g.defaultValue);
  3419. g.attr && a(t).attr(g.attr);
  3420. a(l).append(n);
  3421. a.jgrid.bindEv.call(c, t, g);
  3422. a("td:eq(1)", n).append(t); !0 === b.autosearch && a(t).change(function () {
  3423. d();
  3424. return !1
  3425. })
  3426. }
  3427. }
  3428. break;
  3429. case "text":
  3430. w = void 0 !== g.defaultValue ? g.defaultValue : "";
  3431. 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 + "'/>");
  3432. a(l).append(n);
  3433. g.attr && a("input", l).attr(g.attr);
  3434. a.jgrid.bindEv.call(c, a("input", l)[0], g); !0 === b.autosearch && (b.searchOnEnter ? a("input", l).keypress(function (a) {
  3435. return 13 === (a.charCode || a.keyCode || 0) ? (d(), !1) : this
  3436. }) : a("input", l).keydown(function (a) {
  3437. switch (a.which) {
  3438. case 13:
  3439. return !1;
  3440. case 9:
  3441. case 16:
  3442. case 37:
  3443. case 38:
  3444. case 39:
  3445. case 40:
  3446. case 27:
  3447. break;
  3448. default:
  3449. e && clearTimeout(e),
  3450. e = setTimeout(function () {
  3451. d()
  3452. },
  3453. 500)
  3454. }
  3455. }));
  3456. break;
  3457. case "custom":
  3458. a("td:eq(1)", n).append("<span style='width:95%;padding:0px;' name='" + (f.index || f.name) + "' id='gs_" + f.name + "'/>");
  3459. a(l).append(n);
  3460. try {
  3461. 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"),
  3462. a(l).find(">span").append(t);
  3463. else throw "e2";
  3464. else throw "e1";
  3465. } catch (y) {
  3466. "e1" === y && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  3467. "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)
  3468. }
  3469. }
  3470. }
  3471. a(p).append(l);
  3472. a(k).append(p);
  3473. b.searchOperators || a("td:eq(0)", n).hide()
  3474. });
  3475. a("table thead", c.grid.hDiv).append(k);
  3476. b.searchOperators && (a(".soptclass", k).click(function (b) {
  3477. var c = a(this).offset();
  3478. h(this, c.left, c.top);
  3479. b.stopPropagation()
  3480. }), a("body").on("click",
  3481. function (b) {
  3482. "soptclass" !== b.target.className && a("#sopt_menu").hide()
  3483. }));
  3484. a(".clearsearchclass", k).click(function (e) {
  3485. e = a(this).parents("tr:first");
  3486. var f = parseInt(a("td.ui-search-oper", e).attr("colindex"), 10),
  3487. g = a.extend({},
  3488. c.p.colModel[f].searchoptions || {}),
  3489. g = g.defaultValue ? g.defaultValue : "";
  3490. "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()
  3491. });
  3492. this.ftoolbar = !0;
  3493. this.triggerToolbar = d;
  3494. this.clearToolbar = function (d) {
  3495. var f = {},
  3496. g = 0,
  3497. e;
  3498. d = "boolean" !== typeof d ? !0 : d;
  3499. a.each(c.p.colModel,
  3500. function () {
  3501. var b, d = a("#gs_" + a.jgrid.jqID(this.name), !0 === this.frozen && !0 === c.p.frozenColumns ? c.grid.fhDiv : c.grid.hDiv);
  3502. this.searchoptions && void 0 !== this.searchoptions.defaultValue && (b = this.searchoptions.defaultValue);
  3503. e = this.index || this.name;
  3504. switch (this.stype) {
  3505. case "select":
  3506. d.find("option").each(function (c) {
  3507. 0 === c && (this.selected = !0);
  3508. if (a(this).val() === b) return this.selected = !0,
  3509. !1
  3510. });
  3511. if (void 0 !== b) f[e] = b,
  3512. g++;
  3513. else try {
  3514. delete c.p.postData[e]
  3515. } catch (h) { }
  3516. break;
  3517. case "text":
  3518. d.val(b || "");
  3519. if (void 0 !== b) f[e] = b,
  3520. g++;
  3521. else try {
  3522. delete c.p.postData[e]
  3523. } catch (k) { }
  3524. break;
  3525. case "custom":
  3526. 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 || "")
  3527. }
  3528. });
  3529. var k = 0 < g ? !0 : !1;
  3530. c.p.resetsearch = !0;
  3531. if (!0 === b.stringResult || "local" === c.p.datatype) {
  3532. var h = '{"groupOp":"' + b.groupOp + '","rules":[',
  3533. p = 0;
  3534. a.each(f,
  3535. function (a, b) {
  3536. 0 < p && (h += ",");
  3537. h += '{"field":"' + a + '",';
  3538. h += '"op":"eq",';
  3539. h += '"data":"' + (b + "").replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"}';
  3540. p++
  3541. });
  3542. h += "]}";
  3543. a.extend(c.p.postData, {
  3544. filters: h
  3545. });
  3546. a.each(["searchField", "searchString", "searchOper"],
  3547. function (a, b) {
  3548. c.p.postData.hasOwnProperty(b) && delete c.p.postData[b]
  3549. })
  3550. } else a.extend(c.p.postData, f);
  3551. var l;
  3552. c.p.searchurl && (l = c.p.url, a(c).jqGrid("setGridParam", {
  3553. url: c.p.searchurl
  3554. }));
  3555. var n = "stop" === a(c).triggerHandler("jqGridToolbarBeforeClear") ? !0 : !1; !n && a.isFunction(b.beforeClear) && (n = b.beforeClear.call(c));
  3556. n || d && a(c).jqGrid("setGridParam", {
  3557. search: k
  3558. }).trigger("reloadGrid", [{
  3559. page: 1
  3560. }]);
  3561. l && a(c).jqGrid("setGridParam", {
  3562. url: l
  3563. });
  3564. a(c).triggerHandler("jqGridToolbarAfterClear");
  3565. a.isFunction(b.afterClear) && b.afterClear()
  3566. };
  3567. this.toggleToolbar = function () {
  3568. var b = a("tr.ui-search-toolbar", c.grid.hDiv),
  3569. d = !0 === c.p.frozenColumns ? a("tr.ui-search-toolbar", c.grid.fhDiv) : !1;
  3570. "none" === b.css("display") ? (b.show(), d && d.show()) : (b.hide(), d && d.hide())
  3571. }
  3572. }
  3573. })
  3574. },
  3575. destroyFilterToolbar: function () {
  3576. return this.each(function () {
  3577. this.ftoolbar && (this.toggleToolbar = this.clearToolbar = this.triggerToolbar = null, this.ftoolbar = !1, a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())
  3578. })
  3579. },
  3580. destroyGroupHeader: function (b) {
  3581. void 0 === b && (b = !0);
  3582. return this.each(function () {
  3583. var c, d, h, k, e, s;
  3584. d = this.grid;
  3585. var f = a("table.ui-jqgrid-htable thead", d.hDiv),
  3586. g = this.p.colModel;
  3587. if (d) {
  3588. a(this).unbind(".setGroupHeaders");
  3589. c = a("<tr>", {
  3590. role: "rowheader"
  3591. }).addClass("ui-jqgrid-labels");
  3592. k = d.headers;
  3593. d = 0;
  3594. for (h = k.length; d < h; d++) {
  3595. e = g[d].hidden ? "none" : "";
  3596. e = a(k[d].el).width(k[d].width).css("display", e);
  3597. try {
  3598. e.removeAttr("rowSpan")
  3599. } catch (m) {
  3600. e.attr("rowSpan", 1)
  3601. }
  3602. c.append(e);
  3603. s = e.children("span.ui-jqgrid-resize");
  3604. 0 < s.length && (s[0].style.height = "");
  3605. e.children("div")[0].style.top = ""
  3606. }
  3607. a(f).children("tr.ui-jqgrid-labels").remove();
  3608. a(f).prepend(c); !0 === b && a(this).jqGrid("setGridParam", {
  3609. groupHeader: null
  3610. })
  3611. }
  3612. })
  3613. },
  3614. setGroupHeaders: function (b) {
  3615. b = a.extend({
  3616. useColSpanStyle: !1,
  3617. groupHeaders: []
  3618. },
  3619. b || {});
  3620. return this.each(function () {
  3621. this.p.groupHeader = b;
  3622. var c, d, h = 0,
  3623. k, e, s, f, g, m = this.p.colModel,
  3624. x = m.length,
  3625. q = this.grid.headers,
  3626. p = a("table.ui-jqgrid-htable", this.grid.hDiv),
  3627. l = p.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");
  3628. k = p.children("thead");
  3629. var n = p.find(".jqg-first-row-header");
  3630. void 0 === n[0] ? n = a("<tr>", {
  3631. role: "row",
  3632. "aria-hidden": "true"
  3633. }).addClass("jqg-first-row-header").css("height", "auto") : n.empty();
  3634. var r, w = function (a, b) {
  3635. var c = b.length,
  3636. d;
  3637. for (d = 0; d < c; d++) if (b[d].startColumnName === a) return d;
  3638. return -1
  3639. };
  3640. a(this).prepend(k);
  3641. k = a("<tr>", {
  3642. role: "rowheader"
  3643. }).addClass("ui-jqgrid-labels jqg-third-row-header");
  3644. for (c = 0; c < x; c++) if (s = q[c].el, f = a(s), d = m[c], e = {
  3645. height: "0px",
  3646. width: q[c].width + "px",
  3647. display: d.hidden ? "none" : ""
  3648. },
  3649. a("<th>", {
  3650. role: "gridcell"
  3651. }).css(e).addClass("ui-first-th-" + this.p.direction).appendTo(n), s.style.width = "", e = w(d.name, b.groupHeaders), 0 <= e) {
  3652. e = b.groupHeaders[e];
  3653. h = e.numberOfColumns;
  3654. g = e.titleText;
  3655. for (e = d = 0; e < h && c + e < x; e++) m[c + e].hidden || d++;
  3656. e = a("<th>").attr({
  3657. role: "columnheader"
  3658. }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).css({
  3659. height: "28px",
  3660. "border-top": "0 none"
  3661. }).html(g);
  3662. 0 < d && e.attr("colspan", String(d));
  3663. this.p.headertitles && e.attr("title", e.text());
  3664. 0 === d && e.hide();
  3665. f.before(e);
  3666. k.append(s);
  3667. h -= 1
  3668. } else 0 === h ? b.useColSpanStyle ? f.attr("rowspan", "2") : (a("<th>", {
  3669. role: "columnheader"
  3670. }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).css({
  3671. display: d.hidden ? "none" : "",
  3672. "border-top": "0 none"
  3673. }).insertBefore(f), k.append(s)) : (k.append(s), h--);
  3674. m = a(this).children("thead");
  3675. m.prepend(n);
  3676. k.insertAfter(l);
  3677. p.append(m);
  3678. b.useColSpanStyle && (p.find("span.ui-jqgrid-resize").each(function () {
  3679. var b = a(this).parent();
  3680. b.is(":visible") && (this.style.cssText = "height: " + b.height() + "px !important; cursor: col-resize;")
  3681. }), p.find("div.ui-jqgrid-sortable").each(function () {
  3682. var b = a(this),
  3683. c = b.parent();
  3684. c.is(":visible") && c.is(":has(span.ui-jqgrid-resize)") && b.css("top", (c.height() - b.outerHeight()) / 2 - 2 + "px")
  3685. }));
  3686. r = m.find("tr.jqg-first-row-header");
  3687. a(this).bind("jqGridResizeStop.setGroupHeaders",
  3688. function (a, b, c) {
  3689. r.find("th").eq(c).width(b)
  3690. })
  3691. })
  3692. },
  3693. setFrozenColumns: function () {
  3694. return this.each(function () {
  3695. if (this.grid) {
  3696. var b = this,
  3697. c = b.p.colModel,
  3698. d = 0,
  3699. h = c.length,
  3700. k = -1,
  3701. e = !1;
  3702. if (!0 !== b.p.subGrid && !0 !== b.p.treeGrid && !0 !== b.p.cellEdit && !b.p.sortable && !b.p.scroll) {
  3703. b.p.rownumbers && d++;
  3704. for (b.p.multiselect && d++; d < h;) {
  3705. if (!0 === c[d].frozen) e = !0,
  3706. k = d;
  3707. else break;
  3708. d++
  3709. }
  3710. if (0 <= k && e) {
  3711. c = b.p.caption ? a(b.grid.cDiv).outerHeight() : 0;
  3712. d = a(".ui-jqgrid-htable", "#gview_" + a.jgrid.jqID(b.p.id)).height();
  3713. 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());
  3714. 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>');
  3715. 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>');
  3716. a("#gview_" + a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);
  3717. c = a(".ui-jqgrid-htable", "#gview_" + a.jgrid.jqID(b.p.id)).clone(!0);
  3718. if (b.p.groupHeader) {
  3719. a("tr.jqg-first-row-header, tr.jqg-third-row-header", c).each(function () {
  3720. a("th:gt(" + k + ")", this).remove()
  3721. });
  3722. var s = -1,
  3723. f = -1,
  3724. g, m;
  3725. a("tr.jqg-second-row-header th", c).each(function () {
  3726. g = parseInt(a(this).attr("colspan"), 10);
  3727. if (m = parseInt(a(this).attr("rowspan"), 10)) s++,
  3728. f++;
  3729. g && (s += g, f++);
  3730. if (s === k) return !1
  3731. });
  3732. s !== k && (f = k);
  3733. a("tr.jqg-second-row-header", c).each(function () {
  3734. a("th:gt(" + f + ")", this).remove()
  3735. })
  3736. } else a("tr", c).each(function () {
  3737. a("th:gt(" + k + ")", this).remove()
  3738. });
  3739. a(c).width(1);
  3740. a(b.grid.fhDiv).append(c).mousemove(function (a) {
  3741. if (b.grid.resizing) return b.grid.dragMove(a),
  3742. !1
  3743. });
  3744. a(b).bind("jqGridResizeStop.setFrozenColumns",
  3745. function (c, d, e) {
  3746. c = a(".ui-jqgrid-htable", b.grid.fhDiv);
  3747. a("th:eq(" + e + ")", c).width(d);
  3748. c = a(".ui-jqgrid-btable", b.grid.fbDiv);
  3749. a("tr:first td:eq(" + e + ")", c).width(d)
  3750. });
  3751. a(b).bind("jqGridSortCol.setFrozenColumns",
  3752. function (c, d, e) {
  3753. c = a("tr.ui-jqgrid-labels:last th:eq(" + b.p.lastsort + ")", b.grid.fhDiv);
  3754. d = a("tr.ui-jqgrid-labels:last th:eq(" + e + ")", b.grid.fhDiv);
  3755. a("span.ui-grid-ico-sort", c).addClass("ui-state-disabled");
  3756. a(c).attr("aria-selected", "false");
  3757. a("span.ui-icon-" + b.p.sortorder, d).removeClass("ui-state-disabled");
  3758. a(d).attr("aria-selected", "true");
  3759. b.p.viewsortcols[0] || b.p.lastsort === e || (a("span.s-ico", c).hide(), a("span.s-ico", d).show())
  3760. });
  3761. a("#gview_" + a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);
  3762. a(b.grid.bDiv).scroll(function () {
  3763. a(b.grid.fbDiv).scrollTop(a(this).scrollTop())
  3764. }); !0 === b.p.hoverrows && a("#" + a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");
  3765. a(b).bind("jqGridAfterGridComplete.setFrozenColumns",
  3766. function () {
  3767. a("#" + a.jgrid.jqID(b.p.id) + "_frozen").remove();
  3768. a(b.grid.fbDiv).height(a(b.grid.bDiv).height() - 16);
  3769. var c = a("#" + a.jgrid.jqID(b.p.id)).clone(!0);
  3770. a("tr[role=row]", c).each(function () {
  3771. a("td[role=gridcell]:gt(" + k + ")", this).remove()
  3772. });
  3773. a(c).width(1).attr("id", b.p.id + "_frozen");
  3774. a(b.grid.fbDiv).append(c); !0 === b.p.hoverrows && (a("tr.jqgrow", c).hover(function () {
  3775. a(this).addClass("ui-state-hover");
  3776. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id)).addClass("ui-state-hover")
  3777. },
  3778. function () {
  3779. a(this).removeClass("ui-state-hover");
  3780. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id)).removeClass("ui-state-hover")
  3781. }), a("tr.jqgrow", "#" + a.jgrid.jqID(b.p.id)).hover(function () {
  3782. a(this).addClass("ui-state-hover");
  3783. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id) + "_frozen").addClass("ui-state-hover")
  3784. },
  3785. function () {
  3786. a(this).removeClass("ui-state-hover");
  3787. a("#" + a.jgrid.jqID(this.id), "#" + a.jgrid.jqID(b.p.id) + "_frozen").removeClass("ui-state-hover")
  3788. }));
  3789. c = null
  3790. });
  3791. b.grid.hDiv.loading || a(b).triggerHandler("jqGridAfterGridComplete");
  3792. b.p.frozenColumns = !0
  3793. }
  3794. }
  3795. }
  3796. })
  3797. },
  3798. destroyFrozenColumns: function () {
  3799. return this.each(function () {
  3800. if (this.grid && !0 === this.p.frozenColumns) {
  3801. a(this.grid.fhDiv).remove();
  3802. a(this.grid.fbDiv).remove();
  3803. this.grid.fhDiv = null;
  3804. this.grid.fbDiv = null;
  3805. a(this).unbind(".setFrozenColumns");
  3806. if (!0 === this.p.hoverrows) {
  3807. var b;
  3808. a("#" + a.jgrid.jqID(this.p.id)).bind("mouseover",
  3809. function (c) {
  3810. b = a(c.target).closest("tr.jqgrow");
  3811. "ui-subgrid" !== a(b).attr("class") && a(b).addClass("ui-state-hover")
  3812. }).bind("mouseout",
  3813. function (c) {
  3814. b = a(c.target).closest("tr.jqgrow");
  3815. a(b).removeClass("ui-state-hover")
  3816. })
  3817. }
  3818. this.p.frozenColumns = !1
  3819. }
  3820. })
  3821. }
  3822. })
  3823. })(jQuery); (function (a) {
  3824. a.extend(a.jgrid, {
  3825. showModal: function (a) {
  3826. a.w.show()
  3827. },
  3828. closeModal: function (a) {
  3829. a.w.hide().attr("aria-hidden", "true");
  3830. a.o && a.o.remove()
  3831. },
  3832. hideModal: function (d, b) {
  3833. b = a.extend({
  3834. jqm: !0,
  3835. gb: ""
  3836. },
  3837. b || {});
  3838. if (b.onClose) {
  3839. 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);
  3840. if ("boolean" === typeof c && !c) return
  3841. }
  3842. if (a.fn.jqm && !0 === b.jqm) a(d).attr("aria-hidden", "true").jqmHide();
  3843. else {
  3844. if ("" !== b.gb) try {
  3845. a(".jqgrid-overlay:first", b.gb).hide()
  3846. } catch (g) { }
  3847. a(d).hide().attr("aria-hidden", "true")
  3848. }
  3849. },
  3850. findPos: function (a) {
  3851. var b = 0,
  3852. c = 0;
  3853. if (a.offsetParent) {
  3854. do b += a.offsetLeft,
  3855. c += a.offsetTop;
  3856. while (a = a.offsetParent)
  3857. }
  3858. return [b, c]
  3859. },
  3860. createModal: function (d, b, c, g, e, h, f) {
  3861. c = a.extend(!0, {},
  3862. a.jgrid.jqModal || {},
  3863. c);
  3864. var k = document.createElement("div"),
  3865. l,
  3866. m = this;
  3867. f = a.extend({},
  3868. f || {});
  3869. l = "rtl" === a(c.gbox).attr("dir") ? !0 : !1;
  3870. k.className = "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
  3871. k.id = d.themodal;
  3872. var n = document.createElement("div");
  3873. n.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
  3874. n.id = d.modalhead;
  3875. a(n).append("<span class='ui-jqdialog-title'>" + c.caption + "</span>");
  3876. var q = a("<a class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function () {
  3877. q.addClass("ui-state-hover")
  3878. },
  3879. function () {
  3880. q.removeClass("ui-state-hover")
  3881. }).append("<span class='ui-icon ui-icon-closethick'></span>");
  3882. a(n).append(q);
  3883. 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"));
  3884. var p = document.createElement("div");
  3885. a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id", d.modalcontent);
  3886. a(p).append(b);
  3887. k.appendChild(p);
  3888. a(k).prepend(n); !0 === h ? a("body").append(k) : "string" === typeof h ? a(h).append(k) : a(k).insertBefore(g);
  3889. a(k).css(f);
  3890. void 0 === c.jqModal && (c.jqModal = !0);
  3891. b = {};
  3892. 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),
  3893. b.top = c.top + "px",
  3894. b.left = c.left;
  3895. else if (0 !== c.left || 0 !== c.top) b.left = c.left,
  3896. b.top = c.top + "px";
  3897. a("a.ui-jqdialog-titlebar-close", n).click(function () {
  3898. var b = a("#" + a.jgrid.jqID(d.themodal)).data("onClose") || c.onClose,
  3899. e = a("#" + a.jgrid.jqID(d.themodal)).data("gbox") || c.gbox;
  3900. m.hideModal("#" + a.jgrid.jqID(d.themodal), {
  3901. gb: e,
  3902. jqm: c.jqModal,
  3903. onClose: b
  3904. });
  3905. return !1
  3906. });
  3907. 0 !== c.width && c.width || (c.width = 300);
  3908. 0 !== c.height && c.height || (c.height = 200);
  3909. c.zIndex || (g = a(g).parents("*[role=dialog]").filter(":first").css("z-index"), c.zIndex = g ? parseInt(g, 10) + 2 : 950);
  3910. g = 0;
  3911. 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));
  3912. b.left && (b.left += "px");
  3913. a(k).css(a.extend({
  3914. width: isNaN(c.width) ? "auto" : c.width + "px",
  3915. height: isNaN(c.height) ? "auto" : c.height + "px",
  3916. zIndex: c.zIndex,
  3917. overflow: "hidden"
  3918. },
  3919. b)).attr({
  3920. tabIndex: "-1",
  3921. role: "dialog",
  3922. "aria-labelledby": d.modalhead,
  3923. "aria-hidden": "true"
  3924. });
  3925. void 0 === c.drag && (c.drag = !0);
  3926. void 0 === c.resize && (c.resize = !0);
  3927. if (c.drag) if (a(n).css("cursor", "move"), a.fn.jqDrag) a(k).jqDrag(n);
  3928. else try {
  3929. a(k).draggable({
  3930. handle: a("#" + a.jgrid.jqID(n.id))
  3931. })
  3932. } catch (r) { }
  3933. 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>"),
  3934. a("#" + a.jgrid.jqID(d.themodal)).jqResize(".jqResize", d.scrollelm ? "#" + a.jgrid.jqID(d.scrollelm) : !1);
  3935. else try {
  3936. a(k).resizable({
  3937. handles: "se, sw",
  3938. alsoResize: d.scrollelm ? "#" + a.jgrid.jqID(d.scrollelm) : !1
  3939. })
  3940. } catch (s) { } !0 === c.closeOnEscape && a(k).keydown(function (b) {
  3941. 27 == b.which && (b = a("#" + a.jgrid.jqID(d.themodal)).data("onClose") || c.onClose, m.hideModal("#" + a.jgrid.jqID(d.themodal), {
  3942. gb: c.gbox,
  3943. jqm: c.jqModal,
  3944. onClose: b
  3945. }))
  3946. })
  3947. },
  3948. viewModal: function (d, b) {
  3949. b = a.extend({
  3950. toTop: !0,
  3951. overlay: 10,
  3952. modal: !1,
  3953. overlayClass: "ui-widget-overlay",
  3954. onShow: a.jgrid.showModal,
  3955. onHide: a.jgrid.closeModal,
  3956. gbox: "",
  3957. jqm: !0,
  3958. jqM: !0
  3959. },
  3960. b || {});
  3961. 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();
  3962. else {
  3963. "" !== b.gbox && (a(".jqgrid-overlay:first", b.gbox).show(), a(d).data("gbox", b.gbox));
  3964. a(d).show().attr("aria-hidden", "false");
  3965. try {
  3966. a(":input:visible", d)[0].focus()
  3967. } catch (c) { }
  3968. }
  3969. },
  3970. info_dialog: function (d, b, c, g) {
  3971. var e = {
  3972. width: 290,
  3973. height: "auto",
  3974. dataheight: "auto",
  3975. drag: !0,
  3976. resize: !1,
  3977. left: 250,
  3978. top: 170,
  3979. zIndex: 1E3,
  3980. jqModal: !0,
  3981. modal: !1,
  3982. closeOnEscape: !0,
  3983. align: "center",
  3984. buttonalign: "center",
  3985. buttons: []
  3986. };
  3987. a.extend(!0, e, a.jgrid.jqModal || {},
  3988. {
  3989. caption: "<b>" + d + "</b>"
  3990. },
  3991. g || {});
  3992. var h = e.jqModal,
  3993. f = this;
  3994. a.fn.jqm && !h && (h = !1);
  3995. d = "";
  3996. 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),
  3997. d += "<a id='" + e.buttons[g].id + "' class='fm-button ui-state-default ui-corner-all'>" + e.buttons[g].text + "</a>";
  3998. g = isNaN(e.dataheight) ? e.dataheight : e.dataheight + "px";
  3999. 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>");
  4000. 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>" : "";
  4001. b += "</div>";
  4002. try {
  4003. "false" === a("#info_dialog").attr("aria-hidden") && a.jgrid.hideModal("#info_dialog", {
  4004. jqm: h
  4005. }),
  4006. a("#info_dialog").remove()
  4007. } catch (k) { }
  4008. a.jgrid.createModal({
  4009. themodal: "info_dialog",
  4010. modalhead: "info_head",
  4011. modalcontent: "info_content",
  4012. scrollelm: "infocnt"
  4013. },
  4014. b, e, "", "", !0);
  4015. d && a.each(e.buttons,
  4016. function (b) {
  4017. a("#" + a.jgrid.jqID(this.id), "#info_id").bind("click",
  4018. function () {
  4019. e.buttons[b].onClick.call(a("#info_dialog"));
  4020. return !1
  4021. })
  4022. });
  4023. a("#closedialog", "#info_id").click(function () {
  4024. f.hideModal("#info_dialog", {
  4025. jqm: h,
  4026. onClose: a("#info_dialog").data("onClose") || e.onClose,
  4027. gb: a("#info_dialog").data("gbox") || e.gbox
  4028. });
  4029. return !1
  4030. });
  4031. a(".fm-button", "#info_dialog").hover(function () {
  4032. a(this).addClass("ui-state-hover")
  4033. },
  4034. function () {
  4035. a(this).removeClass("ui-state-hover")
  4036. });
  4037. a.isFunction(e.beforeOpen) && e.beforeOpen();
  4038. a.jgrid.viewModal("#info_dialog", {
  4039. onHide: function (a) {
  4040. a.w.hide().remove();
  4041. a.o && a.o.remove()
  4042. },
  4043. modal: e.modal,
  4044. jqm: h
  4045. });
  4046. a.isFunction(e.afterOpen) && e.afterOpen();
  4047. try {
  4048. a("#info_dialog").focus()
  4049. } catch (l) { }
  4050. },
  4051. bindEv: function (d, b) {
  4052. a.isFunction(b.dataInit) && b.dataInit.call(this, d, b);
  4053. b.dataEvents && a.each(b.dataEvents,
  4054. function () {
  4055. void 0 !== this.data ? a(d).bind(this.type, this.data, this.fn) : a(d).bind(this.type, this.fn)
  4056. })
  4057. },
  4058. createEl: function (d, b, c, g, e) {
  4059. function h(b, d, c) {
  4060. var e = "dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr custom_element custom_value".split(" ");
  4061. void 0 !== c && a.isArray(c) && a.merge(e, c);
  4062. a.each(d,
  4063. function (d, c) {
  4064. -1 === a.inArray(d, e) && a(b).attr(d, c)
  4065. });
  4066. d.hasOwnProperty("id") || a(b).attr("id", a.jgrid.randId())
  4067. }
  4068. var f = "",
  4069. k = this;
  4070. switch (d) {
  4071. case "textarea":
  4072. f = document.createElement("textarea");
  4073. g ? b.cols || a(f).css({
  4074. width: "100%"
  4075. }) : b.cols || (b.cols = 20);
  4076. b.rows || (b.rows = 2);
  4077. if ("&nbsp;" === c || "&#160;" === c || 1 === c.length && 160 === c.charCodeAt(0)) c = "";
  4078. f.value = c;
  4079. h(f, b);
  4080. a(f).attr({
  4081. role: "textbox",
  4082. multiline: "true"
  4083. });
  4084. break;
  4085. case "checkbox":
  4086. f = document.createElement("input");
  4087. f.type = "checkbox";
  4088. 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"));
  4089. h(f, b, ["value"]);
  4090. a(f).attr("role", "checkbox");
  4091. break;
  4092. case "select":
  4093. f = document.createElement("select");
  4094. f.setAttribute("role", "select");
  4095. g = []; !0 === b.multiple ? (d = !0, f.multiple = "multiple", a(f).attr("aria-multiselectable", "true")) : d = !1;
  4096. if (void 0 !== b.dataUrl) {
  4097. d = b.name ? String(b.id).substring(0, String(b.id).length - String(b.name).length - 1) : String(b.id);
  4098. var l = b.postData || e.postData;
  4099. k.p && k.p.idPrefix && (d = a.jgrid.stripPref(k.p.idPrefix, d));
  4100. a.ajax(a.extend({
  4101. url: a.isFunction(b.dataUrl) ? b.dataUrl.call(k, d, c, String(b.name)) : b.dataUrl,
  4102. type: "GET",
  4103. dataType: "html",
  4104. data: a.isFunction(l) ? l.call(k, d, c, String(b.name)) : l,
  4105. context: {
  4106. elem: f,
  4107. options: b,
  4108. vl: c
  4109. },
  4110. success: function (b) {
  4111. var d = [],
  4112. c = this.elem,
  4113. e = this.vl,
  4114. f = a.extend({},
  4115. this.options),
  4116. g = !0 === f.multiple;
  4117. b = a.isFunction(f.buildSelect) ? f.buildSelect.call(k, b) : b;
  4118. "string" === typeof b && (b = a(a.trim(b)).html());
  4119. 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,
  4120. function (b) {
  4121. return a.trim(b)
  4122. })) : d[0] = a.trim(e), setTimeout(function () {
  4123. a("option", c).each(function (b) {
  4124. 0 === b && c.multiple && (this.selected = !1);
  4125. a(this).attr("role", "option");
  4126. if (-1 < a.inArray(a.trim(a(this).text()), d) || -1 < a.inArray(a.trim(a(this).val()), d)) this.selected = "selected"
  4127. })
  4128. },
  4129. 0))
  4130. }
  4131. },
  4132. e || {}))
  4133. } else if (b.value) {
  4134. var m;
  4135. void 0 === b.size && (b.size = d ? 3 : 1);
  4136. d && (g = c.split(","), g = a.map(g,
  4137. function (b) {
  4138. return a.trim(b)
  4139. }));
  4140. "function" === typeof b.value && (b.value = b.value());
  4141. var n, q, p = void 0 === b.separator ? ":" : b.separator;
  4142. e = void 0 === b.delimiter ? ";" : b.delimiter;
  4143. if ("string" === typeof b.value) for (n = b.value.split(e), m = 0; m < n.length; m++) q = n[m].split(p),
  4144. 2 < q.length && (q[1] = a.map(q,
  4145. function (a, b) {
  4146. if (0 < b) return a
  4147. }).join(p)),
  4148. e = document.createElement("option"),
  4149. e.setAttribute("role", "option"),
  4150. e.value = q[0],
  4151. e.innerHTML = q[1],
  4152. f.appendChild(e),
  4153. d || a.trim(q[0]) !== a.trim(c) && a.trim(q[1]) !== a.trim(c) || (e.selected = "selected"),
  4154. d && (-1 < a.inArray(a.trim(q[1]), g) || -1 < a.inArray(a.trim(q[0]), g)) && (e.selected = "selected");
  4155. 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"));
  4156. h(f, b, ["value"])
  4157. }
  4158. break;
  4159. case "text":
  4160. case "password":
  4161. case "button":
  4162. m = "button" === d ? "button" : "textbox";
  4163. f = document.createElement("input");
  4164. f.type = d;
  4165. f.value = c;
  4166. h(f, b);
  4167. "button" !== d && (g ? b.size || a(f).css({
  4168. width: "100%"
  4169. }) : b.size || (b.size = 20));
  4170. a(f).attr("role", m);
  4171. break;
  4172. case "image":
  4173. case "file":
  4174. f = document.createElement("input");
  4175. f.type = d;
  4176. h(f, b);
  4177. break;
  4178. case "custom":
  4179. f = document.createElement("span");
  4180. try {
  4181. if (a.isFunction(b.custom_element)) if (p = b.custom_element.call(k, c, b)) p = a(p).addClass("customelement").attr({
  4182. id: b.id,
  4183. name: b.name
  4184. }),
  4185. a(f).empty().append(p);
  4186. else throw "e2";
  4187. else throw "e1";
  4188. } catch (r) {
  4189. "e1" === r && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_element' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  4190. "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)
  4191. }
  4192. }
  4193. return f
  4194. },
  4195. checkDate: function (a, b) {
  4196. var c = {},
  4197. g;
  4198. a = a.toLowerCase();
  4199. g = -1 !== a.indexOf("/") ? "/" : -1 !== a.indexOf("-") ? "-" : -1 !== a.indexOf(".") ? "." : "/";
  4200. a = a.split(g);
  4201. b = b.split(g);
  4202. if (3 !== b.length) return !1;
  4203. var e = -1,
  4204. h, f = g = -1,
  4205. k;
  4206. for (k = 0; k < a.length; k++) h = isNaN(b[k]) ? 0 : parseInt(b[k], 10),
  4207. c[a[k]] = h,
  4208. h = a[k],
  4209. -1 !== h.indexOf("y") && (e = k),
  4210. -1 !== h.indexOf("m") && (f = k),
  4211. -1 !== h.indexOf("d") && (g = k);
  4212. h = "y" === a[e] || "yyyy" === a[e] ? 4 : "yy" === a[e] ? 2 : -1;
  4213. k = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  4214. var l;
  4215. if (-1 === e) return !1;
  4216. l = c[a[e]].toString();
  4217. 2 === h && 1 === l.length && (h = 1);
  4218. if (l.length !== h || 0 === c[a[e]] && "00" !== b[e] || -1 === f) return !1;
  4219. l = c[a[f]].toString();
  4220. if (1 > l.length || 1 > c[a[f]] || 12 < c[a[f]] || -1 === g) return !1;
  4221. l = c[a[g]].toString();
  4222. if (!(h = 1 > l.length) && !(h = 1 > c[a[g]]) && !(h = 31 < c[a[g]])) {
  4223. if (h = 2 === c[a[f]]) e = c[a[e]],
  4224. h = c[a[g]] > (0 !== e % 4 || 0 === e % 100 && 0 !== e % 400 ? 28 : 29);
  4225. h = h || c[a[g]] > k[c[a[f]]]
  4226. }
  4227. return h ? !1 : !0
  4228. },
  4229. isEmpty: function (a) {
  4230. return a.match(/^\s+$/) || "" === a ? !0 : !1
  4231. },
  4232. checkTime: function (d) {
  4233. var b = /^(\d{1,2}):(\d{2})([apAP][Mm])?$/;
  4234. if (!a.jgrid.isEmpty(d)) if (d = d.match(b)) {
  4235. if (d[3]) {
  4236. if (1 > d[1] || 12 < d[1]) return !1
  4237. } else if (23 < d[1]) return !1;
  4238. if (59 < d[2]) return !1
  4239. } else return !1;
  4240. return !0
  4241. },
  4242. checkValues: function (d, b, c, g) {
  4243. var e, h, f;
  4244. f = this.p.colModel;
  4245. if (void 0 === c) if ("string" === typeof b) for (c = 0, g = f.length; c < g; c++) {
  4246. if (f[c].name === b) {
  4247. e = f[c].editrules;
  4248. b = c;
  4249. null != f[c].formoptions && (h = f[c].formoptions.label);
  4250. break
  4251. }
  4252. } else 0 <= b && (e = f[b].editrules);
  4253. else e = c,
  4254. h = void 0 === g ? "_" : g;
  4255. if (e) {
  4256. h || (h = null != this.p.colNames ? this.p.colNames[b] : f[b].label);
  4257. if (!0 === e.required && a.jgrid.isEmpty(d)) return [!1, h + ": " + a.jgrid.edit.msg.required, ""];
  4258. c = !1 === e.required ? !1 : !0;
  4259. if (!0 === e.number && (!1 !== c || !a.jgrid.isEmpty(d)) && isNaN(d)) return [!1, h + ": " + a.jgrid.edit.msg.number, ""];
  4260. if (void 0 !== e.minValue && !isNaN(e.minValue) && parseFloat(d) < parseFloat(e.minValue)) return [!1, h + ": " + a.jgrid.edit.msg.minValue + " " + e.minValue, ""];
  4261. if (void 0 !== e.maxValue && !isNaN(e.maxValue) && parseFloat(d) > parseFloat(e.maxValue)) return [!1, h + ": " + a.jgrid.edit.msg.maxValue + " " + e.maxValue, ""];
  4262. 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, ""];
  4263. 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, ""];
  4264. 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, ""];
  4265. 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)", ""];
  4266. 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, ""];
  4267. 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, ""]
  4268. }
  4269. return [!0, "", ""]
  4270. }
  4271. })
  4272. })(jQuery); (function (a) {
  4273. var b = {};
  4274. a.jgrid.extend({
  4275. searchGrid: function (b) {
  4276. b = a.extend(!0, {
  4277. recreateFilter: !1,
  4278. drag: !0,
  4279. sField: "searchField",
  4280. sValue: "searchString",
  4281. sOper: "searchOper",
  4282. sFilter: "filters",
  4283. loadDefaults: !0,
  4284. beforeShowSearch: null,
  4285. afterShowSearch: null,
  4286. onInitializeSearch: null,
  4287. afterRedraw: null,
  4288. afterChange: null,
  4289. closeAfterSearch: !1,
  4290. closeAfterReset: !1,
  4291. closeOnEscape: !1,
  4292. searchOnEnter: !1,
  4293. multipleSearch: !1,
  4294. multipleGroup: !1,
  4295. top: 0,
  4296. left: 0,
  4297. jqModal: !0,
  4298. modal: !1,
  4299. resize: !0,
  4300. width: 450,
  4301. height: "auto",
  4302. dataheight: "auto",
  4303. showQuery: !1,
  4304. errorcheck: !0,
  4305. sopt: null,
  4306. stringResult: void 0,
  4307. onClose: null,
  4308. onSearch: null,
  4309. onReset: null,
  4310. toTop: !0,
  4311. overlay: 30,
  4312. columns: [],
  4313. tmplNames: null,
  4314. tmplFilters: null,
  4315. tmplLabel: " Template: ",
  4316. showOnLoad: !1,
  4317. layer: null,
  4318. operands: {
  4319. eq: "=",
  4320. ne: "<>",
  4321. lt: "<",
  4322. le: "<=",
  4323. gt: ">",
  4324. ge: ">=",
  4325. bw: "LIKE",
  4326. bn: "NOT LIKE",
  4327. "in": "IN",
  4328. ni: "NOT IN",
  4329. ew: "LIKE",
  4330. en: "NOT LIKE",
  4331. cn: "LIKE",
  4332. nc: "NOT LIKE",
  4333. nu: "IS NULL",
  4334. nn: "ISNOT NULL"
  4335. }
  4336. },
  4337. a.jgrid.search, b || {});
  4338. return this.each(function () {
  4339. function c(c) {
  4340. w = a(e).triggerHandler("jqGridFilterBeforeShow", [c]);
  4341. void 0 === w && (w = !0);
  4342. w && a.isFunction(b.beforeShowSearch) && (w = b.beforeShowSearch.call(e, c));
  4343. w && (a.jgrid.viewModal("#" + a.jgrid.jqID(s.themodal), {
  4344. gbox: "#gbox_" + a.jgrid.jqID(h),
  4345. jqm: b.jqModal,
  4346. modal: b.modal,
  4347. overlay: b.overlay,
  4348. toTop: b.toTop
  4349. }), a(e).triggerHandler("jqGridFilterAfterShow", [c]), a.isFunction(b.afterShowSearch) && b.afterShowSearch.call(e, c))
  4350. }
  4351. var e = this;
  4352. if (e.grid) {
  4353. var h = "fbox_" + e.p.id,
  4354. w = !0,
  4355. t = !0,
  4356. s = {
  4357. themodal: "searchmod" + h,
  4358. modalhead: "searchhd" + h,
  4359. modalcontent: "searchcnt" + h,
  4360. scrollelm: h
  4361. },
  4362. r = e.p.postData[b.sFilter];
  4363. "string" === typeof r && (r = a.jgrid.parse(r)); !0 === b.recreateFilter && a("#" + a.jgrid.jqID(s.themodal)).remove();
  4364. if (void 0 !== a("#" + a.jgrid.jqID(s.themodal))[0]) c(a("#fbox_" + a.jgrid.jqID(+e.p.id)));
  4365. else {
  4366. var f = a("<div><div id='" + h + "' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_" + a.jgrid.jqID(e.p.id)),
  4367. k = "left",
  4368. u = "";
  4369. "rtl" === e.p.direction && (k = "right", u = " style='text-align:left'", f.attr("dir", "rtl"));
  4370. var x = a.extend([], e.p.colModel),
  4371. 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>",
  4372. 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>",
  4373. g = "",
  4374. m = "",
  4375. p,
  4376. q = !1,
  4377. y = -1;
  4378. 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>");
  4379. b.columns.length ? (x = b.columns, y = 0, p = x[0].index || x[0].name) : a.each(x,
  4380. function (a, b) {
  4381. b.label || (b.label = e.p.colNames[a]);
  4382. if (!q) {
  4383. var c = void 0 === b.search ? !0 : b.search,
  4384. d = !0 === b.hidden;
  4385. if (b.searchoptions && !0 === b.searchoptions.searchhidden && c || c && !d) q = !0,
  4386. p = b.index || b.name,
  4387. y = a
  4388. }
  4389. });
  4390. if (!r && p || !1 === b.multipleSearch) {
  4391. var D = "eq";
  4392. 0 <= y && x[y].searchoptions && x[y].searchoptions.sopt ? D = x[y].searchoptions.sopt[0] : b.sopt && b.sopt.length && (D = b.sopt[0]);
  4393. r = {
  4394. groupOp: "AND",
  4395. rules: [{
  4396. field: p,
  4397. op: D,
  4398. data: ""
  4399. }]
  4400. }
  4401. }
  4402. q = !1;
  4403. 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,
  4404. function (a, b) {
  4405. m += "<option value='" + a + "'>" + b + "</option>"
  4406. }), m += "</select>");
  4407. 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>";
  4408. h = a.jgrid.jqID(h);
  4409. a("#" + h).jqFilter({
  4410. columns: x,
  4411. filter: b.loadDefaults ? r : null,
  4412. showQuery: b.showQuery,
  4413. errorcheck: b.errorcheck,
  4414. sopt: b.sopt,
  4415. groupButton: b.multipleGroup,
  4416. ruleButtons: b.multipleSearch,
  4417. afterRedraw: b.afterRedraw,
  4418. ops: b.odata,
  4419. operands: b.operands,
  4420. ajaxSelectOptions: e.p.ajaxSelectOptions,
  4421. groupOps: b.groupOps,
  4422. onChange: function () {
  4423. this.p.showQuery && a(".query", this).html(this.toUserFriendlyString());
  4424. a.isFunction(b.afterChange) && b.afterChange.call(e, a("#" + h), b)
  4425. },
  4426. direction: e.p.direction,
  4427. id: e.p.id
  4428. });
  4429. f.append(k);
  4430. q && b.tmplFilters && b.tmplFilters.length && a(".ui-template", f).bind("change",
  4431. function () {
  4432. var c = a(this).val();
  4433. "default" === c ? a("#" + h).jqFilter("addFilter", r) : a("#" + h).jqFilter("addFilter", b.tmplFilters[parseInt(c, 10)]);
  4434. return !1
  4435. }); !0 === b.multipleGroup && (b.multipleSearch = !0);
  4436. a(e).triggerHandler("jqGridFilterInitialize", [a("#" + h)]);
  4437. a.isFunction(b.onInitializeSearch) && b.onInitializeSearch.call(e, a("#" + h));
  4438. b.gbox = "#gbox_" + h;
  4439. 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), {
  4440. position: "relative"
  4441. }) : 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) {
  4442. var d = a(c.target);
  4443. 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(),
  4444. !1;
  4445. if (b.closeOnEscape && 27 === c.which) return a("#" + a.jgrid.jqID(s.modalhead)).find(".ui-jqdialog-titlebar-close").click(),
  4446. !1
  4447. });
  4448. g && a("#" + h + "_query").bind("click",
  4449. function () {
  4450. a(".queryresult", f).toggle();
  4451. return !1
  4452. });
  4453. void 0 === b.stringResult && (b.stringResult = b.multipleSearch);
  4454. a("#" + h + "_search").bind("click",
  4455. function () {
  4456. var c = a("#" + h),
  4457. d = {},
  4458. n,
  4459. g;
  4460. c.find(".input-elm:focus").change();
  4461. g = c.jqFilter("filterData");
  4462. if (b.errorcheck && (c[0].hideError(), b.showQuery || c.jqFilter("toSQLString"), c[0].p.error)) return c[0].showError(),
  4463. !1;
  4464. if (b.stringResult) {
  4465. try {
  4466. n = xmlJsonClass.toJson(g, "", "", !1)
  4467. } catch (f) {
  4468. try {
  4469. n = JSON.stringify(g)
  4470. } catch (k) { }
  4471. }
  4472. "string" === typeof n && (d[b.sFilter] = n, a.each([b.sField, b.sValue, b.sOper],
  4473. function () {
  4474. d[this] = ""
  4475. }))
  4476. } else b.multipleSearch ? (d[b.sFilter] = g, a.each([b.sField, b.sValue, b.sOper],
  4477. function () {
  4478. d[this] = ""
  4479. })) : (d[b.sField] = g.rules[0].field, d[b.sValue] = g.rules[0].data, d[b.sOper] = g.rules[0].op, d[b.sFilter] = "");
  4480. e.p.search = !0;
  4481. a.extend(e.p.postData, d);
  4482. t = a(e).triggerHandler("jqGridFilterSearch");
  4483. void 0 === t && (t = !0);
  4484. t && a.isFunction(b.onSearch) && (t = b.onSearch.call(e, e.p.filters)); !1 !== t && a(e).trigger("reloadGrid", [{
  4485. page: 1
  4486. }]);
  4487. b.closeAfterSearch && a.jgrid.hideModal("#" + a.jgrid.jqID(s.themodal), {
  4488. gb: "#gbox_" + a.jgrid.jqID(e.p.id),
  4489. jqm: b.jqModal,
  4490. onClose: b.onClose
  4491. });
  4492. return !1
  4493. });
  4494. a("#" + h + "_reset").bind("click",
  4495. function () {
  4496. var c = {},
  4497. d = a("#" + h);
  4498. e.p.search = !1;
  4499. e.p.resetsearch = !0; !1 === b.multipleSearch ? c[b.sField] = c[b.sValue] = c[b.sOper] = "" : c[b.sFilter] = "";
  4500. d[0].resetFilter();
  4501. q && a(".ui-template", f).val("default");
  4502. a.extend(e.p.postData, c);
  4503. t = a(e).triggerHandler("jqGridFilterReset");
  4504. void 0 === t && (t = !0);
  4505. t && a.isFunction(b.onReset) && (t = b.onReset.call(e)); !1 !== t && a(e).trigger("reloadGrid", [{
  4506. page: 1
  4507. }]);
  4508. b.closeAfterReset && a.jgrid.hideModal("#" + a.jgrid.jqID(s.themodal), {
  4509. gb: "#gbox_" + a.jgrid.jqID(e.p.id),
  4510. jqm: b.jqModal,
  4511. onClose: b.onClose
  4512. });
  4513. return !1
  4514. });
  4515. c(a("#" + h));
  4516. a(".fm-button:not(.ui-state-disabled)", f).hover(function () {
  4517. a(this).addClass("ui-state-hover")
  4518. },
  4519. function () {
  4520. a(this).removeClass("ui-state-hover")
  4521. })
  4522. }
  4523. }
  4524. })
  4525. },
  4526. editGridRow: function (z, c) {
  4527. c = a.extend(!0, {
  4528. top: 0,
  4529. left: 0,
  4530. width: 300,
  4531. datawidth: "auto",
  4532. height: "auto",
  4533. dataheight: "auto",
  4534. modal: !1,
  4535. overlay: 30,
  4536. drag: !0,
  4537. resize: !0,
  4538. url: null,
  4539. mtype: "POST",
  4540. clearAfterAdd: !0,
  4541. closeAfterEdit: !1,
  4542. reloadAfterSubmit: !0,
  4543. onInitializeForm: null,
  4544. beforeInitData: null,
  4545. beforeShowForm: null,
  4546. afterShowForm: null,
  4547. beforeSubmit: null,
  4548. afterSubmit: null,
  4549. onclickSubmit: null,
  4550. afterComplete: null,
  4551. onclickPgButtons: null,
  4552. afterclickPgButtons: null,
  4553. editData: {},
  4554. recreateForm: !1,
  4555. jqModal: !0,
  4556. closeOnEscape: !1,
  4557. addedrow: "first",
  4558. topinfo: "",
  4559. bottominfo: "",
  4560. saveicon: [],
  4561. closeicon: [],
  4562. savekey: [!1, 13],
  4563. navkeys: [!1, 38, 40],
  4564. checkOnSubmit: !1,
  4565. checkOnUpdate: !1,
  4566. _savedData: {},
  4567. processing: !1,
  4568. onClose: null,
  4569. ajaxEditOptions: {},
  4570. serializeEditData: null,
  4571. viewPagerButtons: !0,
  4572. overlayClass: "ui-widget-overlay"
  4573. },
  4574. a.jgrid.edit, c || {});
  4575. b[a(this)[0].p.id] = c;
  4576. return this.each(function () {
  4577. function e() {
  4578. a(p + " > tbody > tr > td > .FormElement").each(function () {
  4579. var b = a(".customelement", this);
  4580. if (b.length) {
  4581. var c = a(b[0]).attr("name");
  4582. a.each(d.p.colModel,
  4583. function () {
  4584. if (this.name === c && this.editoptions && a.isFunction(this.editoptions.custom_value)) {
  4585. try {
  4586. if (l[c] = this.editoptions.custom_value.call(d, a("#" + a.jgrid.jqID(c), p), "get"), void 0 === l[c]) throw "e1";
  4587. } catch (b) {
  4588. "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)
  4589. }
  4590. return !0
  4591. }
  4592. })
  4593. } else {
  4594. switch (a(this).get(0).type) {
  4595. case "checkbox":
  4596. a(this).is(":checked") ? l[this.name] = a(this).val() : (b = a(this).attr("offval"), l[this.name] = b);
  4597. break;
  4598. case "select-one":
  4599. l[this.name] = a("option:selected", this).val();
  4600. break;
  4601. case "select-multiple":
  4602. l[this.name] = a(this).val();
  4603. l[this.name] = l[this.name] ? l[this.name].join(",") : "";
  4604. a("option:selected", this).each(function (b, c) {
  4605. a(c).text()
  4606. });
  4607. break;
  4608. case "password":
  4609. case "text":
  4610. case "textarea":
  4611. case "button":
  4612. l[this.name] = a(this).val()
  4613. }
  4614. d.p.autoencode && (l[this.name] = a.jgrid.htmlEncode(l[this.name]))
  4615. }
  4616. });
  4617. return !0
  4618. }
  4619. function h(c, e, n, f) {
  4620. var k, l, p, h = 0,
  4621. q, m, r, C = [],
  4622. u = !1,
  4623. z = "",
  4624. t;
  4625. for (t = 1; t <= f; t++) z += "<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";
  4626. "_empty" !== c && (u = a(e).jqGrid("getInd", c));
  4627. a(e.p.colModel).each(function (t) {
  4628. k = this.name;
  4629. m = (l = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) ? "style='display:none'" : "";
  4630. if ("cb" !== k && "subgrid" !== k && !0 === this.editable && "rn" !== k) {
  4631. if (!1 === u) q = "";
  4632. else if (k === e.p.ExpandColumn && !0 === e.p.treeGrid) q = a("td[role='gridcell']:eq(" + t + ")", e.rows[u]).text();
  4633. else {
  4634. try {
  4635. q = a.unformat.call(e, a("td[role='gridcell']:eq(" + t + ")", e.rows[u]), {
  4636. rowId: c,
  4637. colModel: this
  4638. },
  4639. t)
  4640. } catch (w) {
  4641. 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()
  4642. }
  4643. if (!q || "&nbsp;" === q || "&#160;" === q || 1 === q.length && 160 === q.charCodeAt(0)) q = ""
  4644. }
  4645. var s = a.extend({},
  4646. this.editoptions || {},
  4647. {
  4648. id: k,
  4649. name: k
  4650. }),
  4651. y = a.extend({},
  4652. {
  4653. elmprefix: "",
  4654. elmsuffix: "",
  4655. rowabove: !1,
  4656. rowcontent: ""
  4657. },
  4658. this.formoptions || {}),
  4659. v = parseInt(y.rowpos, 10) || h + 1,
  4660. A = parseInt(2 * (parseInt(y.colpos, 10) || 1), 10);
  4661. "_empty" === c && s.defaultValue && (q = a.isFunction(s.defaultValue) ? s.defaultValue.call(d) : s.defaultValue);
  4662. this.edittype || (this.edittype = "text");
  4663. d.p.autoencode && (q = a.jgrid.htmlDecode(q));
  4664. r = a.jgrid.createEl.call(d, this.edittype, s, q, !1, a.extend({},
  4665. a.jgrid.ajaxOptions, e.p.ajaxSelectOptions || {}));
  4666. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData[k] = q;
  4667. a(r).addClass("FormElement"); -1 < a.inArray(this.edittype, ["text", "textarea", "password", "select"]) && a(r).addClass("ui-widget-content ui-corner-all");
  4668. p = a(n).find("tr[rowpos=" + v + "]");
  4669. if (y.rowabove) {
  4670. var x = a("<tr><td class='contentinfo' colspan='" + 2 * f + "'>" + y.rowcontent + "</td></tr>");
  4671. a(n).append(x);
  4672. x[0].rp = v
  4673. }
  4674. 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);
  4675. a("td:eq(" + (A - 2) + ")", p[0]).html(void 0 === y.label ? e.p.colNames[t] : y.label);
  4676. a("td:eq(" + (A - 1) + ")", p[0]).append(y.elmprefix).append(r).append(y.elmsuffix);
  4677. "custom" === this.edittype && a.isFunction(s.custom_value) && s.custom_value.call(d, a("#" + k, "#" + g), "set", q);
  4678. a.jgrid.bindEv.call(d, r, s);
  4679. C[h] = t;
  4680. h++
  4681. }
  4682. });
  4683. 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);
  4684. return C
  4685. }
  4686. function w(c, e, n) {
  4687. var g, k = 0,
  4688. f, l, q, h, r;
  4689. if (b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData = {},
  4690. b[d.p.id]._savedData[e.p.id + "_id"] = c;
  4691. var m = e.p.colModel;
  4692. if ("_empty" === c) a(m).each(function () {
  4693. g = this.name;
  4694. q = a.extend({},
  4695. 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)
  4696. }),
  4697. a("#id_g", "#" + n).val(c);
  4698. else {
  4699. var t = a(e).jqGrid("getInd", c, !0);
  4700. t && (a('td[role="gridcell"]', t).each(function (l) {
  4701. g = m[l].name;
  4702. if ("cb" !== g && "subgrid" !== g && "rn" !== g && !0 === m[l].editable) {
  4703. if (g === e.p.ExpandColumn && !0 === e.p.treeGrid) f = a(this).text();
  4704. else try {
  4705. f = a.unformat.call(e, a(this), {
  4706. rowId: c,
  4707. colModel: m[l]
  4708. },
  4709. l)
  4710. } catch (q) {
  4711. f = "textarea" === m[l].edittype ? a(this).text() : a(this).html()
  4712. }
  4713. d.p.autoencode && (f = a.jgrid.htmlDecode(f));
  4714. if (!0 === b[d.p.id].checkOnSubmit || b[d.p.id].checkOnUpdate) b[d.p.id]._savedData[g] = f;
  4715. g = a.jgrid.jqID(g);
  4716. switch (m[l].edittype) {
  4717. case "password":
  4718. case "text":
  4719. case "button":
  4720. case "image":
  4721. case "textarea":
  4722. if ("&nbsp;" === f || "&#160;" === f || 1 === f.length && 160 === f.charCodeAt(0)) f = "";
  4723. a("#" + g, "#" + n).val(f);
  4724. break;
  4725. case "select":
  4726. var h = f.split(","),
  4727. h = a.map(h,
  4728. function (b) {
  4729. return a.trim(b)
  4730. });
  4731. a("#" + g + " option", "#" + n).each(function () {
  4732. 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
  4733. });
  4734. break;
  4735. case "checkbox":
  4736. f = String(f);
  4737. if (m[l].editoptions && m[l].editoptions.value) if (m[l].editoptions.value.split(":")[0] === f) a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]({
  4738. checked: !0,
  4739. defaultChecked: !0
  4740. });
  4741. else a("#" + g, "#" + n)[d.p.useProp ? "prop" : "attr"]({
  4742. checked: !1,
  4743. defaultChecked: !1
  4744. });
  4745. else f = f.toLowerCase(),
  4746. 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));
  4747. break;
  4748. case "custom":
  4749. try {
  4750. if (m[l].editoptions && a.isFunction(m[l].editoptions.custom_value)) m[l].editoptions.custom_value.call(d, a("#" + g, "#" + n), "set", f);
  4751. else throw "e1";
  4752. } catch (p) {
  4753. "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)
  4754. }
  4755. }
  4756. k++
  4757. }
  4758. }), 0 < k && a("#id_g", p).val(c))
  4759. }
  4760. }
  4761. function t() {
  4762. a.each(d.p.colModel,
  4763. function (a, b) {
  4764. b.editoptions && !0 === b.editoptions.NullIfEmpty && l.hasOwnProperty(b.name) && "" === l[b.name] && (l[b.name] = "null")
  4765. })
  4766. }
  4767. function s() {
  4768. var e, n = [!0, "", ""],
  4769. f = {},
  4770. k = d.p.prmNames,
  4771. h,
  4772. m,
  4773. r,
  4774. u,
  4775. s,
  4776. C = a(d).triggerHandler("jqGridAddEditBeforeCheckValues", [a("#" + g), B]);
  4777. C && "object" === typeof C && (l = C);
  4778. a.isFunction(b[d.p.id].beforeCheckValues) && (C = b[d.p.id].beforeCheckValues.call(d, l, a("#" + g), B)) && "object" === typeof C && (l = C);
  4779. for (r in l) if (l.hasOwnProperty(r) && (n = a.jgrid.checkValues.call(d, l[r], r), !1 === n[0])) break;
  4780. t();
  4781. 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)));
  4782. if (n[0] && !b[d.p.id].processing) {
  4783. b[d.p.id].processing = !0;
  4784. a("#sData", p + "_2").addClass("ui-state-active");
  4785. m = k.oper;
  4786. h = k.id;
  4787. l[m] = "_empty" === a.trim(l[d.p.id + "_id"]) ? k.addoper : k.editoper;
  4788. l[m] !== k.addoper ? l[h] = l[d.p.id + "_id"] : void 0 === l[h] && (l[h] = l[d.p.id + "_id"]);
  4789. delete l[d.p.id + "_id"];
  4790. l = a.extend(l, b[d.p.id].editData, f);
  4791. 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]);
  4792. l[h] = a.jgrid.stripPref(d.p.idPrefix, l[h]);
  4793. s = a.extend({
  4794. url: b[d.p.id].url || a(d).jqGrid("getGridParam", "editurl"),
  4795. type: b[d.p.id].mtype,
  4796. data: a.isFunction(b[d.p.id].serializeEditData) ? b[d.p.id].serializeEditData.call(d, l) : l,
  4797. complete: function (f, r) {
  4798. var s;
  4799. l[h] = d.p.idPrefix + l[h];
  4800. 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)));
  4801. if (!1 === n[0]) a("#FormError>td", p).html(n[1]),
  4802. a("#FormError", p).show();
  4803. else if (d.p.autoencode && a.each(l,
  4804. function (b, c) {
  4805. l[b] = a.jgrid.htmlDecode(c)
  4806. }), 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), {
  4807. gb: "#gbox_" + a.jgrid.jqID(v),
  4808. jqm: c.jqModal,
  4809. onClose: b[d.p.id].onClose
  4810. })) : 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 () {
  4811. a(d).jqGrid("setSelection", l[h])
  4812. },
  4813. 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), {
  4814. gb: "#gbox_" + a.jgrid.jqID(v),
  4815. jqm: c.jqModal,
  4816. onClose: b[d.p.id].onClose
  4817. })), a.isFunction(b[d.p.id].afterComplete) && (e = f, setTimeout(function () {
  4818. a(d).triggerHandler("jqGridAddEditAfterComplete", [e, l, a("#" + g), B]);
  4819. b[d.p.id].afterComplete.call(d, e, l, a("#" + g), B);
  4820. e = null
  4821. },
  4822. 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]);
  4823. b[d.p.id].processing = !1;
  4824. a("#sData", p + "_2").removeClass("ui-state-active");
  4825. try {
  4826. a(":input:visible", "#" + g)[0].focus()
  4827. } catch (t) { }
  4828. }
  4829. },
  4830. a.jgrid.ajaxOptions, b[d.p.id].ajaxEditOptions);
  4831. 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));
  4832. 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), {
  4833. gb: "#gbox_" + a.jgrid.jqID(v),
  4834. jqm: c.jqModal,
  4835. onClose: b[d.p.id].onClose
  4836. }), s.data.oper === k.editoper && b[d.p.id].closeAfterEdit && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4837. gb: "#gbox_" + a.jgrid.jqID(v),
  4838. jqm: c.jqModal,
  4839. onClose: b[d.p.id].onClose
  4840. }))) : a.ajax(s))
  4841. } !1 === n[0] && (a("#FormError>td", p).html(n[1]), a("#FormError", p).show())
  4842. }
  4843. function r(a, b) {
  4844. var c = !1,
  4845. d;
  4846. for (d in a) if (a.hasOwnProperty(d) && a[d] != b[d]) {
  4847. c = !0;
  4848. break
  4849. }
  4850. return c
  4851. }
  4852. function f() {
  4853. var c = !0;
  4854. a("#FormError", p).hide();
  4855. b[d.p.id].checkOnUpdate && (l = {},
  4856. e(), M = r(l, b[d.p.id]._savedData)) && (a("#" + g).data("disabled", !0), a(".confirm", "#" + q.themodal).show(), c = !1);
  4857. return c
  4858. }
  4859. function k() {
  4860. var b;
  4861. 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) {
  4862. a(d).jqGrid("restoreRow", z);
  4863. break
  4864. }
  4865. }
  4866. function u(b, c) {
  4867. var d = c[1].length - 1;
  4868. 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");
  4869. 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")
  4870. }
  4871. function x() {
  4872. var b = a(d).jqGrid("getDataIDs"),
  4873. c = a("#id_g", p).val();
  4874. return [a.inArray(c, b), b]
  4875. }
  4876. var d = this;
  4877. if (d.grid && z) {
  4878. var v = d.p.id,
  4879. g = "FrmGrid_" + v,
  4880. m = "TblGrid_" + v,
  4881. p = "#" + a.jgrid.jqID(m),
  4882. q = {
  4883. themodal: "editmod" + v,
  4884. modalhead: "edithd" + v,
  4885. modalcontent: "editcnt" + v,
  4886. scrollelm: g
  4887. },
  4888. y = a.isFunction(b[d.p.id].beforeShowForm) ? b[d.p.id].beforeShowForm : !1,
  4889. D = a.isFunction(b[d.p.id].afterShowForm) ? b[d.p.id].afterShowForm : !1,
  4890. A = a.isFunction(b[d.p.id].beforeInitData) ? b[d.p.id].beforeInitData : !1,
  4891. E = a.isFunction(b[d.p.id].onInitializeForm) ? b[d.p.id].onInitializeForm : !1,
  4892. n = !0,
  4893. C = 1,
  4894. I = 0,
  4895. l,
  4896. M,
  4897. B,
  4898. g = a.jgrid.jqID(g);
  4899. "new" === z ? (z = "_empty", B = "add", c.caption = b[d.p.id].addCaption) : (c.caption = b[d.p.id].editCaption, B = "edit");
  4900. c.recreateForm || a(d).data("formProp") && a.extend(b[a(this)[0].p.id], a(d).data("formProp"));
  4901. var N = !0;
  4902. c.checkOnUpdate && c.jqModal && !c.modal && (N = !1);
  4903. 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",
  4904. n = isNaN(b[a(this)[0].p.id].datawidth) ? b[a(this)[0].p.id].datawidth : b[a(this)[0].p.id].datawidth + "px",
  4905. 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),
  4906. F = a("<table id='" + m + "' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  4907. n = a(d).triggerHandler("jqGridAddEditBeforeInitData", [a("#" + g), B]);
  4908. void 0 === n && (n = !0);
  4909. n && A && (n = A.call(d, a("#" + g), B));
  4910. if (!1 !== n) {
  4911. k();
  4912. a(d.p.colModel).each(function () {
  4913. var a = this.formoptions;
  4914. C = Math.max(C, a ? a.colpos || 0 : 0);
  4915. I = Math.max(I, a ? a.rowpos || 0 : 0)
  4916. });
  4917. a(H).append(F);
  4918. A = a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='" + 2 * C + "'></td></tr>");
  4919. A[0].rp = 0;
  4920. a(F).append(A);
  4921. A = a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='" + 2 * C + "'>" + b[d.p.id].topinfo + "</td></tr>");
  4922. A[0].rp = 0;
  4923. a(F).append(A);
  4924. var n = (A = "rtl" === d.p.direction ? !0 : !1) ? "nData" : "pData",
  4925. G = A ? "pData" : "nData";
  4926. h(z, d, F, C);
  4927. 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>",
  4928. G = "<a id='" + G + "' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",
  4929. J = "<a id='sData' class='fm-button ui-state-default ui-corner-all'>" + c.bSubmit + "</a>",
  4930. K = "<a id='cData' class='fm-button ui-state-default ui-corner-all'>" + c.bCancel + "</a>",
  4931. 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>"),
  4932. m = m + "</tbody></table>";
  4933. if (0 < I) {
  4934. var L = [];
  4935. a.each(a(F)[0].rows,
  4936. function (a, b) {
  4937. L[a] = b
  4938. });
  4939. L.sort(function (a, b) {
  4940. return a.rp > b.rp ? 1 : a.rp < b.rp ? -1 : 0
  4941. });
  4942. a.each(L,
  4943. function (b, c) {
  4944. a("tbody", F).append(c)
  4945. })
  4946. }
  4947. c.gbox = "#gbox_" + a.jgrid.jqID(v);
  4948. var O = !1; !0 === c.closeOnEscape && (c.closeOnEscape = !1, O = !0);
  4949. m = a("<div></div>").append(H).append(m);
  4950. 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]);
  4951. A && (a("#pData, #nData", p + "_2").css("float", "right"), a(".EditButton", p + "_2").css("text-align", "left"));
  4952. b[d.p.id].topinfo && a(".tinfo", p).show();
  4953. b[d.p.id].bottominfo && a(".binfo", p + "_2").show();
  4954. m = m = null;
  4955. a("#" + a.jgrid.jqID(q.themodal)).keydown(function (e) {
  4956. var n = e.target;
  4957. if (!0 === a("#" + g).data("disabled")) return !1;
  4958. 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"),
  4959. !1;
  4960. if (27 === e.which) {
  4961. if (!f()) return !1;
  4962. O && a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4963. gb: c.gbox,
  4964. jqm: c.jqModal,
  4965. onClose: b[d.p.id].onClose
  4966. });
  4967. return !1
  4968. }
  4969. if (!0 === b[d.p.id].navkeys[0]) {
  4970. if ("_empty" === a("#id_g", p).val()) return !0;
  4971. if (e.which === b[d.p.id].navkeys[1]) return a("#pData", p + "_2").trigger("click"),
  4972. !1;
  4973. if (e.which === b[d.p.id].navkeys[2]) return a("#nData", p + "_2").trigger("click"),
  4974. !1
  4975. }
  4976. });
  4977. 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 () {
  4978. if (!f()) return !1;
  4979. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  4980. gb: "#gbox_" + a.jgrid.jqID(v),
  4981. jqm: c.jqModal,
  4982. onClose: b[d.p.id].onClose
  4983. });
  4984. return !1
  4985. }));
  4986. c.saveicon = a.extend([!0, "left", "ui-icon-disk"], c.saveicon);
  4987. 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>");
  4988. 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>",
  4989. G = "<a id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bNo + "</a>",
  4990. K = "<a id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>" + c.bExit + "</a>",
  4991. m = c.zIndex || 999,
  4992. m++,
  4993. 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),
  4994. a("#sNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  4995. s();
  4996. a("#" + g).data("disabled", !1);
  4997. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  4998. return !1
  4999. }),
  5000. a("#nNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  5001. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  5002. a("#" + g).data("disabled", !1);
  5003. setTimeout(function () {
  5004. a(":input:visible", "#" + g)[0].focus()
  5005. },
  5006. 0);
  5007. return !1
  5008. }),
  5009. a("#cNew", "#" + a.jgrid.jqID(q.themodal)).click(function () {
  5010. a(".confirm", "#" + a.jgrid.jqID(q.themodal)).hide();
  5011. a("#" + g).data("disabled", !1);
  5012. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5013. gb: "#gbox_" + a.jgrid.jqID(v),
  5014. jqm: c.jqModal,
  5015. onClose: b[d.p.id].onClose
  5016. });
  5017. return !1
  5018. });
  5019. a(d).triggerHandler("jqGridAddEditInitializeForm", [a("#" + g), B]);
  5020. E && E.call(d, a("#" + g), B);
  5021. "_empty" !== z && b[d.p.id].viewPagerButtons ? a("#pData,#nData", p + "_2").show() : a("#pData,#nData", p + "_2").hide();
  5022. a(d).triggerHandler("jqGridAddEditBeforeShowForm", [a("#" + g), B]);
  5023. y && y.call(d, a("#" + g), B);
  5024. a("#" + a.jgrid.jqID(q.themodal)).data("onClose", b[d.p.id].onClose);
  5025. a.jgrid.viewModal("#" + a.jgrid.jqID(q.themodal), {
  5026. gbox: "#gbox_" + a.jgrid.jqID(v),
  5027. jqm: c.jqModal,
  5028. overlay: c.overlay,
  5029. modal: c.modal,
  5030. overlayClass: c.overlayClass,
  5031. onHide: function (b) {
  5032. a(d).data("formProp", {
  5033. top: parseFloat(a(b.w).css("top")),
  5034. left: parseFloat(a(b.w).css("left")),
  5035. width: a(b.w).width(),
  5036. height: a(b.w).height(),
  5037. dataheight: a("#" + g).height(),
  5038. datawidth: a("#" + g).width()
  5039. });
  5040. b.w.remove();
  5041. b.o && b.o.remove()
  5042. }
  5043. });
  5044. N || a("." + a.jgrid.jqID(c.overlayClass)).click(function () {
  5045. if (!f()) return !1;
  5046. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5047. gb: "#gbox_" + a.jgrid.jqID(v),
  5048. jqm: c.jqModal,
  5049. onClose: b[d.p.id].onClose
  5050. });
  5051. return !1
  5052. });
  5053. a(".fm-button", "#" + a.jgrid.jqID(q.themodal)).hover(function () {
  5054. a(this).addClass("ui-state-hover")
  5055. },
  5056. function () {
  5057. a(this).removeClass("ui-state-hover")
  5058. });
  5059. a("#sData", p + "_2").click(function () {
  5060. l = {};
  5061. a("#FormError", p).hide();
  5062. e();
  5063. "_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();
  5064. return !1
  5065. });
  5066. a("#cData", p + "_2").click(function () {
  5067. if (!f()) return !1;
  5068. a.jgrid.hideModal("#" + a.jgrid.jqID(q.themodal), {
  5069. gb: "#gbox_" + a.jgrid.jqID(v),
  5070. jqm: c.jqModal,
  5071. onClose: b[d.p.id].onClose
  5072. });
  5073. return !1
  5074. });
  5075. a("#nData", p + "_2").click(function () {
  5076. if (!f()) return !1;
  5077. a("#FormError", p).hide();
  5078. var b = x();
  5079. b[0] = parseInt(b[0], 10);
  5080. if (-1 !== b[0] && b[1][b[0] + 1]) {
  5081. a(d).triggerHandler("jqGridAddEditClickPgButtons", ["next", a("#" + g), b[1][b[0]]]);
  5082. var e;
  5083. 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;
  5084. w(b[1][b[0] + 1], d, g);
  5085. a(d).jqGrid("setSelection", b[1][b[0] + 1]);
  5086. a(d).triggerHandler("jqGridAddEditAfterClickPgButtons", ["next", a("#" + g), b[1][b[0]]]);
  5087. a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(d, "next", a("#" + g), b[1][b[0] + 1]);
  5088. u(b[0] + 1, b)
  5089. }
  5090. return !1
  5091. });
  5092. a("#pData", p + "_2").click(function () {
  5093. if (!f()) return !1;
  5094. a("#FormError", p).hide();
  5095. var b = x();
  5096. if (-1 !== b[0] && b[1][b[0] - 1]) {
  5097. a(d).triggerHandler("jqGridAddEditClickPgButtons", ["prev", a("#" + g), b[1][b[0]]]);
  5098. var e;
  5099. 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;
  5100. w(b[1][b[0] - 1], d, g);
  5101. a(d).jqGrid("setSelection", b[1][b[0] - 1]);
  5102. a(d).triggerHandler("jqGridAddEditAfterClickPgButtons", ["prev", a("#" + g), b[1][b[0]]]);
  5103. a.isFunction(c.afterclickPgButtons) && c.afterclickPgButtons.call(d, "prev", a("#" + g), b[1][b[0] - 1]);
  5104. u(b[0] - 1, b)
  5105. }
  5106. return !1
  5107. });
  5108. a(d).triggerHandler("jqGridAddEditAfterShowForm", [a("#" + g), B]);
  5109. D && D.call(d, a("#" + g), B);
  5110. y = x();
  5111. u(y[0], y)
  5112. }
  5113. }
  5114. })
  5115. },
  5116. viewGridRow: function (z, c) {
  5117. c = a.extend(!0, {
  5118. top: 0,
  5119. left: 0,
  5120. width: 0,
  5121. datawidth: "auto",
  5122. height: "auto",
  5123. dataheight: "auto",
  5124. modal: !1,
  5125. overlay: 30,
  5126. drag: !0,
  5127. resize: !0,
  5128. jqModal: !0,
  5129. closeOnEscape: !1,
  5130. labelswidth: "30%",
  5131. closeicon: [],
  5132. navkeys: [!1, 38, 40],
  5133. onClose: null,
  5134. beforeShowForm: null,
  5135. beforeInitData: null,
  5136. viewPagerButtons: !0,
  5137. recreateForm: !1
  5138. },
  5139. a.jgrid.view, c || {});
  5140. b[a(this)[0].p.id] = c;
  5141. return this.each(function () {
  5142. function e() {
  5143. !0 !== b[r.p.id].closeOnEscape && !0 !== b[r.p.id].navkeys[0] || setTimeout(function () {
  5144. a(".ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(v.modalhead)).focus()
  5145. },
  5146. 0)
  5147. }
  5148. function h(b, d, e, f) {
  5149. var g, k, h, q = 0,
  5150. m, p, r = [],
  5151. s = !1,
  5152. t,
  5153. 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>",
  5154. y = "",
  5155. z = ["integer", "number", "currency"],
  5156. v = 0,
  5157. w = 0,
  5158. A,
  5159. x,
  5160. D;
  5161. 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>";
  5162. a(d.p.colModel).each(function () {
  5163. (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)))
  5164. });
  5165. A = 0 !== v ? v : 0 !== w ? w : 0;
  5166. s = a(d).jqGrid("getInd", b);
  5167. a(d.p.colModel).each(function (b) {
  5168. g = this.name;
  5169. x = !1;
  5170. p = (k = this.editrules && !0 === this.editrules.edithidden ? !1 : !0 === this.hidden ? !0 : !1) ? "style='display:none'" : "";
  5171. D = "boolean" !== typeof this.viewable ? !0 : this.viewable;
  5172. if ("cb" !== g && "subgrid" !== g && "rn" !== g && D) {
  5173. 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();
  5174. x = "right" === this.align && 0 !== A ? !0 : !1;
  5175. var c = a.extend({},
  5176. {
  5177. rowabove: !1,
  5178. rowcontent: ""
  5179. },
  5180. this.formoptions || {}),
  5181. n = parseInt(c.rowpos, 10) || q + 1,
  5182. t = parseInt(2 * (parseInt(c.colpos, 10) || 1), 10);
  5183. if (c.rowabove) {
  5184. var u = a("<tr><td class='contentinfo' colspan='" + 2 * f + "'>" + c.rowcontent + "</td></tr>");
  5185. a(e).append(u);
  5186. u[0].rp = n
  5187. }
  5188. h = a(e).find("tr[rowpos=" + n + "]");
  5189. 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);
  5190. a("td:eq(" + (t - 2) + ")", h[0]).html("<b>" + (void 0 === c.label ? d.p.colNames[b] : c.label) + "</b>");
  5191. a("td:eq(" + (t - 1) + ")", h[0]).append("<span>" + m + "</span>").attr("id", "v_" + g);
  5192. x && a("td:eq(" + (t - 1) + ") span", h[0]).css({
  5193. "text-align": "right",
  5194. width: A + "px"
  5195. });
  5196. r[q] = b;
  5197. q++
  5198. }
  5199. });
  5200. 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));
  5201. return r
  5202. }
  5203. function w(b, c) {
  5204. var d, e, f = 0,
  5205. g, k;
  5206. if (k = a(c).jqGrid("getInd", b, !0)) a("td", k).each(function (b) {
  5207. d = c.p.colModel[b].name;
  5208. e = c.p.colModel[b].editrules && !0 === c.p.colModel[b].editrules.edithidden ? !1 : !0 === c.p.colModel[b].hidden ? !0 : !1;
  5209. "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++)
  5210. }),
  5211. 0 < f && a("#id_g", "#" + u).val(b)
  5212. }
  5213. function t(b, c) {
  5214. var d = c[1].length - 1;
  5215. 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");
  5216. 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")
  5217. }
  5218. function s() {
  5219. var b = a(r).jqGrid("getDataIDs"),
  5220. c = a("#id_g", "#" + u).val();
  5221. return [a.inArray(c, b), b]
  5222. }
  5223. var r = this;
  5224. if (r.grid && z) {
  5225. var f = r.p.id,
  5226. k = "ViewGrid_" + a.jgrid.jqID(f),
  5227. u = "ViewTbl_" + a.jgrid.jqID(f),
  5228. x = "ViewGrid_" + f,
  5229. d = "ViewTbl_" + f,
  5230. v = {
  5231. themodal: "viewmod" + f,
  5232. modalhead: "viewhd" + f,
  5233. modalcontent: "viewcnt" + f,
  5234. scrollelm: k
  5235. },
  5236. g = a.isFunction(b[r.p.id].beforeInitData) ? b[r.p.id].beforeInitData : !1,
  5237. m = !0,
  5238. p = 1,
  5239. q = 0;
  5240. c.recreateForm || a(r).data("viewProp") && a.extend(b[a(this)[0].p.id], a(r).data("viewProp"));
  5241. 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",
  5242. D = isNaN(b[a(this)[0].p.id].datawidth) ? b[a(this)[0].p.id].datawidth : b[a(this)[0].p.id].datawidth + "px",
  5243. x = a("<form name='FormPost' id='" + x + "' class='FormGrid' style='width:" + D + ";overflow:auto;position:relative;height:" + y + ";'></form>"),
  5244. A = a("<table id='" + d + "' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");
  5245. g && (m = g.call(r, a("#" + k)), void 0 === m && (m = !0));
  5246. if (!1 !== m) {
  5247. a(r.p.colModel).each(function () {
  5248. var a = this.formoptions;
  5249. p = Math.max(p, a ? a.colpos || 0 : 0);
  5250. q = Math.max(q, a ? a.rowpos || 0 : 0)
  5251. });
  5252. a(x).append(A);
  5253. h(z, r, A, p);
  5254. d = "rtl" === r.p.direction ? !0 : !1;
  5255. 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>";
  5256. 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>";
  5257. y = "<a id='cData' class='fm-button ui-state-default ui-corner-all'>" + c.bClose + "</a>";
  5258. if (0 < q) {
  5259. var E = [];
  5260. a.each(a(A)[0].rows,
  5261. function (a, b) {
  5262. E[a] = b
  5263. });
  5264. E.sort(function (a, b) {
  5265. return a.rp > b.rp ? 1 : a.rp < b.rp ? -1 : 0
  5266. });
  5267. a.each(E,
  5268. function (b, c) {
  5269. a("tbody", A).append(c)
  5270. })
  5271. }
  5272. c.gbox = "#gbox_" + a.jgrid.jqID(f);
  5273. 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>");
  5274. a.jgrid.createModal(v, x, c, "#gview_" + a.jgrid.jqID(r.p.id), a("#gview_" + a.jgrid.jqID(r.p.id))[0]);
  5275. d && (a("#pData, #nData", "#" + u + "_2").css("float", "right"), a(".EditButton", "#" + u + "_2").css("text-align", "left"));
  5276. c.viewPagerButtons || a("#pData, #nData", "#" + u + "_2").hide();
  5277. x = null;
  5278. a("#" + v.themodal).keydown(function (d) {
  5279. if (27 === d.which) return b[r.p.id].closeOnEscape && a.jgrid.hideModal("#" + a.jgrid.jqID(v.themodal), {
  5280. gb: c.gbox,
  5281. jqm: c.jqModal,
  5282. onClose: c.onClose
  5283. }),
  5284. !1;
  5285. if (!0 === c.navkeys[0]) {
  5286. if (d.which === c.navkeys[1]) return a("#pData", "#" + u + "_2").trigger("click"),
  5287. !1;
  5288. if (d.which === c.navkeys[2]) return a("#nData", "#" + u + "_2").trigger("click"),
  5289. !1
  5290. }
  5291. });
  5292. 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>");
  5293. a.isFunction(c.beforeShowForm) && c.beforeShowForm.call(r, a("#" + k));
  5294. a.jgrid.viewModal("#" + a.jgrid.jqID(v.themodal), {
  5295. gbox: "#gbox_" + a.jgrid.jqID(f),
  5296. jqm: c.jqModal,
  5297. overlay: c.overlay,
  5298. modal: c.modal,
  5299. onHide: function (b) {
  5300. a(r).data("viewProp", {
  5301. top: parseFloat(a(b.w).css("top")),
  5302. left: parseFloat(a(b.w).css("left")),
  5303. width: a(b.w).width(),
  5304. height: a(b.w).height(),
  5305. dataheight: a("#" + k).height(),
  5306. datawidth: a("#" + k).width()
  5307. });
  5308. b.w.remove();
  5309. b.o && b.o.remove()
  5310. }
  5311. });
  5312. a(".fm-button:not(.ui-state-disabled)", "#" + u + "_2").hover(function () {
  5313. a(this).addClass("ui-state-hover")
  5314. },
  5315. function () {
  5316. a(this).removeClass("ui-state-hover")
  5317. });
  5318. e();
  5319. a("#cData", "#" + u + "_2").click(function () {
  5320. a.jgrid.hideModal("#" + a.jgrid.jqID(v.themodal), {
  5321. gb: "#gbox_" + a.jgrid.jqID(f),
  5322. jqm: c.jqModal,
  5323. onClose: c.onClose
  5324. });
  5325. return !1
  5326. });
  5327. a("#nData", "#" + u + "_2").click(function () {
  5328. a("#FormError", "#" + u).hide();
  5329. var b = s();
  5330. 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));
  5331. e();
  5332. return !1
  5333. });
  5334. a("#pData", "#" + u + "_2").click(function () {
  5335. a("#FormError", "#" + u).hide();
  5336. 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));
  5337. e();
  5338. return !1
  5339. });
  5340. x = s();
  5341. t(x[0], x)
  5342. }
  5343. }
  5344. })
  5345. },
  5346. delGridRow: function (z, c) {
  5347. c = a.extend(!0, {
  5348. top: 0,
  5349. left: 0,
  5350. width: 240,
  5351. height: "auto",
  5352. dataheight: "auto",
  5353. modal: !1,
  5354. overlay: 30,
  5355. drag: !0,
  5356. resize: !0,
  5357. url: "",
  5358. mtype: "POST",
  5359. reloadAfterSubmit: !0,
  5360. beforeShowForm: null,
  5361. beforeInitData: null,
  5362. afterShowForm: null,
  5363. beforeSubmit: null,
  5364. onclickSubmit: null,
  5365. afterSubmit: null,
  5366. jqModal: !0,
  5367. closeOnEscape: !1,
  5368. delData: {},
  5369. delicon: [],
  5370. cancelicon: [],
  5371. onClose: null,
  5372. ajaxDelOptions: {},
  5373. processing: !1,
  5374. serializeDelData: null,
  5375. useDataProxy: !1
  5376. },
  5377. a.jgrid.del, c || {});
  5378. b[a(this)[0].p.id] = c;
  5379. return this.each(function () {
  5380. var e = this;
  5381. if (e.grid && z) {
  5382. var h = a.isFunction(b[e.p.id].beforeShowForm),
  5383. w = a.isFunction(b[e.p.id].afterShowForm),
  5384. t = a.isFunction(b[e.p.id].beforeInitData) ? b[e.p.id].beforeInitData : !1,
  5385. s = e.p.id,
  5386. r = {},
  5387. f = !0,
  5388. k = "DelTbl_" + a.jgrid.jqID(s),
  5389. u,
  5390. x,
  5391. d,
  5392. v,
  5393. g = "DelTbl_" + s,
  5394. m = {
  5395. themodal: "delmod" + s,
  5396. modalhead: "delhd" + s,
  5397. modalcontent: "delcnt" + s,
  5398. scrollelm: k
  5399. };
  5400. a.isArray(z) && (z = z.join());
  5401. if (void 0 !== a("#" + a.jgrid.jqID(m.themodal))[0]) {
  5402. t && (f = t.call(e, a("#" + k)), void 0 === f && (f = !0));
  5403. if (!1 === f) return;
  5404. a("#DelData>td", "#" + k).text(z);
  5405. a("#DelError", "#" + k).hide(); !0 === b[e.p.id].processing && (b[e.p.id].processing = !1, a("#dData", "#" + k).removeClass("ui-state-active"));
  5406. h && b[e.p.id].beforeShowForm.call(e, a("#" + k));
  5407. a.jgrid.viewModal("#" + a.jgrid.jqID(m.themodal), {
  5408. gbox: "#gbox_" + a.jgrid.jqID(s),
  5409. jqm: b[e.p.id].jqModal,
  5410. jqM: !1,
  5411. overlay: b[e.p.id].overlay,
  5412. modal: b[e.p.id].modal
  5413. })
  5414. } else {
  5415. var p = isNaN(b[e.p.id].dataheight) ? b[e.p.id].dataheight : b[e.p.id].dataheight + "px",
  5416. q = isNaN(c.datawidth) ? c.datawidth : c.datawidth + "px",
  5417. g = "<div id='" + g + "' class='formdata' style='width:" + q + ";overflow:auto;position:relative;height:" + p + ";'><table class='DelTable'><tbody>",
  5418. g = g + "<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",
  5419. g = g + ("<tr id='DelData' style='display:none'><td >" + z + "</td></tr>"),
  5420. g = g + ('<tr><td class="delmsg" style="white-space:pre;">' + b[e.p.id].msg + "</td></tr><tr><td >&#160;</td></tr>"),
  5421. g = g + "</tbody></table></div>",
  5422. 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>");
  5423. c.gbox = "#gbox_" + a.jgrid.jqID(s);
  5424. a.jgrid.createModal(m, g, c, "#gview_" + a.jgrid.jqID(e.p.id), a("#gview_" + a.jgrid.jqID(e.p.id))[0]);
  5425. t && (f = t.call(e, a("#" + k)), void 0 === f && (f = !0));
  5426. if (!1 === f) return;
  5427. a(".fm-button", "#" + k + "_2").hover(function () {
  5428. a(this).addClass("ui-state-hover")
  5429. },
  5430. function () {
  5431. a(this).removeClass("ui-state-hover")
  5432. });
  5433. c.delicon = a.extend([!0, "left", "ui-icon-scissors"], b[e.p.id].delicon);
  5434. 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>");
  5435. a("#dData", "#" + k + "_2").click(function () {
  5436. var f = [!0, ""],
  5437. g,
  5438. h = a("#DelData>td", "#" + k).text();
  5439. r = {};
  5440. a.isFunction(b[e.p.id].onclickSubmit) && (r = b[e.p.id].onclickSubmit.call(e, b[e.p.id], h) || {});
  5441. a.isFunction(b[e.p.id].beforeSubmit) && (f = b[e.p.id].beforeSubmit.call(e, h));
  5442. if (f[0] && !b[e.p.id].processing) {
  5443. b[e.p.id].processing = !0;
  5444. d = e.p.prmNames;
  5445. u = a.extend({},
  5446. b[e.p.id].delData, r);
  5447. v = d.oper;
  5448. u[v] = d.deloper;
  5449. x = d.id;
  5450. h = String(h).split(",");
  5451. if (!h.length) return !1;
  5452. for (g in h) h.hasOwnProperty(g) && (h[g] = a.jgrid.stripPref(e.p.idPrefix, h[g]));
  5453. u[x] = h.join();
  5454. a(this).addClass("ui-state-active");
  5455. g = a.extend({
  5456. url: b[e.p.id].url || a(e).jqGrid("getGridParam", "editurl"),
  5457. type: b[e.p.id].mtype,
  5458. data: a.isFunction(b[e.p.id].serializeDelData) ? b[e.p.id].serializeDelData.call(e, u) : u,
  5459. complete: function (d, g) {
  5460. var q;
  5461. 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));
  5462. if (!1 === f[0]) a("#DelError>td", "#" + k).html(f[1]),
  5463. a("#DelError", "#" + k).show();
  5464. else {
  5465. if (b[e.p.id].reloadAfterSubmit && "local" !== e.p.datatype) a(e).trigger("reloadGrid");
  5466. else {
  5467. if (!0 === e.p.treeGrid) try {
  5468. a(e).jqGrid("delTreeNode", e.p.idPrefix + h[0])
  5469. } catch (p) { } else for (q = 0; q < h.length; q++) a(e).jqGrid("delRowData", e.p.idPrefix + h[q]);
  5470. e.p.selrow = null;
  5471. e.p.selarrrow = []
  5472. }
  5473. a.isFunction(b[e.p.id].afterComplete) && setTimeout(function () {
  5474. b[e.p.id].afterComplete.call(e, d, h)
  5475. },
  5476. 500)
  5477. }
  5478. b[e.p.id].processing = !1;
  5479. a("#dData", "#" + k + "_2").removeClass("ui-state-active");
  5480. f[0] && a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5481. gb: "#gbox_" + a.jgrid.jqID(s),
  5482. jqm: c.jqModal,
  5483. onClose: b[e.p.id].onClose
  5484. })
  5485. }
  5486. },
  5487. a.jgrid.ajaxOptions, b[e.p.id].ajaxDelOptions);
  5488. 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));
  5489. 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), {
  5490. gb: "#gbox_" + a.jgrid.jqID(s),
  5491. jqm: c.jqModal,
  5492. onClose: b[e.p.id].onClose
  5493. })) : a.ajax(g))
  5494. } !1 === f[0] && (a("#DelError>td", "#" + k).html(f[1]), a("#DelError", "#" + k).show());
  5495. return !1
  5496. });
  5497. a("#eData", "#" + k + "_2").click(function () {
  5498. a.jgrid.hideModal("#" + a.jgrid.jqID(m.themodal), {
  5499. gb: "#gbox_" + a.jgrid.jqID(s),
  5500. jqm: b[e.p.id].jqModal,
  5501. onClose: b[e.p.id].onClose
  5502. });
  5503. return !1
  5504. });
  5505. h && b[e.p.id].beforeShowForm.call(e, a("#" + k));
  5506. a.jgrid.viewModal("#" + a.jgrid.jqID(m.themodal), {
  5507. gbox: "#gbox_" + a.jgrid.jqID(s),
  5508. jqm: b[e.p.id].jqModal,
  5509. overlay: b[e.p.id].overlay,
  5510. modal: b[e.p.id].modal
  5511. })
  5512. }
  5513. w && b[e.p.id].afterShowForm.call(e, a("#" + k)); !0 === b[e.p.id].closeOnEscape && setTimeout(function () {
  5514. a(".ui-jqdialog-titlebar-close", "#" + a.jgrid.jqID(m.modalhead)).focus()
  5515. },
  5516. 0)
  5517. }
  5518. })
  5519. },
  5520. navGrid: function (b, c, e, h, w, t, s) {
  5521. c = a.extend({
  5522. edit: !0,
  5523. editicon: "ui-icon-pencil",
  5524. add: !0,
  5525. addicon: "ui-icon-plus",
  5526. del: !0,
  5527. delicon: "ui-icon-trash",
  5528. search: !0,
  5529. searchicon: "ui-icon-search",
  5530. refresh: !0,
  5531. refreshicon: "ui-icon-refresh",
  5532. refreshstate: "firstpage",
  5533. view: !1,
  5534. viewicon: "ui-icon-document",
  5535. position: "left",
  5536. closeOnEscape: !0,
  5537. beforeRefresh: null,
  5538. afterRefresh: null,
  5539. cloneToTop: !1,
  5540. alertwidth: 200,
  5541. alertheight: "auto",
  5542. alerttop: null,
  5543. alertleft: null,
  5544. alertzIndex: null
  5545. },
  5546. a.jgrid.nav, c || {});
  5547. return this.each(function () {
  5548. if (!this.nav) {
  5549. var r = {
  5550. themodal: "alertmod_" + this.p.id,
  5551. modalhead: "alerthd_" + this.p.id,
  5552. modalcontent: "alertcnt_" + this.p.id
  5553. },
  5554. f = this,
  5555. k;
  5556. if (f.grid && "string" === typeof b) {
  5557. 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>", {
  5558. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5559. jqModal: !0,
  5560. drag: !0,
  5561. resize: !0,
  5562. caption: c.alertcap,
  5563. top: c.alerttop,
  5564. left: c.alertleft,
  5565. width: c.alertwidth,
  5566. height: c.alertheight,
  5567. closeOnEscape: c.closeOnEscape,
  5568. zIndex: c.alertzIndex
  5569. },
  5570. "#gview_" + a.jgrid.jqID(f.p.id), a("#gbox_" + a.jgrid.jqID(f.p.id))[0], !0));
  5571. var u = 1,
  5572. x, d = function () {
  5573. a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")
  5574. },
  5575. v = function () {
  5576. a(this).removeClass("ui-state-hover")
  5577. };
  5578. c.cloneToTop && f.p.toppager && (u = 2);
  5579. for (x = 0; x < u; x++) {
  5580. 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>"),
  5581. m,
  5582. p;
  5583. 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");
  5584. "rtl" === f.p.direction && a(g).attr("dir", "rtl").css("float", "right");
  5585. c.add && (h = h || {},
  5586. 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({
  5587. title: c.addtitle || "",
  5588. id: h.id || "add_" + p
  5589. }).click(function () {
  5590. a(this).hasClass("ui-state-disabled") || (a.isFunction(c.addfunc) ? c.addfunc.call(f) : a(f).jqGrid("editGridRow", "new", h));
  5591. return !1
  5592. }).hover(d, v), k = null);
  5593. c.edit && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), e = e || {},
  5594. 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({
  5595. title: c.edittitle || "",
  5596. id: e.id || "edit_" + p
  5597. }).click(function () {
  5598. if (!a(this).hasClass("ui-state-disabled")) {
  5599. var b = f.p.selrow;
  5600. b ? a.isFunction(c.editfunc) ? c.editfunc.call(f, b) : a(f).jqGrid("editGridRow", b, e) : (a.jgrid.viewModal("#" + r.themodal, {
  5601. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5602. jqm: !0
  5603. }), a("#jqg_alrt").focus())
  5604. }
  5605. return !1
  5606. }).hover(d, v), k = null);
  5607. c.view && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), s = s || {},
  5608. 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({
  5609. title: c.viewtitle || "",
  5610. id: s.id || "view_" + p
  5611. }).click(function () {
  5612. if (!a(this).hasClass("ui-state-disabled")) {
  5613. var b = f.p.selrow;
  5614. b ? a.isFunction(c.viewfunc) ? c.viewfunc.call(f, b) : a(f).jqGrid("viewGridRow", b, s) : (a.jgrid.viewModal("#" + r.themodal, {
  5615. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5616. jqm: !0
  5617. }), a("#jqg_alrt").focus())
  5618. }
  5619. return !1
  5620. }).hover(d, v), k = null);
  5621. c.del && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), w = w || {},
  5622. 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({
  5623. title: c.deltitle || "",
  5624. id: w.id || "del_" + p
  5625. }).click(function () {
  5626. if (!a(this).hasClass("ui-state-disabled")) {
  5627. var b;
  5628. f.p.multiselect ? (b = f.p.selarrrow, 0 === b.length && (b = null)) : b = f.p.selrow;
  5629. b ? a.isFunction(c.delfunc) ? c.delfunc.call(f, b) : a(f).jqGrid("delGridRow", b, w) : (a.jgrid.viewModal("#" + r.themodal, {
  5630. gbox: "#gbox_" + a.jgrid.jqID(f.p.id),
  5631. jqm: !0
  5632. }), a("#jqg_alrt").focus())
  5633. }
  5634. return !1
  5635. }).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>");
  5636. c.search && (k = a("<td class='ui-pg-button ui-corner-all'></td>"), t = t || {},
  5637. 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({
  5638. title: c.searchtitle || "",
  5639. id: t.id || "search_" + p
  5640. }).click(function () {
  5641. a(this).hasClass("ui-state-disabled") || (a.isFunction(c.searchfunc) ? c.searchfunc.call(f, t) : a(f).jqGrid("searchGrid", t));
  5642. return !1
  5643. }).hover(d, v), t.showOnLoad && !0 === t.showOnLoad && a(k, g).click(), k = null);
  5644. 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({
  5645. title: c.refreshtitle || "",
  5646. id: "refresh_" + p
  5647. }).click(function () {
  5648. if (!a(this).hasClass("ui-state-disabled")) {
  5649. a.isFunction(c.beforeRefresh) && c.beforeRefresh.call(f);
  5650. f.p.search = !1;
  5651. f.p.resetsearch = !0;
  5652. try {
  5653. var b = f.p.id;
  5654. f.p.postData.filters = "";
  5655. try {
  5656. a("#fbox_" + a.jgrid.jqID(b)).jqFilter("resetFilter")
  5657. } catch (d) { }
  5658. a.isFunction(f.clearToolbar) && f.clearToolbar.call(f, !1)
  5659. } catch (e) { }
  5660. switch (c.refreshstate) {
  5661. case "firstpage":
  5662. a(f).trigger("reloadGrid", [{
  5663. page: 1
  5664. }]);
  5665. break;
  5666. case "current":
  5667. a(f).trigger("reloadGrid", [{
  5668. current: !0
  5669. }])
  5670. }
  5671. a.isFunction(c.afterRefresh) && c.afterRefresh.call(f)
  5672. }
  5673. return !1
  5674. }).hover(d, v), k = null);
  5675. k = a(".ui-jqgrid").css("font-size") || "11px";
  5676. a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:" + k + ";visibility:hidden;' ></div>");
  5677. k = a(g).clone().appendTo("#testpg2").width();
  5678. a("#testpg2").remove();
  5679. a(m + "_" + c.position, m).append(g);
  5680. 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);
  5681. g = k = k = null;
  5682. this.nav = !0
  5683. }
  5684. }
  5685. }
  5686. })
  5687. },
  5688. navButtonAdd: function (b, c) {
  5689. c = a.extend({
  5690. caption: "newButton",
  5691. title: "",
  5692. buttonicon: "ui-icon-newwin",
  5693. onClickButton: null,
  5694. position: "last",
  5695. cursor: "pointer"
  5696. },
  5697. c || {});
  5698. return this.each(function () {
  5699. if (this.grid) {
  5700. "string" === typeof b && 0 !== b.indexOf("#") && (b = "#" + a.jgrid.jqID(b));
  5701. var e = a(".navtable", b)[0],
  5702. h = this;
  5703. if (e && (!c.id || void 0 === a("#" + a.jgrid.jqID(c.id), e)[0])) {
  5704. var w = a("<td></td>");
  5705. "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>");
  5706. c.id && a(w).attr("id", c.id);
  5707. "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);
  5708. a(w, e).attr("title", c.title || "").click(function (b) {
  5709. a(this).hasClass("ui-state-disabled") || a.isFunction(c.onClickButton) && c.onClickButton.call(h, b);
  5710. return !1
  5711. }).hover(function () {
  5712. a(this).hasClass("ui-state-disabled") || a(this).addClass("ui-state-hover")
  5713. },
  5714. function () {
  5715. a(this).removeClass("ui-state-hover")
  5716. })
  5717. }
  5718. }
  5719. })
  5720. },
  5721. navSeparatorAdd: function (b, c) {
  5722. c = a.extend({
  5723. sepclass: "ui-separator",
  5724. sepcontent: "",
  5725. position: "last"
  5726. },
  5727. c || {});
  5728. return this.each(function () {
  5729. if (this.grid) {
  5730. "string" === typeof b && 0 !== b.indexOf("#") && (b = "#" + a.jgrid.jqID(b));
  5731. var e = a(".navtable", b)[0];
  5732. if (e) {
  5733. var h = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='" + c.sepclass + "'></span>" + c.sepcontent + "</td>";
  5734. "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)
  5735. }
  5736. }
  5737. })
  5738. },
  5739. GridToForm: function (b, c) {
  5740. return this.each(function () {
  5741. var e = this,
  5742. h;
  5743. if (e.grid) {
  5744. var w = a(e).jqGrid("getRowData", b);
  5745. 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 () {
  5746. if (a(this).val() == w[h]) a(this)[e.p.useProp ? "prop" : "attr"]("checked", !0);
  5747. else a(this)[e.p.useProp ? "prop" : "attr"]("checked", !1)
  5748. }) : a("[name=" + a.jgrid.jqID(h) + "]", c).val(w[h]))
  5749. }
  5750. })
  5751. },
  5752. FormToGrid: function (b, c, e, h) {
  5753. return this.each(function () {
  5754. if (this.grid) {
  5755. e || (e = "set");
  5756. h || (h = "first");
  5757. var w = a(c).serializeArray(),
  5758. t = {};
  5759. a.each(w,
  5760. function (a, b) {
  5761. t[b.name] = b.value
  5762. });
  5763. "add" === e ? a(this).jqGrid("addRowData", b, t, h) : "set" === e && a(this).jqGrid("setRowData", b, t)
  5764. }
  5765. })
  5766. }
  5767. })
  5768. })(jQuery); (function (a) {
  5769. a.fn.jqFilter = function (d) {
  5770. if ("string" === typeof d) {
  5771. var q = a.fn.jqFilter[d];
  5772. if (!q) throw "jqFilter - No such method: " + d;
  5773. var x = a.makeArray(arguments).slice(1);
  5774. return q.apply(this, x)
  5775. }
  5776. var n = a.extend(!0, {
  5777. filter: null,
  5778. columns: [],
  5779. onChange: null,
  5780. afterRedraw: null,
  5781. checkValues: null,
  5782. error: !1,
  5783. errmsg: "",
  5784. errorcheck: !0,
  5785. showQuery: !0,
  5786. sopt: null,
  5787. ops: [],
  5788. operands: null,
  5789. numopts: "eq ne lt le gt ge nu nn in ni".split(" "),
  5790. stropts: "eq ne bw bn ew en cn nc nu nn in ni".split(" "),
  5791. strarr: ["text", "string", "blob"],
  5792. groupOps: [{
  5793. op: "AND",
  5794. text: "AND"
  5795. },
  5796. {
  5797. op: "OR",
  5798. text: "OR"
  5799. }],
  5800. groupButton: !0,
  5801. ruleButtons: !0,
  5802. direction: "ltr"
  5803. },
  5804. a.jgrid.filter, d || {});
  5805. return this.each(function () {
  5806. if (!this.filter) {
  5807. this.p = n;
  5808. if (null === this.p.filter || void 0 === this.p.filter) this.p.filter = {
  5809. groupOp: this.p.groupOps[0].op,
  5810. rules: [],
  5811. groups: []
  5812. };
  5813. var d, q = this.p.columns.length,
  5814. f, w = /msie/i.test(navigator.userAgent) && !window.opera;
  5815. this.p.initFilter = a.extend(!0, {},
  5816. this.p.filter);
  5817. if (q) {
  5818. for (d = 0; d < q; d++) f = this.p.columns[d],
  5819. f.stype ? f.inputtype = f.stype : f.inputtype || (f.inputtype = "text"),
  5820. f.sorttype ? f.searchtype = f.sorttype : f.searchtype || (f.searchtype = "string"),
  5821. void 0 === f.hidden && (f.hidden = !1),
  5822. f.label || (f.label = f.name),
  5823. f.index && (f.name = f.index),
  5824. f.hasOwnProperty("searchoptions") || (f.searchoptions = {}),
  5825. f.hasOwnProperty("searchrules") || (f.searchrules = {});
  5826. 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>");
  5827. var u = function (g, l) {
  5828. var b = [!0, ""],
  5829. c = a("#" + a.jgrid.jqID(n.id))[0] || null;
  5830. if (a.isFunction(l.searchrules)) b = l.searchrules.call(c, g, l);
  5831. else if (a.jgrid && a.jgrid.checkValues) try {
  5832. b = a.jgrid.checkValues.call(c, g, -1, l.searchrules, l.label)
  5833. } catch (m) { }
  5834. b && b.length && !1 === b[0] && (n.error = !b[0], n.errmsg = b[1])
  5835. };
  5836. this.onchange = function () {
  5837. this.p.error = !1;
  5838. this.p.errmsg = "";
  5839. return a.isFunction(this.p.onChange) ? this.p.onChange.call(this, this.p) : !1
  5840. };
  5841. this.reDraw = function () {
  5842. a("table.group:first", this).remove();
  5843. var g = this.createTableForGroup(n.filter, null);
  5844. a(this).append(g);
  5845. a.isFunction(this.p.afterRedraw) && this.p.afterRedraw.call(this, this.p)
  5846. };
  5847. this.createTableForGroup = function (g, l) {
  5848. var b = this,
  5849. c, m = a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),
  5850. e = "left";
  5851. "rtl" === this.p.direction && (e = "right", m.attr("dir", "rtl"));
  5852. null === l && m.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='" + e + "'></th></tr>");
  5853. var h = a("<tr></tr>");
  5854. m.append(h);
  5855. e = a("<th colspan='5' align='" + e + "'></th>");
  5856. h.append(e);
  5857. if (!0 === this.p.ruleButtons) {
  5858. var d = a("<select class='opsel'></select>");
  5859. e.append(d);
  5860. var h = "",
  5861. k;
  5862. for (c = 0; c < n.groupOps.length; c++) k = g.groupOp === b.p.groupOps[c].op ? " selected='selected'" : "",
  5863. h += "<option value='" + b.p.groupOps[c].op + "'" + k + ">" + b.p.groupOps[c].text + "</option>";
  5864. d.append(h).bind("change",
  5865. function () {
  5866. g.groupOp = a(d).val();
  5867. b.onchange()
  5868. })
  5869. }
  5870. h = "<span></span>";
  5871. this.p.groupButton && (h = a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"), h.bind("click",
  5872. function () {
  5873. void 0 === g.groups && (g.groups = []);
  5874. g.groups.push({
  5875. groupOp: n.groupOps[0].op,
  5876. rules: [],
  5877. groups: []
  5878. });
  5879. b.reDraw();
  5880. b.onchange();
  5881. return !1
  5882. }));
  5883. e.append(h);
  5884. if (!0 === this.p.ruleButtons) {
  5885. var h = a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),
  5886. f;
  5887. h.bind("click",
  5888. function () {
  5889. void 0 === g.rules && (g.rules = []);
  5890. for (c = 0; c < b.p.columns.length; c++) {
  5891. var e = void 0 === b.p.columns[c].search ? !0 : b.p.columns[c].search,
  5892. l = !0 === b.p.columns[c].hidden;
  5893. if (!0 === b.p.columns[c].searchoptions.searchhidden && e || e && !l) {
  5894. f = b.p.columns[c];
  5895. break
  5896. }
  5897. }
  5898. 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;
  5899. g.rules.push({
  5900. field: f.name,
  5901. op: e[0],
  5902. data: ""
  5903. });
  5904. b.reDraw();
  5905. return !1
  5906. });
  5907. e.append(h)
  5908. }
  5909. null !== l && (h = a("<input type='button' value='-' title='Delete group' class='delete-group'/>"), e.append(h), h.bind("click",
  5910. function () {
  5911. for (c = 0; c < l.groups.length; c++) if (l.groups[c] === g) {
  5912. l.groups.splice(c, 1);
  5913. break
  5914. }
  5915. b.reDraw();
  5916. b.onchange();
  5917. return !1
  5918. }));
  5919. if (void 0 !== g.groups) for (c = 0; c < g.groups.length; c++) e = a("<tr></tr>"),
  5920. m.append(e),
  5921. h = a("<td class='first'></td>"),
  5922. e.append(h),
  5923. h = a("<td colspan='4'></td>"),
  5924. h.append(this.createTableForGroup(g.groups[c], g)),
  5925. e.append(h);
  5926. void 0 === g.groupOp && (g.groupOp = b.p.groupOps[0].op);
  5927. if (void 0 !== g.rules) for (c = 0; c < g.rules.length; c++) m.append(this.createTableRowForRule(g.rules[c], g));
  5928. return m
  5929. };
  5930. this.createTableRowForRule = function (g, l) {
  5931. var b = this,
  5932. c = a("#" + a.jgrid.jqID(n.id))[0] || null,
  5933. m = a("<tr></tr>"),
  5934. e,
  5935. h,
  5936. f,
  5937. k,
  5938. d = "",
  5939. s;
  5940. m.append("<td class='first'></td>");
  5941. var p = a("<td class='columns'></td>");
  5942. m.append(p);
  5943. var q = a("<select></select>"),
  5944. r,
  5945. t = [];
  5946. p.append(q);
  5947. q.bind("change",
  5948. function () {
  5949. g.field = a(q).val();
  5950. f = a(this).parents("tr:first");
  5951. for (e = 0; e < b.p.columns.length; e++) if (b.p.columns[e].name === g.field) {
  5952. k = b.p.columns[e];
  5953. break
  5954. }
  5955. if (k) {
  5956. k.searchoptions.id = a.jgrid.randId();
  5957. w && "text" === k.inputtype && !k.searchoptions.size && (k.searchoptions.size = 10);
  5958. var d = a.jgrid.createEl.call(c, k.inputtype, k.searchoptions, "", !0, b.p.ajaxSelectOptions || {},
  5959. !0);
  5960. a(d).addClass("input-elm");
  5961. 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;
  5962. var l = "",
  5963. m = 0;
  5964. t = [];
  5965. a.each(b.p.ops,
  5966. function () {
  5967. t.push(this.oper)
  5968. });
  5969. for (e = 0; e < h.length; e++) r = a.inArray(h[e], t),
  5970. -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++);
  5971. a(".selectopts", f).empty().append(l);
  5972. a(".selectopts", f)[0].selectedIndex = 0;
  5973. 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"));
  5974. a(".data", f).empty().append(d);
  5975. a.jgrid.bindEv.call(c, d, k.searchoptions);
  5976. a(".input-elm", f).bind("change",
  5977. function (e) {
  5978. e = e.target;
  5979. 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;
  5980. b.onchange()
  5981. });
  5982. setTimeout(function () {
  5983. g.data = a(d).val();
  5984. b.onchange()
  5985. },
  5986. 0)
  5987. }
  5988. });
  5989. for (e = p = 0; e < b.p.columns.length; e++) {
  5990. s = void 0 === b.p.columns[e].search ? !0 : b.p.columns[e].search;
  5991. var u = !0 === b.p.columns[e].hidden;
  5992. if (!0 === b.p.columns[e].searchoptions.searchhidden && s || s && !u) s = "",
  5993. g.field === b.p.columns[e].name && (s = " selected='selected'", p = e),
  5994. d += "<option value='" + b.p.columns[e].name + "'" + s + ">" + b.p.columns[e].label + "</option>"
  5995. }
  5996. q.append(d);
  5997. d = a("<td class='operators'></td>");
  5998. m.append(d);
  5999. k = n.columns[p];
  6000. k.searchoptions.id = a.jgrid.randId();
  6001. w && "text" === k.inputtype && !k.searchoptions.size && (k.searchoptions.size = 10);
  6002. p = a.jgrid.createEl.call(c, k.inputtype, k.searchoptions, g.data, !0, b.p.ajaxSelectOptions || {},
  6003. !0);
  6004. if ("nu" === g.op || "nn" === g.op) a(p).attr("readonly", "true"),
  6005. a(p).attr("disabled", "true");
  6006. var v = a("<select class='selectopts'></select>");
  6007. d.append(v);
  6008. v.bind("change",
  6009. function () {
  6010. g.op = a(v).val();
  6011. f = a(this).parents("tr:first");
  6012. var c = a(".input-elm", f)[0];
  6013. "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"));
  6014. b.onchange()
  6015. });
  6016. 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;
  6017. d = "";
  6018. a.each(b.p.ops,
  6019. function () {
  6020. t.push(this.oper)
  6021. });
  6022. for (e = 0; e < h.length; e++) r = a.inArray(h[e], t),
  6023. -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>");
  6024. v.append(d);
  6025. d = a("<td class='data'></td>");
  6026. m.append(d);
  6027. d.append(p);
  6028. a.jgrid.bindEv.call(c, p, k.searchoptions);
  6029. a(p).addClass("input-elm").bind("change",
  6030. function () {
  6031. g.data = "custom" === k.inputtype ? k.searchoptions.custom_value.call(c, a(this).children(".customelement:first"), "get") : a(this).val();
  6032. b.onchange()
  6033. });
  6034. d = a("<td></td>");
  6035. 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",
  6036. function () {
  6037. for (e = 0; e < l.rules.length; e++) if (l.rules[e] === g) {
  6038. l.rules.splice(e, 1);
  6039. break
  6040. }
  6041. b.reDraw();
  6042. b.onchange();
  6043. return !1
  6044. }));
  6045. return m
  6046. };
  6047. this.getStringForGroup = function (a) {
  6048. var d = "(",
  6049. b;
  6050. if (void 0 !== a.groups) for (b = 0; b < a.groups.length; b++) {
  6051. 1 < d.length && (d += " " + a.groupOp + " ");
  6052. try {
  6053. d += this.getStringForGroup(a.groups[b])
  6054. } catch (c) {
  6055. alert(c)
  6056. }
  6057. }
  6058. if (void 0 !== a.rules) try {
  6059. for (b = 0; b < a.rules.length; b++) 1 < d.length && (d += " " + a.groupOp + " "),
  6060. d += this.getStringForRule(a.rules[b])
  6061. } catch (f) {
  6062. alert(f)
  6063. }
  6064. d += ")";
  6065. return "()" === d ? "" : d
  6066. };
  6067. this.getStringForRule = function (d) {
  6068. var f = "",
  6069. b = "",
  6070. c, m;
  6071. for (c = 0; c < this.p.ops.length; c++) if (this.p.ops[c].oper === d.op) {
  6072. f = this.p.operands.hasOwnProperty(d.op) ? this.p.operands[d.op] : "";
  6073. b = this.p.ops[c].oper;
  6074. break
  6075. }
  6076. for (c = 0; c < this.p.columns.length; c++) if (this.p.columns[c].name === d.field) {
  6077. m = this.p.columns[c];
  6078. break
  6079. }
  6080. if (void 0 == m) return "";
  6081. c = d.data;
  6082. if ("bw" === b || "bn" === b) c += "%";
  6083. if ("ew" === b || "en" === b) c = "%" + c;
  6084. if ("cn" === b || "nc" === b) c = "%" + c + "%";
  6085. if ("in" === b || "ni" === b) c = " (" + c + ")";
  6086. n.errorcheck && u(d.data, m);
  6087. return -1 !== a.inArray(m.searchtype, ["int", "integer", "float", "number", "currency"]) || "nn" === b || "nu" === b ? d.field + " " + f + " " + c : d.field + " " + f + ' "' + c + '"'
  6088. };
  6089. this.resetFilter = function () {
  6090. this.p.filter = a.extend(!0, {},
  6091. this.p.initFilter);
  6092. this.reDraw();
  6093. this.onchange()
  6094. };
  6095. this.hideError = function () {
  6096. a("th.ui-state-error", this).html("");
  6097. a("tr.error", this).hide()
  6098. };
  6099. this.showError = function () {
  6100. a("th.ui-state-error", this).html(this.p.errmsg);
  6101. a("tr.error", this).show()
  6102. };
  6103. this.toUserFriendlyString = function () {
  6104. return this.getStringForGroup(n.filter)
  6105. };
  6106. this.toString = function () {
  6107. function a(b) {
  6108. var c = "(",
  6109. f;
  6110. if (void 0 !== b.groups) for (f = 0; f < b.groups.length; f++) 1 < c.length && (c = "OR" === b.groupOp ? c + " || " : c + " && "),
  6111. c += a(b.groups[f]);
  6112. if (void 0 !== b.rules) for (f = 0; f < b.rules.length; f++) {
  6113. 1 < c.length && (c = "OR" === b.groupOp ? c + " || " : c + " && ");
  6114. var e = b.rules[f];
  6115. if (d.p.errorcheck) {
  6116. for (var h = void 0,
  6117. n = void 0,
  6118. h = 0; h < d.p.columns.length; h++) if (d.p.columns[h].name === e.field) {
  6119. n = d.p.columns[h];
  6120. break
  6121. }
  6122. n && u(e.data, n)
  6123. }
  6124. c += e.op + "(item." + e.field + ",'" + e.data + "')"
  6125. }
  6126. c += ")";
  6127. return "()" === c ? "" : c
  6128. }
  6129. var d = this;
  6130. return a(this.p.filter)
  6131. };
  6132. this.reDraw();
  6133. if (this.p.showQuery) this.onchange();
  6134. this.filter = !0
  6135. }
  6136. }
  6137. })
  6138. };
  6139. a.extend(a.fn.jqFilter, {
  6140. toSQLString: function () {
  6141. var a = "";
  6142. this.each(function () {
  6143. a = this.toUserFriendlyString()
  6144. });
  6145. return a
  6146. },
  6147. filterData: function () {
  6148. var a;
  6149. this.each(function () {
  6150. a = this.p.filter
  6151. });
  6152. return a
  6153. },
  6154. getParameter: function (a) {
  6155. return void 0 !== a && this.p.hasOwnProperty(a) ? this.p[a] : this.p
  6156. },
  6157. resetFilter: function () {
  6158. return this.each(function () {
  6159. this.resetFilter()
  6160. })
  6161. },
  6162. addFilter: function (d) {
  6163. "string" === typeof d && (d = a.jgrid.parse(d));
  6164. this.each(function () {
  6165. this.p.filter = d;
  6166. this.reDraw();
  6167. this.onchange()
  6168. })
  6169. }
  6170. })
  6171. })(jQuery); (function (a) {
  6172. a.jgrid.inlineEdit = a.jgrid.inlineEdit || {};
  6173. a.jgrid.extend({
  6174. editRow: function (c, e, b, l, h, n, p, g, f) {
  6175. var m = {},
  6176. d = a.makeArray(arguments).slice(1);
  6177. "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));
  6178. m = a.extend(!0, {
  6179. keys: !1,
  6180. oneditfunc: null,
  6181. successfunc: null,
  6182. url: null,
  6183. extraparam: {},
  6184. aftersavefunc: null,
  6185. errorfunc: null,
  6186. afterrestorefunc: null,
  6187. restoreAfterError: !0,
  6188. mtype: "POST"
  6189. },
  6190. a.jgrid.inlineEdit, m);
  6191. return this.each(function () {
  6192. var d = this,
  6193. f, e, b, g = 0,
  6194. h = null,
  6195. n = {},
  6196. l, q;
  6197. 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) {
  6198. f = q[b].name;
  6199. var l = !0 === d.p.treeGrid && f === d.p.ExpandColumn;
  6200. if (l) e = a("span:first", this).html();
  6201. else try {
  6202. e = a.unformat.call(d, this, {
  6203. rowId: c,
  6204. colModel: q[b]
  6205. },
  6206. b)
  6207. } catch (m) {
  6208. e = q[b].edittype && "textarea" === q[b].edittype ? a(this).text() : a(this).html()
  6209. }
  6210. if ("cb" !== f && "subgrid" !== f && "rn" !== f && (d.p.autoencode && (e = a.jgrid.htmlDecode(e)), n[f] = e, !0 === q[b].editable)) {
  6211. null === h && (h = b);
  6212. l ? a("span:first", this).html("") : a(this).html("");
  6213. var p = a.extend({},
  6214. q[b].editoptions || {},
  6215. {
  6216. id: c + "_" + f,
  6217. name: f
  6218. });
  6219. q[b].edittype || (q[b].edittype = "text");
  6220. if ("&nbsp;" === e || "&#160;" === e || 1 === e.length && 160 === e.charCodeAt(0)) e = "";
  6221. var x = a.jgrid.createEl.call(d, q[b].edittype, p, e, !0, a.extend({},
  6222. a.jgrid.ajaxOptions, d.p.ajaxSelectOptions || {}));
  6223. a(x).addClass("editable");
  6224. l ? a("span:first", this).append(x) : a(this).append(x);
  6225. a.jgrid.bindEv.call(d, x, p);
  6226. "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());
  6227. g++
  6228. }
  6229. }), 0 < g && (n.id = c, d.p.savedRow.push(n), a(l).attr("editable", "1"), setTimeout(function () {
  6230. a("td:eq(" + h + ") input", l).focus()
  6231. },
  6232. 0), !0 === m.keys && a(l).bind("keydown",
  6233. function (b) {
  6234. if (27 === b.keyCode) {
  6235. a(d).jqGrid("restoreRow", c, m.afterrestorefunc);
  6236. if (d.p._inlinenav) try {
  6237. a(d).jqGrid("showAddEditButtons")
  6238. } catch (f) { }
  6239. return !1
  6240. }
  6241. if (13 === b.keyCode) {
  6242. if ("TEXTAREA" === b.target.tagName) return !0;
  6243. if (a(d).jqGrid("saveRow", c, m) && d.p._inlinenav) try {
  6244. a(d).jqGrid("showAddEditButtons")
  6245. } catch (e) { }
  6246. return !1
  6247. }
  6248. }), a(d).triggerHandler("jqGridInlineEditRow", [c, m]), a.isFunction(m.oneditfunc) && m.oneditfunc.call(d, c))))))
  6249. })
  6250. },
  6251. saveRow: function (c, e, b, l, h, n, p) {
  6252. var g = a.makeArray(arguments).slice(1),
  6253. f = {};
  6254. "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));
  6255. var f = a.extend(!0, {
  6256. successfunc: null,
  6257. url: null,
  6258. extraparam: {},
  6259. aftersavefunc: null,
  6260. errorfunc: null,
  6261. afterrestorefunc: null,
  6262. restoreAfterError: !0,
  6263. mtype: "POST"
  6264. },
  6265. a.jgrid.inlineEdit, f),
  6266. m = !1,
  6267. d = this[0],
  6268. r,
  6269. k = {},
  6270. y = {},
  6271. v = {},
  6272. w,
  6273. z,
  6274. u;
  6275. if (!d.grid) return m;
  6276. u = a(d).jqGrid("getInd", c, !0);
  6277. if (!1 === u) return m;
  6278. g = a.isFunction(f.beforeSaveRow) ? f.beforeSaveRow.call(d, f, c) : void 0;
  6279. void 0 === g && (g = !0);
  6280. if (g) {
  6281. g = a(u).attr("editable");
  6282. f.url = f.url || d.p.editurl;
  6283. if ("1" === g) {
  6284. var t;
  6285. a('td[role="gridcell"]', u).each(function (c) {
  6286. t = d.p.colModel[c];
  6287. r = t.name;
  6288. if ("cb" !== r && "subgrid" !== r && !0 === t.editable && "rn" !== r && !a(this).hasClass("not-editable-cell")) {
  6289. switch (t.edittype) {
  6290. case "checkbox":
  6291. var b = ["Yes", "No"];
  6292. t.editoptions && (b = t.editoptions.value.split(":"));
  6293. k[r] = a("input", this).is(":checked") ? b[0] : b[1];
  6294. break;
  6295. case "text":
  6296. case "password":
  6297. case "textarea":
  6298. case "button":
  6299. k[r] = a("input, textarea", this).val();
  6300. break;
  6301. case "select":
  6302. if (t.editoptions.multiple) {
  6303. var b = a("select", this),
  6304. e = [];
  6305. k[r] = a(b).val();
  6306. k[r] = k[r] ? k[r].join(",") : "";
  6307. a("select option:selected", this).each(function (d, b) {
  6308. e[d] = a(b).text()
  6309. });
  6310. y[r] = e.join(",")
  6311. } else k[r] = a("select option:selected", this).val(),
  6312. y[r] = a("select option:selected", this).text();
  6313. t.formatter && "select" === t.formatter && (y = {});
  6314. break;
  6315. case "custom":
  6316. try {
  6317. if (t.editoptions && a.isFunction(t.editoptions.custom_value)) {
  6318. if (k[r] = t.editoptions.custom_value.call(d, a(".customelement", this), "get"), void 0 === k[r]) throw "e2";
  6319. } else throw "e1";
  6320. } catch (g) {
  6321. "e1" === g && a.jgrid.info_dialog(a.jgrid.errors.errcap, "function 'custom_value' " + a.jgrid.edit.msg.nodefined, a.jgrid.edit.bClose),
  6322. "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)
  6323. }
  6324. }
  6325. z = a.jgrid.checkValues.call(d, k[r], c);
  6326. if (!1 === z[0]) return !1;
  6327. d.p.autoencode && (k[r] = a.jgrid.htmlEncode(k[r]));
  6328. "clientArray" !== f.url && t.editoptions && !0 === t.editoptions.NullIfEmpty && "" === k[r] && (v[r] = "null")
  6329. }
  6330. });
  6331. if (!1 === z[0]) {
  6332. try {
  6333. var q = a(d).jqGrid("getGridRowById", c),
  6334. s = a.jgrid.findPos(q);
  6335. a.jgrid.info_dialog(a.jgrid.errors.errcap, z[1], a.jgrid.edit.bClose, {
  6336. left: s[0],
  6337. top: s[1] + a(q).outerHeight()
  6338. })
  6339. } catch (A) {
  6340. alert(z[1])
  6341. }
  6342. return m
  6343. }
  6344. g = d.p.prmNames;
  6345. q = c;
  6346. 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;
  6347. 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({},
  6348. k, d.p.inlineData, f.extraparam));
  6349. if ("clientArray" === f.url) {
  6350. k = a.extend({},
  6351. k, y);
  6352. d.p.autoencode && a.each(k,
  6353. function (d, b) {
  6354. k[d] = a.jgrid.htmlDecode(b)
  6355. });
  6356. g = a(d).jqGrid("setRowData", c, k);
  6357. a(u).attr("editable", "0");
  6358. for (s = 0; s < d.p.savedRow.length; s++) if (String(d.p.savedRow[s].id) === String(q)) {
  6359. w = s;
  6360. break
  6361. }
  6362. 0 <= w && d.p.savedRow.splice(w, 1);
  6363. a(d).triggerHandler("jqGridInlineAfterSaveRow", [c, g, k, f]);
  6364. a.isFunction(f.aftersavefunc) && f.aftersavefunc.call(d, c, g, f);
  6365. m = !0;
  6366. a(u).removeClass("jqgrid-new-row").unbind("keydown")
  6367. } else a("#lui_" + a.jgrid.jqID(d.p.id)).show(),
  6368. v = a.extend({},
  6369. k, v),
  6370. v[s] = a.jgrid.stripPref(d.p.idPrefix, v[s]),
  6371. a.ajax(a.extend({
  6372. url: f.url,
  6373. data: a.isFunction(d.p.serializeRowData) ? d.p.serializeRowData.call(d, v) : v,
  6374. type: f.mtype,
  6375. async: !1,
  6376. complete: function (b, e) {
  6377. a("#lui_" + a.jgrid.jqID(d.p.id)).hide();
  6378. if ("success" === e) {
  6379. var g = !0,
  6380. h;
  6381. h = a(d).triggerHandler("jqGridInlineSuccessSaveRow", [b, c, f]);
  6382. a.isArray(h) || (h = [!0, k]);
  6383. h[0] && a.isFunction(f.successfunc) && (h = f.successfunc.call(d, b));
  6384. a.isArray(h) ? (g = h[0], k = h[1] || k) : g = h;
  6385. if (!0 === g) {
  6386. d.p.autoencode && a.each(k,
  6387. function (b, d) {
  6388. k[b] = a.jgrid.htmlDecode(d)
  6389. });
  6390. k = a.extend({},
  6391. k, y);
  6392. a(d).jqGrid("setRowData", c, k);
  6393. a(u).attr("editable", "0");
  6394. for (g = 0; g < d.p.savedRow.length; g++) if (String(d.p.savedRow[g].id) === String(c)) {
  6395. w = g;
  6396. break
  6397. }
  6398. 0 <= w && d.p.savedRow.splice(w, 1);
  6399. a(d).triggerHandler("jqGridInlineAfterSaveRow", [c, b, k, f]);
  6400. a.isFunction(f.aftersavefunc) && f.aftersavefunc.call(d, c, b);
  6401. m = !0;
  6402. a(u).removeClass("jqgrid-new-row").unbind("keydown")
  6403. } else a(d).triggerHandler("jqGridInlineErrorSaveRow", [c, b, e, null, f]),
  6404. a.isFunction(f.errorfunc) && f.errorfunc.call(d, c, b, e, null),
  6405. !0 === f.restoreAfterError && a(d).jqGrid("restoreRow", c, f.afterrestorefunc)
  6406. }
  6407. },
  6408. error: function (b, e, g) {
  6409. a("#lui_" + a.jgrid.jqID(d.p.id)).hide();
  6410. a(d).triggerHandler("jqGridInlineErrorSaveRow", [c, b, e, g, f]);
  6411. if (a.isFunction(f.errorfunc)) f.errorfunc.call(d, c, b, e, g);
  6412. else {
  6413. b = b.responseText || b.statusText;
  6414. try {
  6415. a.jgrid.info_dialog(a.jgrid.errors.errcap, '<div class="ui-state-error">' + b + "</div>", a.jgrid.edit.bClose, {
  6416. buttonalign: "right"
  6417. })
  6418. } catch (h) {
  6419. alert(b)
  6420. }
  6421. } !0 === f.restoreAfterError && a(d).jqGrid("restoreRow", c, f.afterrestorefunc)
  6422. }
  6423. },
  6424. a.jgrid.ajaxOptions, d.p.ajaxRowOptions || {}))
  6425. }
  6426. return m
  6427. }
  6428. },
  6429. restoreRow: function (c, e) {
  6430. var b = a.makeArray(arguments).slice(1),
  6431. l = {};
  6432. "object" === a.type(b[0]) ? l = b[0] : a.isFunction(e) && (l.afterrestorefunc = e);
  6433. l = a.extend(!0, {},
  6434. a.jgrid.inlineEdit, l);
  6435. return this.each(function () {
  6436. var b = this,
  6437. e = -1,
  6438. p, g = {},
  6439. f;
  6440. 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))) {
  6441. for (f = 0; f < b.p.savedRow.length; f++) if (String(b.p.savedRow[f].id) === String(c)) {
  6442. e = f;
  6443. break
  6444. }
  6445. if (0 <= e) {
  6446. if (a.isFunction(a.fn.datepicker)) try {
  6447. a("input.hasDatepicker", "#" + a.jgrid.jqID(p.id)).datepicker("hide")
  6448. } catch (m) { }
  6449. a.each(b.p.colModel,
  6450. function () {
  6451. !0 === this.editable && b.p.savedRow[e].hasOwnProperty(this.name) && (g[this.name] = b.p.savedRow[e][this.name])
  6452. });
  6453. a(b).jqGrid("setRowData", c, g);
  6454. a(p).attr("editable", "0").unbind("keydown");
  6455. b.p.savedRow.splice(e, 1);
  6456. a("#" + a.jgrid.jqID(c), "#" + a.jgrid.jqID(b.p.id)).hasClass("jqgrid-new-row") && setTimeout(function () {
  6457. a(b).jqGrid("delRowData", c);
  6458. a(b).jqGrid("showAddEditButtons")
  6459. },
  6460. 0)
  6461. }
  6462. a(b).triggerHandler("jqGridInlineAfterRestoreRow", [c]);
  6463. a.isFunction(l.afterrestorefunc) && l.afterrestorefunc.call(b, c)
  6464. }
  6465. })
  6466. },
  6467. addRow: function (c) {
  6468. c = a.extend(!0, {
  6469. rowID: null,
  6470. initdata: {},
  6471. position: "first",
  6472. useDefValues: !0,
  6473. useFormatter: !1,
  6474. addRowParams: {
  6475. extraparam: {}
  6476. }
  6477. },
  6478. c || {});
  6479. return this.each(function () {
  6480. if (this.grid) {
  6481. var e = this,
  6482. b = a.isFunction(c.beforeAddRow) ? c.beforeAddRow.call(e, c.addRowParams) : void 0;
  6483. void 0 === b && (b = !0);
  6484. 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 () {
  6485. if (this.editoptions && this.editoptions.defaultValue) {
  6486. var b = this.editoptions.defaultValue,
  6487. b = a.isFunction(b) ? b.call(e) : b;
  6488. c.initdata[this.name] = b
  6489. }
  6490. }), 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)))
  6491. }
  6492. })
  6493. },
  6494. inlineNav: function (c, e) {
  6495. e = a.extend(!0, {
  6496. edit: !0,
  6497. editicon: "ui-icon-pencil",
  6498. add: !0,
  6499. addicon: "ui-icon-plus",
  6500. save: !0,
  6501. saveicon: "ui-icon-disk",
  6502. cancel: !0,
  6503. cancelicon: "ui-icon-cancel",
  6504. addParams: {
  6505. addRowParams: {
  6506. extraparam: {}
  6507. }
  6508. },
  6509. editParams: {},
  6510. restoreAfterSelect: !0
  6511. },
  6512. a.jgrid.nav, e || {});
  6513. return this.each(function () {
  6514. if (this.grid) {
  6515. var b = this,
  6516. l, h = a.jgrid.jqID(b.p.id);
  6517. b.p._inlinenav = !0;
  6518. if (!0 === e.addParams.useFormatter) {
  6519. var n = b.p.colModel,
  6520. p;
  6521. for (p = 0; p < n.length; p++) if (n[p].formatter && "actions" === n[p].formatter) {
  6522. n[p].formatoptions && (n = a.extend({
  6523. keys: !1,
  6524. onEdit: null,
  6525. onSuccess: null,
  6526. afterSave: null,
  6527. onError: null,
  6528. afterRestore: null,
  6529. extraparam: {},
  6530. url: null
  6531. },
  6532. n[p].formatoptions), e.addParams.addRowParams = {
  6533. keys: n.keys,
  6534. oneditfunc: n.onEdit,
  6535. successfunc: n.onSuccess,
  6536. url: n.url,
  6537. extraparam: n.extraparam,
  6538. aftersavefunc: n.afterSave,
  6539. errorfunc: n.onError,
  6540. afterrestorefunc: n.afterRestore
  6541. });
  6542. break
  6543. }
  6544. }
  6545. e.add && a(b).jqGrid("navButtonAdd", c, {
  6546. caption: e.addtext,
  6547. title: e.addtitle,
  6548. buttonicon: e.addicon,
  6549. id: b.p.id + "_iladd",
  6550. onClickButton: function () {
  6551. a(b).jqGrid("addRow", e.addParams);
  6552. 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"))
  6553. }
  6554. });
  6555. e.edit && a(b).jqGrid("navButtonAdd", c, {
  6556. caption: e.edittext,
  6557. title: e.edittitle,
  6558. buttonicon: e.editicon,
  6559. id: b.p.id + "_iledit",
  6560. onClickButton: function () {
  6561. var c = a(b).jqGrid("getGridParam", "selrow");
  6562. 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", {
  6563. gbox: "#gbox_" + h,
  6564. jqm: !0
  6565. }), a("#jqg_alrt").focus())
  6566. }
  6567. });
  6568. e.save && (a(b).jqGrid("navButtonAdd", c, {
  6569. caption: e.savetext || "",
  6570. title: e.savetitle || "Save row",
  6571. buttonicon: e.saveicon,
  6572. id: b.p.id + "_ilsave",
  6573. onClickButton: function () {
  6574. var c = b.p.savedRow[0].id;
  6575. if (c) {
  6576. var f = b.p.prmNames,
  6577. m = f.oper,
  6578. d = e.editParams;
  6579. 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);
  6580. a(b).jqGrid("saveRow", c, d) && a(b).jqGrid("showAddEditButtons")
  6581. } else a.jgrid.viewModal("#alertmod", {
  6582. gbox: "#gbox_" + h,
  6583. jqm: !0
  6584. }),
  6585. a("#jqg_alrt").focus()
  6586. }
  6587. }), a("#" + h + "_ilsave").addClass("ui-state-disabled"));
  6588. e.cancel && (a(b).jqGrid("navButtonAdd", c, {
  6589. caption: e.canceltext || "",
  6590. title: e.canceltitle || "Cancel row editing",
  6591. buttonicon: e.cancelicon,
  6592. id: b.p.id + "_ilcancel",
  6593. onClickButton: function () {
  6594. var c = b.p.savedRow[0].id,
  6595. f = e.editParams;
  6596. 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", {
  6597. gbox: "#gbox_" + h,
  6598. jqm: !0
  6599. }), a("#jqg_alrt").focus())
  6600. }
  6601. }), 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) {
  6602. var h = !0;
  6603. 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"));
  6604. l && (h = l.call(b, c, f));
  6605. return h
  6606. })
  6607. }
  6608. })
  6609. },
  6610. showAddEditButtons: function () {
  6611. return this.each(function () {
  6612. if (this.grid) {
  6613. var c = a.jgrid.jqID(this.p.id);
  6614. a("#" + c + "_ilsave").addClass("ui-state-disabled");
  6615. a("#" + c + "_ilcancel").addClass("ui-state-disabled");
  6616. a("#" + c + "_iladd").removeClass("ui-state-disabled");
  6617. a("#" + c + "_iledit").removeClass("ui-state-disabled")
  6618. }
  6619. })
  6620. }
  6621. })
  6622. })(jQuery); (function (b) {
  6623. b.jgrid.extend({
  6624. editCell: function (d, f, a) {
  6625. return this.each(function () {
  6626. var c = this,
  6627. g, e, h, k;
  6628. if (c.grid && !0 === c.p.cellEdit) {
  6629. f = parseInt(f, 10);
  6630. c.p.selrow = c.rows[d].id;
  6631. c.p.knv || b(c).jqGrid("GridNav");
  6632. if (0 < c.p.savedRow.length) {
  6633. if (!0 === a && d == c.p.iRow && f == c.p.iCol) return;
  6634. b(c).jqGrid("saveCell", c.p.savedRow[0].id, c.p.savedRow[0].ic)
  6635. } else window.setTimeout(function () {
  6636. b("#" + b.jgrid.jqID(c.p.knv)).attr("tabindex", "-1").focus()
  6637. },
  6638. 0);
  6639. k = c.p.colModel[f];
  6640. g = k.name;
  6641. if ("subgrid" !== g && "cb" !== g && "rn" !== g) {
  6642. h = b("td:eq(" + f + ")", c.rows[d]);
  6643. 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")),
  6644. h.addClass("edit-cell ui-state-highlight"),
  6645. b(c.rows[d]).addClass("selected-row ui-state-hover"),
  6646. e = h.html().replace(/\&#160\;/ig, ""),
  6647. b(c).triggerHandler("jqGridSelectCell", [c.rows[d].id, g, e, d, f]),
  6648. b.isFunction(c.p.onSelectCell) && c.p.onSelectCell.call(c, c.rows[d].id, g, e, d, f);
  6649. else {
  6650. 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"));
  6651. b(h).addClass("edit-cell ui-state-highlight");
  6652. b(c.rows[d]).addClass("selected-row ui-state-hover");
  6653. try {
  6654. e = b.unformat.call(c, h, {
  6655. rowId: c.rows[d].id,
  6656. colModel: k
  6657. },
  6658. f)
  6659. } catch (m) {
  6660. e = k.edittype && "textarea" === k.edittype ? b(h).text() : b(h).html()
  6661. }
  6662. c.p.autoencode && (e = b.jgrid.htmlDecode(e));
  6663. k.edittype || (k.edittype = "text");
  6664. c.p.savedRow.push({
  6665. id: d,
  6666. ic: f,
  6667. name: g,
  6668. v: e
  6669. });
  6670. if ("&nbsp;" === e || "&#160;" === e || 1 === e.length && 160 === e.charCodeAt(0)) e = "";
  6671. if (b.isFunction(c.p.formatCell)) {
  6672. var l = c.p.formatCell.call(c, c.rows[d].id, g, e, d, f);
  6673. void 0 !== l && (e = l)
  6674. }
  6675. b(c).triggerHandler("jqGridBeforeEditCell", [c.rows[d].id, g, e, d, f]);
  6676. b.isFunction(c.p.beforeEditCell) && c.p.beforeEditCell.call(c, c.rows[d].id, g, e, d, f);
  6677. var l = b.extend({},
  6678. k.editoptions || {},
  6679. {
  6680. id: d + "_" + g,
  6681. name: g
  6682. }),
  6683. q = b.jgrid.createEl.call(c, k.edittype, l, e, !0, b.extend({},
  6684. b.jgrid.ajaxOptions, c.p.ajaxSelectOptions || {}));
  6685. b(h).html("").append(q).attr("tabindex", "0");
  6686. b.jgrid.bindEv.call(c, q, l);
  6687. window.setTimeout(function () {
  6688. b(q).focus()
  6689. },
  6690. 0);
  6691. b("input, select, textarea", h).bind("keydown",
  6692. function (a) {
  6693. 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));
  6694. if (13 === a.keyCode) return b(c).jqGrid("saveCell", d, f),
  6695. !1;
  6696. if (9 === a.keyCode) {
  6697. if (c.grid.hDiv.loading) return !1;
  6698. a.shiftKey ? b(c).jqGrid("prevCell", d, f) : b(c).jqGrid("nextCell", d, f)
  6699. }
  6700. a.stopPropagation()
  6701. });
  6702. b(c).triggerHandler("jqGridAfterEditCell", [c.rows[d].id, g, e, d, f]);
  6703. b.isFunction(c.p.afterEditCell) && c.p.afterEditCell.call(c, c.rows[d].id, g, e, d, f)
  6704. }
  6705. c.p.iCol = f;
  6706. c.p.iRow = d
  6707. }
  6708. }
  6709. })
  6710. },
  6711. saveCell: function (d, f) {
  6712. return this.each(function () {
  6713. var a = this,
  6714. c;
  6715. if (a.grid && !0 === a.p.cellEdit) {
  6716. c = 1 <= a.p.savedRow.length ? 0 : null;
  6717. if (null !== c) {
  6718. var g = b("td:eq(" + f + ")", a.rows[d]),
  6719. e,
  6720. h,
  6721. k = a.p.colModel[f],
  6722. m = k.name,
  6723. l = b.jgrid.jqID(m);
  6724. switch (k.edittype) {
  6725. case "select":
  6726. if (k.editoptions.multiple) {
  6727. var l = b("#" + d + "_" + l, a.rows[d]),
  6728. q = []; (e = b(l).val()) ? e.join(",") : e = "";
  6729. b("option:selected", l).each(function (a, c) {
  6730. q[a] = b(c).text()
  6731. });
  6732. h = q.join(",")
  6733. } else e = b("#" + d + "_" + l + " option:selected", a.rows[d]).val(),
  6734. h = b("#" + d + "_" + l + " option:selected", a.rows[d]).text();
  6735. k.formatter && (h = e);
  6736. break;
  6737. case "checkbox":
  6738. var n = ["Yes", "No"];
  6739. k.editoptions && (n = k.editoptions.value.split(":"));
  6740. h = e = b("#" + d + "_" + l, a.rows[d]).is(":checked") ? n[0] : n[1];
  6741. break;
  6742. case "password":
  6743. case "text":
  6744. case "textarea":
  6745. case "button":
  6746. h = e = b("#" + d + "_" + l, a.rows[d]).val();
  6747. break;
  6748. case "custom":
  6749. try {
  6750. if (k.editoptions && b.isFunction(k.editoptions.custom_value)) {
  6751. e = k.editoptions.custom_value.call(a, b(".customelement", g), "get");
  6752. if (void 0 === e) throw "e2";
  6753. h = e
  6754. } else throw "e1";
  6755. } catch (r) {
  6756. "e1" === r && b.jgrid.info_dialog(b.jgrid.errors.errcap, "function 'custom_value' " + b.jgrid.edit.msg.nodefined, b.jgrid.edit.bClose),
  6757. "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)
  6758. }
  6759. }
  6760. if (h !== a.p.savedRow[c].v) {
  6761. if (c = b(a).triggerHandler("jqGridBeforeSaveCell", [a.rows[d].id, m, e, d, f])) h = e = c;
  6762. b.isFunction(a.p.beforeSaveCell) && (c = a.p.beforeSaveCell.call(a, a.rows[d].id, m, e, d, f)) && (h = e = c);
  6763. var s = b.jgrid.checkValues.call(a, e, f);
  6764. if (!0 === s[0]) {
  6765. c = b(a).triggerHandler("jqGridBeforeSubmitCell", [a.rows[d].id, m, e, d, f]) || {};
  6766. b.isFunction(a.p.beforeSubmitCell) && ((c = a.p.beforeSubmitCell.call(a, a.rows[d].id, m, e, d, f)) || (c = {}));
  6767. 0 < b("input.hasDatepicker", g).length && b("input.hasDatepicker", g).datepicker("hide");
  6768. if ("remote" === a.p.cellsubmit) if (a.p.cellurl) {
  6769. var p = {};
  6770. a.p.autoencode && (e = b.jgrid.htmlEncode(e));
  6771. p[m] = e;
  6772. n = a.p.prmNames;
  6773. k = n.id;
  6774. l = n.oper;
  6775. p[k] = b.jgrid.stripPref(a.p.idPrefix, a.rows[d].id);
  6776. p[l] = n.editoper;
  6777. p = b.extend(c, p);
  6778. b("#lui_" + b.jgrid.jqID(a.p.id)).show();
  6779. a.grid.hDiv.loading = !0;
  6780. b.ajax(b.extend({
  6781. url: a.p.cellurl,
  6782. data: b.isFunction(a.p.serializeCellData) ? a.p.serializeCellData.call(a, p) : p,
  6783. type: "POST",
  6784. complete: function (c, k) {
  6785. b("#lui_" + a.p.id).hide();
  6786. a.grid.hDiv.loading = !1;
  6787. if ("success" === k) {
  6788. 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))
  6789. }
  6790. },
  6791. error: function (c, e, h) {
  6792. b("#lui_" + b.jgrid.jqID(a.p.id)).hide();
  6793. a.grid.hDiv.loading = !1;
  6794. b(a).triggerHandler("jqGridErrorCell", [c, e, h]);
  6795. 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);
  6796. b(a).jqGrid("restoreCell", d, f)
  6797. }
  6798. },
  6799. b.jgrid.ajaxOptions, a.p.ajaxCellOptions || {}))
  6800. } else try {
  6801. b.jgrid.info_dialog(b.jgrid.errors.errcap, b.jgrid.errors.nourl, b.jgrid.edit.bClose),
  6802. b(a).jqGrid("restoreCell", d, f)
  6803. } catch (t) { }
  6804. "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))
  6805. } else try {
  6806. window.setTimeout(function () {
  6807. b.jgrid.info_dialog(b.jgrid.errors.errcap, e + " " + s[1], b.jgrid.edit.bClose)
  6808. },
  6809. 100),
  6810. b(a).jqGrid("restoreCell", d, f)
  6811. } catch (u) { }
  6812. } else b(a).jqGrid("restoreCell", d, f)
  6813. }
  6814. window.setTimeout(function () {
  6815. b("#" + b.jgrid.jqID(a.p.knv)).attr("tabindex", "-1").focus()
  6816. },
  6817. 0)
  6818. }
  6819. })
  6820. },
  6821. restoreCell: function (d, f) {
  6822. return this.each(function () {
  6823. var a = this,
  6824. c;
  6825. if (a.grid && !0 === a.p.cellEdit) {
  6826. c = 1 <= a.p.savedRow.length ? 0 : null;
  6827. if (null !== c) {
  6828. var g = b("td:eq(" + f + ")", a.rows[d]);
  6829. if (b.isFunction(b.fn.datepicker)) try {
  6830. b("input.hasDatepicker", g).datepicker("hide")
  6831. } catch (e) { }
  6832. b(g).empty().attr("tabindex", "-1");
  6833. b(a).jqGrid("setCell", a.rows[d].id, f, a.p.savedRow[c].v, !1, !1, !0);
  6834. b(a).triggerHandler("jqGridAfterRestoreCell", [a.rows[d].id, a.p.savedRow[c].v, d, f]);
  6835. b.isFunction(a.p.afterRestoreCell) && a.p.afterRestoreCell.call(a, a.rows[d].id, a.p.savedRow[c].v, d, f);
  6836. a.p.savedRow.splice(0, 1)
  6837. }
  6838. window.setTimeout(function () {
  6839. b("#" + a.p.knv).attr("tabindex", "-1").focus()
  6840. },
  6841. 0)
  6842. }
  6843. })
  6844. },
  6845. nextCell: function (d, f) {
  6846. return this.each(function () {
  6847. var a = !1,
  6848. c;
  6849. if (this.grid && !0 === this.p.cellEdit) {
  6850. for (c = f + 1; c < this.p.colModel.length; c++) if (!0 === this.p.colModel[c].editable) {
  6851. a = c;
  6852. break
  6853. } !1 !== a ? b(this).jqGrid("editCell", d, a, !0) : 0 < this.p.savedRow.length && b(this).jqGrid("saveCell", d, f)
  6854. }
  6855. })
  6856. },
  6857. prevCell: function (d, f) {
  6858. return this.each(function () {
  6859. var a = !1,
  6860. c;
  6861. if (this.grid && !0 === this.p.cellEdit) {
  6862. for (c = f - 1; 0 <= c; c--) if (!0 === this.p.colModel[c].editable) {
  6863. a = c;
  6864. break
  6865. } !1 !== a ? b(this).jqGrid("editCell", d, a, !0) : 0 < this.p.savedRow.length && b(this).jqGrid("saveCell", d, f)
  6866. }
  6867. })
  6868. },
  6869. GridNav: function () {
  6870. return this.each(function () {
  6871. function d(c, d, e) {
  6872. if ("v" === e.substr(0, 1)) {
  6873. var f = b(a.grid.bDiv)[0].clientHeight,
  6874. g = b(a.grid.bDiv)[0].scrollTop,
  6875. n = a.rows[c].offsetTop + a.rows[c].clientHeight,
  6876. r = a.rows[c].offsetTop;
  6877. "vd" === e && n >= f && (b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop + a.rows[c].clientHeight);
  6878. "vu" === e && r < g && (b(a.grid.bDiv)[0].scrollTop = b(a.grid.bDiv)[0].scrollTop - a.rows[c].clientHeight)
  6879. }
  6880. "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))
  6881. }
  6882. function f(b, c) {
  6883. var d, e;
  6884. if ("lft" === c) for (d = b + 1, e = b; 0 <= e; e--) if (!0 !== a.p.colModel[e].hidden) {
  6885. d = e;
  6886. break
  6887. }
  6888. if ("rgt" === c) for (d = b - 1, e = b; e < a.p.colModel.length; e++) if (!0 !== a.p.colModel[e].hidden) {
  6889. d = e;
  6890. break
  6891. }
  6892. return d
  6893. }
  6894. var a = this;
  6895. if (a.grid && !0 === a.p.cellEdit) {
  6896. a.p.knv = a.p.id + "_kn";
  6897. 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>"),
  6898. g,
  6899. e;
  6900. b(c).insertBefore(a.grid.cDiv);
  6901. b("#" + a.p.knv).focus().keydown(function (c) {
  6902. e = c.keyCode;
  6903. "rtl" === a.p.direction && (37 === e ? e = 39 : 39 === e && (e = 37));
  6904. switch (e) {
  6905. case 38:
  6906. 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));
  6907. break;
  6908. case 40:
  6909. 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));
  6910. break;
  6911. case 37:
  6912. 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));
  6913. break;
  6914. case 39:
  6915. 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));
  6916. break;
  6917. case 13:
  6918. 0 <= parseInt(a.p.iCol, 10) && 0 <= parseInt(a.p.iRow, 10) && b(a).jqGrid("editCell", a.p.iRow, a.p.iCol, !0);
  6919. break;
  6920. default:
  6921. return !0
  6922. }
  6923. return !1
  6924. })
  6925. }
  6926. })
  6927. },
  6928. getChangedCells: function (d) {
  6929. var f = [];
  6930. d || (d = "all");
  6931. this.each(function () {
  6932. var a = this,
  6933. c;
  6934. a.grid && !0 === a.p.cellEdit && b(a.rows).each(function (g) {
  6935. var e = {};
  6936. b(this).hasClass("edited") && (b("td", this).each(function (f) {
  6937. c = a.p.colModel[f].name;
  6938. if ("cb" !== c && "subgrid" !== c) if ("dirty" === d) {
  6939. if (b(this).hasClass("dirty-cell")) try {
  6940. e[c] = b.unformat.call(a, this, {
  6941. rowId: a.rows[g].id,
  6942. colModel: a.p.colModel[f]
  6943. },
  6944. f)
  6945. } catch (k) {
  6946. e[c] = b.jgrid.htmlDecode(b(this).html())
  6947. }
  6948. } else try {
  6949. e[c] = b.unformat.call(a, this, {
  6950. rowId: a.rows[g].id,
  6951. colModel: a.p.colModel[f]
  6952. },
  6953. f)
  6954. } catch (m) {
  6955. e[c] = b.jgrid.htmlDecode(b(this).html())
  6956. }
  6957. }), e.id = this.id, f.push(e))
  6958. })
  6959. });
  6960. return f
  6961. }
  6962. })
  6963. })(jQuery); (function (c) {
  6964. c.fn.jqm = function (a) {
  6965. var k = {
  6966. overlay: 50,
  6967. closeoverlay: !0,
  6968. overlayClass: "jqmOverlay",
  6969. closeClass: "jqmClose",
  6970. trigger: ".jqModal",
  6971. ajax: d,
  6972. ajaxText: "",
  6973. target: d,
  6974. modal: d,
  6975. toTop: d,
  6976. onShow: d,
  6977. onHide: d,
  6978. onLoad: d
  6979. };
  6980. return this.each(function () {
  6981. if (this._jqm) return l[this._jqm].c = c.extend({},
  6982. l[this._jqm].c, a);
  6983. n++;
  6984. this._jqm = n;
  6985. l[n] = {
  6986. c: c.extend(k, c.jqm.params, a),
  6987. a: d,
  6988. w: c(this).addClass("jqmID" + n),
  6989. s: n
  6990. };
  6991. k.trigger && c(this).jqmAddTrigger(k.trigger)
  6992. })
  6993. };
  6994. c.fn.jqmAddClose = function (a) {
  6995. return r(this, a, "jqmHide")
  6996. };
  6997. c.fn.jqmAddTrigger = function (a) {
  6998. return r(this, a, "jqmShow")
  6999. };
  7000. c.fn.jqmShow = function (a) {
  7001. return this.each(function () {
  7002. c.jqm.open(this._jqm, a)
  7003. })
  7004. };
  7005. c.fn.jqmHide = function (a) {
  7006. return this.each(function () {
  7007. c.jqm.close(this._jqm, a)
  7008. })
  7009. };
  7010. c.jqm = {
  7011. hash: {},
  7012. open: function (a, k) {
  7013. var b = l[a],
  7014. e = b.c,
  7015. h = "." + e.closeClass,
  7016. f = parseInt(b.w.css("z-index")),
  7017. f = 0 < f ? f : 3E3,
  7018. g = c("<div></div>").css({
  7019. height: "100%",
  7020. width: "100%",
  7021. position: "fixed",
  7022. left: 0,
  7023. top: 0,
  7024. "z-index": f - 1,
  7025. opacity: e.overlay / 100
  7026. });
  7027. if (b.a) return d;
  7028. b.t = k;
  7029. b.a = !0;
  7030. b.w.css("z-index", f);
  7031. e.modal ? (m[0] || setTimeout(function () {
  7032. s("bind")
  7033. },
  7034. 1), m.push(a)) : 0 < e.overlay ? e.closeoverlay && b.w.jqmAddClose(g) : g = d;
  7035. b.o = g ? g.addClass(e.overlayClass).prependTo("body") : d;
  7036. 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,
  7037. function () {
  7038. e.onLoad && e.onLoad.call(this, b);
  7039. h && b.w.jqmAddClose(c(h, b.w));
  7040. p(b)
  7041. })) : h && b.w.jqmAddClose(c(h, b.w));
  7042. e.toTop && b.o && b.w.before('<span id="jqmP' + b.w[0]._jqm + '"></span>').insertAfter(b.o);
  7043. e.onShow ? e.onShow(b) : b.w.show();
  7044. p(b);
  7045. return d
  7046. },
  7047. close: function (a) {
  7048. a = l[a];
  7049. if (!a.a) return d;
  7050. a.a = d;
  7051. m[0] && (m.pop(), m[0] || s("unbind"));
  7052. a.c.toTop && a.o && c("#jqmP" + a.w[0]._jqm).after(a.w).remove();
  7053. if (a.c.onHide) a.c.onHide(a);
  7054. else a.w.hide(),
  7055. a.o && a.o.remove();
  7056. return d
  7057. },
  7058. params: {}
  7059. };
  7060. var n = 0,
  7061. l = c.jqm.hash,
  7062. m = [],
  7063. d = !1,
  7064. p = function (a) {
  7065. try {
  7066. c(":input:visible", a.w)[0].focus()
  7067. } catch (d) { }
  7068. },
  7069. s = function (a) {
  7070. c(document)[a]("keypress", q)[a]("keydown", q)[a]("mousedown", q)
  7071. },
  7072. q = function (a) {
  7073. var d = l[m[m.length - 1]],
  7074. b = !c(a.target).parents(".jqmID" + d.s)[0];
  7075. b && (c(".jqmID" + d.s).each(function () {
  7076. var d = c(this),
  7077. h = d.offset();
  7078. if (h.top <= a.pageY && a.pageY <= h.top + d.height() && h.left <= a.pageX && a.pageX <= h.left + d.width()) return b = !1
  7079. }), p(d));
  7080. return !b
  7081. },
  7082. r = function (a, k, b) {
  7083. return a.each(function () {
  7084. var a = this._jqm;
  7085. c(k).each(function () {
  7086. this[b] || (this[b] = [], c(this).click(function () {
  7087. for (var a in {
  7088. jqmShow: 1,
  7089. jqmHide: 1
  7090. }) for (var b in this[a]) if (l[this[a][b]]) l[this[a][b]].w[a](this);
  7091. return d
  7092. }));
  7093. this[b].push(a)
  7094. })
  7095. })
  7096. }
  7097. })(jQuery); (function (b) {
  7098. b.fn.jqDrag = function (a) {
  7099. return h(this, a, "d")
  7100. };
  7101. b.fn.jqResize = function (a, b) {
  7102. return h(this, a, "r", b)
  7103. };
  7104. b.jqDnR = {
  7105. dnr: {},
  7106. e: 0,
  7107. drag: function (a) {
  7108. "d" == d.k ? e.css({
  7109. left: d.X + a.pageX - d.pX,
  7110. top: d.Y + a.pageY - d.pY
  7111. }) : (e.css({
  7112. width: Math.max(a.pageX - d.pX + d.W, 0),
  7113. height: Math.max(a.pageY - d.pY + d.H, 0)
  7114. }), f && g.css({
  7115. width: Math.max(a.pageX - f.pX + f.W, 0),
  7116. height: Math.max(a.pageY - f.pY + f.H, 0)
  7117. }));
  7118. return !1
  7119. },
  7120. stop: function () {
  7121. b(document).unbind("mousemove", c.drag).unbind("mouseup", c.stop)
  7122. }
  7123. };
  7124. var c = b.jqDnR,
  7125. d = c.dnr,
  7126. e = c.e,
  7127. g, f, h = function (a, c, h, n) {
  7128. return a.each(function () {
  7129. c = c ? b(c, a) : a;
  7130. c.bind("mousedown", {
  7131. e: a,
  7132. k: h
  7133. },
  7134. function (a) {
  7135. var c = a.data,
  7136. k = {};
  7137. e = c.e;
  7138. g = n ? b(n) : !1;
  7139. if ("relative" != e.css("position")) try {
  7140. e.position(k)
  7141. } catch (h) { }
  7142. d = {
  7143. X: k.left || l("left") || 0,
  7144. Y: k.top || l("top") || 0,
  7145. W: l("width") || e[0].scrollWidth || 0,
  7146. H: l("height") || e[0].scrollHeight || 0,
  7147. pX: a.pageX,
  7148. pY: a.pageY,
  7149. k: c.k
  7150. };
  7151. f = g && "d" != c.k ? {
  7152. X: k.left || m("left") || 0,
  7153. Y: k.top || m("top") || 0,
  7154. W: g[0].offsetWidth || m("width") || 0,
  7155. H: g[0].offsetHeight || m("height") || 0,
  7156. pX: a.pageX,
  7157. pY: a.pageY,
  7158. k: c.k
  7159. } : !1;
  7160. if (b("input.hasDatepicker", e[0])[0]) try {
  7161. b("input.hasDatepicker", e[0]).datepicker("hide")
  7162. } catch (p) { }
  7163. b(document).mousemove(b.jqDnR.drag).mouseup(b.jqDnR.stop);
  7164. return !1
  7165. })
  7166. })
  7167. },
  7168. l = function (a) {
  7169. return parseInt(e.css(a), 10) || !1
  7170. },
  7171. m = function (a) {
  7172. return parseInt(g.css(a), 10) || !1
  7173. }
  7174. })(jQuery); (function (b) {
  7175. b.jgrid.extend({
  7176. setSubGrid: function () {
  7177. return this.each(function () {
  7178. var d, c;
  7179. this.p.subGridOptions = b.extend({
  7180. plusicon: "ui-icon-plus",
  7181. minusicon: "ui-icon-minus",
  7182. openicon: "ui-icon-carat-1-sw",
  7183. expandOnLoad: !1,
  7184. delayOnLoad: 50,
  7185. selectOnExpand: !1,
  7186. selectOnCollapse: !1,
  7187. reloadOnExpand: !0
  7188. },
  7189. this.p.subGridOptions || {});
  7190. this.p.colNames.unshift("");
  7191. this.p.colModel.unshift({
  7192. name: "subgrid",
  7193. width: b.jgrid.cell_width ? this.p.subGridWidth + this.p.cellLayout : this.p.subGridWidth,
  7194. sortable: !1,
  7195. resizable: !1,
  7196. hidedlg: !0,
  7197. search: !1,
  7198. fixed: !0
  7199. });
  7200. d = this.p.subGridModel;
  7201. 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"
  7202. })
  7203. },
  7204. addSubGridCell: function (b, c) {
  7205. var a = "",
  7206. p, n;
  7207. this.each(function () {
  7208. a = this.formatCol(b, c);
  7209. n = this.p.id;
  7210. p = this.p.subGridOptions.plusicon
  7211. });
  7212. 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>"
  7213. },
  7214. addSubGrid: function (d, c) {
  7215. return this.each(function () {
  7216. var a = this;
  7217. if (a.grid) {
  7218. var p = function (c, d, h) {
  7219. d = b("<td align='" + a.p.subGridModel[0].align[h] + "'></td>").html(d);
  7220. b(c).append(d)
  7221. },
  7222. n = function (c, d) {
  7223. var h, f, e, g = b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  7224. k = b("<tr></tr>");
  7225. 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>"),
  7226. b(h).html(a.p.subGridModel[0].name[f]),
  7227. b(h).width(a.p.subGridModel[0].width[f]),
  7228. b(k).append(h);
  7229. b(g).append(k);
  7230. c && (e = a.p.xmlReader.subgrid, b(e.root + " " + e.row, c).each(function () {
  7231. k = b("<tr class='ui-widget-content ui-subtblcell'></tr>");
  7232. if (!0 === e.repeatitems) b(e.cell, this).each(function (a) {
  7233. p(k, b(this).text() || "&#160;", a)
  7234. });
  7235. else {
  7236. var c = a.p.subGridModel[0].mapping || a.p.subGridModel[0].name;
  7237. if (c) for (f = 0; f < c.length; f++) p(k, b(c[f], this).text() || "&#160;", f)
  7238. }
  7239. b(g).append(k)
  7240. }));
  7241. h = b("table:first", a.grid.bDiv).attr("id") + "_";
  7242. b("#" + b.jgrid.jqID(h + d)).append(g);
  7243. a.grid.hDiv.loading = !1;
  7244. b("#load_" + b.jgrid.jqID(a.p.id)).hide();
  7245. return !1
  7246. },
  7247. r = function (c, d) {
  7248. var h, f, e, g, k, m = b("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
  7249. l = b("<tr></tr>");
  7250. 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>"),
  7251. b(h).html(a.p.subGridModel[0].name[f]),
  7252. b(h).width(a.p.subGridModel[0].width[f]),
  7253. b(l).append(h);
  7254. b(m).append(l);
  7255. if (c && (g = a.p.jsonReader.subgrid, h = b.jgrid.getAccessor(c, g.root), void 0 !== h)) for (f = 0; f < h.length; f++) {
  7256. e = h[f];
  7257. l = b("<tr class='ui-widget-content ui-subtblcell'></tr>");
  7258. if (!0 === g.repeatitems) for (g.cell && (e = e[g.cell]), k = 0; k < e.length; k++) p(l, e[k] || "&#160;", k);
  7259. else {
  7260. var n = a.p.subGridModel[0].mapping || a.p.subGridModel[0].name;
  7261. if (n.length) for (k = 0; k < n.length; k++) p(l, e[n[k]] || "&#160;", k)
  7262. }
  7263. b(m).append(l)
  7264. }
  7265. f = b("table:first", a.grid.bDiv).attr("id") + "_";
  7266. b("#" + b.jgrid.jqID(f + d)).append(m);
  7267. a.grid.hDiv.loading = !1;
  7268. b("#load_" + b.jgrid.jqID(a.p.id)).hide();
  7269. return !1
  7270. },
  7271. v = function (c) {
  7272. var e, d, f, g;
  7273. e = b(c).attr("id");
  7274. d = {
  7275. nd_: (new Date).getTime()
  7276. };
  7277. d[a.p.prmNames.subgridid] = e;
  7278. if (!a.p.subGridModel[0]) return !1;
  7279. 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, ""));
  7280. 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) {
  7281. case "xml":
  7282. case "json":
  7283. b.ajax(b.extend({
  7284. type:
  7285. a.p.mtype,
  7286. url: a.p.subGridUrl,
  7287. dataType: a.p.subgridtype,
  7288. data: b.isFunction(a.p.serializeSubGridData) ? a.p.serializeSubGridData.call(a, d) : d,
  7289. complete: function (c) {
  7290. "xml" === a.p.subgridtype ? n(c.responseXML, e) : r(b.jgrid.parse(c.responseText), e)
  7291. }
  7292. },
  7293. b.jgrid.ajaxOptions, a.p.ajaxSubgridOptions || {}))
  7294. }
  7295. return !1
  7296. },
  7297. e,
  7298. m,
  7299. s,
  7300. t = 0,
  7301. g,
  7302. l;
  7303. b.each(a.p.colModel,
  7304. function () {
  7305. !0 !== this.hidden && "rn" !== this.name && "cb" !== this.name || t++
  7306. });
  7307. var u = a.rows.length,
  7308. q = 1;
  7309. void 0 !== c && 0 < c && (q = c, u = c + 1);
  7310. for (; q < u;) b(a.rows[q]).hasClass("jqgrow") && b(a.rows[q].cells[d]).bind("click",
  7311. function () {
  7312. var c = b(this).parent("tr")[0];
  7313. l = c.nextSibling;
  7314. if (b(this).hasClass("sgcollapsed")) {
  7315. m = a.p.id;
  7316. e = c.id;
  7317. if (!0 === a.p.subGridOptions.reloadOnExpand || !1 === a.p.subGridOptions.reloadOnExpand && !b(l).hasClass("ui-subgrid")) {
  7318. s = 1 <= d ? "<td colspan='" + d + "'>&#160;</td>" : "";
  7319. 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));
  7320. if (!1 === g) return !1;
  7321. 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>");
  7322. b(a).triggerHandler("jqGridSubGridRowExpanded", [m + "_" + e, e]);
  7323. b.isFunction(a.p.subGridRowExpanded) ? a.p.subGridRowExpanded.call(a, m + "_" + e, e) : v(c)
  7324. } else b(l).show();
  7325. b(this).html("<a style='cursor:pointer;'><span class='ui-icon " + a.p.subGridOptions.minusicon + "'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");
  7326. a.p.subGridOptions.selectOnExpand && b(a).jqGrid("setSelection", e)
  7327. } else if (b(this).hasClass("sgexpanded")) {
  7328. g = b(a).triggerHandler("jqGridSubGridRowColapsed", [m + "_" + e, e]);
  7329. g = !1 === g || "stop" === g ? !1 : !0;
  7330. e = c.id;
  7331. g && b.isFunction(a.p.subGridRowColapsed) && (g = a.p.subGridRowColapsed.call(a, m + "_" + e, e));
  7332. if (!1 === g) return !1; !0 === a.p.subGridOptions.reloadOnExpand ? b(l).remove(".ui-subgrid") : b(l).hasClass("ui-subgrid") && b(l).hide();
  7333. b(this).html("<a style='cursor:pointer;'><span class='ui-icon " + a.p.subGridOptions.plusicon + "'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");
  7334. a.p.subGridOptions.selectOnCollapse && b(a).jqGrid("setSelection", e)
  7335. }
  7336. return !1
  7337. }),
  7338. q++; !0 === a.p.subGridOptions.expandOnLoad && b(a.rows).filter(".jqgrow").each(function (a, c) {
  7339. b(c.cells[0]).click()
  7340. });
  7341. a.subGridXml = function (a, b) {
  7342. n(a, b)
  7343. };
  7344. a.subGridJson = function (a, b) {
  7345. r(a, b)
  7346. }
  7347. }
  7348. })
  7349. },
  7350. expandSubGridRow: function (d) {
  7351. return this.each(function () {
  7352. if ((this.grid || d) && !0 === this.p.subGrid) {
  7353. var c = b(this).jqGrid("getInd", d, !0);
  7354. c && (c = b("td.sgcollapsed", c)[0]) && b(c).trigger("click")
  7355. }
  7356. })
  7357. },
  7358. collapseSubGridRow: function (d) {
  7359. return this.each(function () {
  7360. if ((this.grid || d) && !0 === this.p.subGrid) {
  7361. var c = b(this).jqGrid("getInd", d, !0);
  7362. c && (c = b("td.sgexpanded", c)[0]) && b(c).trigger("click")
  7363. }
  7364. })
  7365. },
  7366. toggleSubGridRow: function (d) {
  7367. return this.each(function () {
  7368. if ((this.grid || d) && !0 === this.p.subGrid) {
  7369. var c = b(this).jqGrid("getInd", d, !0);
  7370. if (c) {
  7371. var a = b("td.sgcollapsed", c)[0];
  7372. a ? b(a).trigger("click") : (a = b("td.sgexpanded", c)[0]) && b(a).trigger("click")
  7373. }
  7374. }
  7375. })
  7376. }
  7377. })
  7378. })(jQuery); (function (d) {
  7379. d.extend(d.jgrid, {
  7380. template: function (b) {
  7381. var k = d.makeArray(arguments).slice(1),
  7382. a,
  7383. c = k.length;
  7384. null == b && (b = "");
  7385. return b.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
  7386. function (b, m) {
  7387. if (!isNaN(parseInt(m, 10))) return k[parseInt(m, 10)];
  7388. 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
  7389. })
  7390. }
  7391. });
  7392. d.jgrid.extend({
  7393. groupingSetup: function () {
  7394. return this.each(function () {
  7395. var b, k, a = this.p.colModel,
  7396. c = this.p.groupingView;
  7397. if (null === c || "object" !== typeof c && !d.isFunction(c)) this.p.grouping = !1;
  7398. else if (c.groupField.length) {
  7399. void 0 === c.visibiltyOnNextGrouping && (c.visibiltyOnNextGrouping = []);
  7400. c.lastvalues = [];
  7401. c._locgr || (c.groups = []);
  7402. c.counters = [];
  7403. for (b = 0; b < c.groupField.length; b++) c.groupOrder[b] || (c.groupOrder[b] = "asc"),
  7404. c.groupText[b] || (c.groupText[b] = "{0}"),
  7405. "boolean" !== typeof c.groupColumnShow[b] && (c.groupColumnShow[b] = !0),
  7406. "boolean" !== typeof c.groupSummary[b] && (c.groupSummary[b] = !1),
  7407. c.groupSummaryPos[b] || (c.groupSummaryPos[b] = "footer"),
  7408. !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]));
  7409. c.summary = [];
  7410. c.hideFirstGroupCol && (c.formatDisplayField[0] = function (a) {
  7411. return a
  7412. });
  7413. b = 0;
  7414. for (k = a.length; b < k; b++) c.hideFirstGroupCol && !a[b].hidden && c.groupField[0] === a[b].name && (a[b].formatter = function () {
  7415. return ""
  7416. }),
  7417. a[b].summaryType && (a[b].summaryDivider ? c.summary.push({
  7418. nm: a[b].name,
  7419. st: a[b].summaryType,
  7420. v: "",
  7421. sd: a[b].summaryDivider,
  7422. vd: "",
  7423. sr: a[b].summaryRound,
  7424. srt: a[b].summaryRoundType || "round"
  7425. }) : c.summary.push({
  7426. nm: a[b].name,
  7427. st: a[b].summaryType,
  7428. v: "",
  7429. sr: a[b].summaryRound,
  7430. srt: a[b].summaryRoundType || "round"
  7431. }))
  7432. } else this.p.grouping = !1
  7433. })
  7434. },
  7435. groupingPrepare: function (b, k) {
  7436. this.each(function () {
  7437. var a = this.p.groupingView,
  7438. c = this,
  7439. g, m = a.groupField.length,
  7440. e, f, h, p = 0;
  7441. for (g = 0; g < m; g++) e = a.groupField[g],
  7442. h = a.displayField[g],
  7443. f = b[e],
  7444. h = null == h ? null : b[h],
  7445. null == h && (h = f),
  7446. void 0 !== f && (0 === k ? (a.groups.push({
  7447. idx: g,
  7448. dataIndex: e,
  7449. value: f,
  7450. displayValue: h,
  7451. startRow: k,
  7452. cnt: 1,
  7453. summary: []
  7454. }), a.lastvalues[g] = f, a.counters[g] = {
  7455. cnt: 1,
  7456. pos: a.groups.length - 1,
  7457. summary: d.extend(!0, [], a.summary)
  7458. }) : "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({
  7459. idx: g,
  7460. dataIndex: e,
  7461. value: f,
  7462. displayValue: h,
  7463. startRow: k,
  7464. cnt: 1,
  7465. summary: []
  7466. }), a.lastvalues[g] = f, a.counters[g] = {
  7467. cnt: 1,
  7468. pos: a.groups.length - 1,
  7469. summary: d.extend(!0, [], a.summary)
  7470. }) : (a.counters[g].cnt += 1, a.groups[a.counters[g].pos].cnt = a.counters[g].cnt) : (a.groups.push({
  7471. idx: g,
  7472. dataIndex: e,
  7473. value: f,
  7474. displayValue: h,
  7475. startRow: k,
  7476. cnt: 1,
  7477. summary: []
  7478. }), a.lastvalues[g] = f, p = 1, a.counters[g] = {
  7479. cnt: 1,
  7480. pos: a.groups.length - 1,
  7481. summary: d.extend(!0, [], a.summary)
  7482. }), d.each(a.counters[g].summary,
  7483. function () {
  7484. 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)))
  7485. }), a.groups[a.counters[g].pos].summary = a.counters[g].summary)
  7486. });
  7487. return this
  7488. },
  7489. groupingToggle: function (b) {
  7490. this.each(function () {
  7491. var k = this.p.groupingView,
  7492. a = b.split("_"),
  7493. c = parseInt(a[a.length - 2], 10);
  7494. a.splice(a.length - 2, 2);
  7495. var g = a.join("_"),
  7496. a = k.minusicon,
  7497. m = k.plusicon,
  7498. e = d("#" + d.jgrid.jqID(b)),
  7499. e = e.length ? e[0].nextSibling : null,
  7500. f = d("#" + d.jgrid.jqID(b) + " span.tree-wrap-" + this.p.direction),
  7501. h = function (a) {
  7502. a = d.map(a.split(" "),
  7503. function (a) {
  7504. if (a.substring(0, g.length + 1) === g + "_") return parseInt(a.substring(g.length + 1), 10)
  7505. });
  7506. return 0 < a.length ? a[0] : void 0
  7507. },
  7508. p,
  7509. r = !1,
  7510. q = this.p.frozenColumns ? this.p.id + "_frozen" : !1,
  7511. n = q ? d("#" + d.jgrid.jqID(b), "#" + d.jgrid.jqID(q)) : !1,
  7512. n = n && n.length ? n[0].nextSibling : null;
  7513. if (f.hasClass(a)) {
  7514. if (k.showSummaryOnHide) {
  7515. if (e) for (; e && !(d(e).hasClass("jqfoot") && parseInt(d(e).attr("jqfootlevel"), 10) <= c) ;) d(e).hide(),
  7516. e = e.nextSibling,
  7517. q && (d(n).hide(), n = n.nextSibling)
  7518. } else if (e) for (; e;) {
  7519. k = h(e.className);
  7520. if (void 0 !== k && k <= c) break;
  7521. d(e).hide();
  7522. e = e.nextSibling;
  7523. q && (d(n).hide(), n = n.nextSibling)
  7524. }
  7525. f.removeClass(a).addClass(m);
  7526. r = !0
  7527. } else {
  7528. if (e) for (p = void 0; e;) {
  7529. k = h(e.className);
  7530. void 0 === p && (p = void 0 === k);
  7531. if (void 0 !== k) {
  7532. if (k <= c) break;
  7533. 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))
  7534. } else p && (d(e).show(), q && d(n).show());
  7535. e = e.nextSibling;
  7536. q && (n = n.nextSibling)
  7537. }
  7538. f.removeClass(m).addClass(a)
  7539. }
  7540. d(this).triggerHandler("jqGridGroupingClickGroup", [b, r]);
  7541. d.isFunction(this.p.onClickGroup) && this.p.onClickGroup.call(this, b, r)
  7542. });
  7543. return !1
  7544. },
  7545. groupingRender: function (b, k, a, c) {
  7546. return this.each(function () {
  7547. function g(a, b, c) {
  7548. var d = !1;
  7549. if (0 === b) d = c[a];
  7550. else {
  7551. var e = c[a].idx;
  7552. if (0 === e) d = c[a];
  7553. else for (; 0 <= a; a--) if (c[a].idx === e - b) {
  7554. d = c[a];
  7555. break
  7556. }
  7557. }
  7558. return d
  7559. }
  7560. function m(a, b, c, f) {
  7561. var h = g(a, b, c),
  7562. m = e.p.colModel,
  7563. n,
  7564. q = h.cnt;
  7565. a = "";
  7566. var p;
  7567. for (p = f; p < k; p++) {
  7568. var r = "<td " + e.formatCol(p, 1, "") + ">&#160;</td>",
  7569. t = "{0}";
  7570. d.each(h.summary,
  7571. function () {
  7572. if (this.nm === m[p].name) {
  7573. m[p].summaryTpl && (t = m[p].summaryTpl);
  7574. "string" === typeof this.st && "avg" === this.st.toLowerCase() && (this.sd && this.vd ? this.v /= this.vd : this.v && 0 < q && (this.v /= q));
  7575. try {
  7576. this.groupCount = h.cnt,
  7577. this.groupIndex = h.dataIndex,
  7578. this.groupValue = h.value,
  7579. n = e.formatter("", this.v, p, this)
  7580. } catch (a) {
  7581. n = this.v
  7582. }
  7583. r = "<td " + e.formatCol(p, 1, "") + ">" + d.jgrid.format(t, n) + "</td>";
  7584. return !1
  7585. }
  7586. });
  7587. a += r
  7588. }
  7589. return a
  7590. }
  7591. var e = this,
  7592. f = e.p.groupingView,
  7593. h = "",
  7594. p = "",
  7595. r, q, n = f.groupCollapse ? f.plusicon : f.minusicon,
  7596. t,
  7597. y = [],
  7598. z = f.groupField.length,
  7599. n = n + (" tree-wrap-" + e.p.direction);
  7600. d.each(e.p.colModel,
  7601. function (a, b) {
  7602. var c;
  7603. for (c = 0; c < z; c++) if (f.groupField[c] === b.name) {
  7604. y[c] = a;
  7605. break
  7606. }
  7607. });
  7608. var x = 0,
  7609. A = d.makeArray(f.groupSummary);
  7610. A.reverse();
  7611. d.each(f.groups,
  7612. function (g, l) {
  7613. if (f._locgr && !(l.startRow + l.cnt > (a - 1) * c && l.startRow < a * c)) return !0;
  7614. x++;
  7615. q = e.p.id + "ghead_" + l.idx;
  7616. r = q + "_" + g;
  7617. p = "<span style='cursor:pointer;' class='ui-icon " + n + "' onclick=\"jQuery('#" + d.jgrid.jqID(e.p.id) + "').jqGrid('groupingToggle','" + r + "');return false;\"></span>";
  7618. try {
  7619. 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)
  7620. } catch (C) {
  7621. t = l.displayValue
  7622. }
  7623. "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>";
  7624. if (z - 1 === l.idx) {
  7625. var s = f.groups[g + 1],
  7626. v,
  7627. u = 0;
  7628. v = l.startRow;
  7629. var B = void 0 !== s ? f.groups[g + 1].startRow : b.length;
  7630. f._locgr && (u = (a - 1) * c, u > l.startRow && (v = u));
  7631. for (; v < B && b[v - u]; v++) h += b[v - u].join("");
  7632. if ("header" !== f.groupSummaryPos[l.idx]) {
  7633. var w;
  7634. if (void 0 !== s) {
  7635. for (w = 0; w < f.groupField.length && s.dataIndex !== f.groupField[w]; w++);
  7636. x = f.groupField.length - w
  7637. }
  7638. 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>");
  7639. x = w
  7640. }
  7641. }
  7642. });
  7643. d("#" + d.jgrid.jqID(e.p.id) + " tbody:first").append(h);
  7644. h = null
  7645. })
  7646. },
  7647. groupingGroupBy: function (b, k) {
  7648. return this.each(function () {
  7649. "string" === typeof b && (b = [b]);
  7650. var a = this.p.groupingView;
  7651. this.p.grouping = !0;
  7652. void 0 === a.visibiltyOnNextGrouping && (a.visibiltyOnNextGrouping = []);
  7653. var c;
  7654. for (c = 0; c < a.groupField.length; c++) !a.groupColumnShow[c] && a.visibiltyOnNextGrouping[c] && d(this).jqGrid("showCol", a.groupField[c]);
  7655. for (c = 0; c < b.length; c++) a.visibiltyOnNextGrouping[c] = d("#" + d.jgrid.jqID(this.p.id) + "_" + d.jgrid.jqID(b[c])).is(":visible");
  7656. this.p.groupingView = d.extend(this.p.groupingView, k || {});
  7657. a.groupField = b;
  7658. d(this).trigger("reloadGrid")
  7659. })
  7660. },
  7661. groupingRemove: function (b) {
  7662. return this.each(function () {
  7663. void 0 === b && (b = !0);
  7664. this.p.grouping = !1;
  7665. if (!0 === b) {
  7666. var k = this.p.groupingView,
  7667. a;
  7668. for (a = 0; a < k.groupField.length; a++) !k.groupColumnShow[a] && k.visibiltyOnNextGrouping[a] && d(this).jqGrid("showCol", k.groupField);
  7669. d("tr.jqgroup, tr.jqfoot", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").remove();
  7670. d("tr.jqgrow:hidden", "#" + d.jgrid.jqID(this.p.id) + " tbody:first").show()
  7671. } else d(this).trigger("reloadGrid")
  7672. })
  7673. },
  7674. groupingCalculations: {
  7675. handler: function (b, d, a, c, g, m) {
  7676. var e = {
  7677. sum: function () {
  7678. return parseFloat(d || 0) + parseFloat(m[a] || 0)
  7679. },
  7680. min: function () {
  7681. return "" === d ? parseFloat(m[a] || 0) : Math.min(parseFloat(d), parseFloat(m[a] || 0))
  7682. },
  7683. max: function () {
  7684. return "" === d ? parseFloat(m[a] || 0) : Math.max(parseFloat(d), parseFloat(m[a] || 0))
  7685. },
  7686. count: function () {
  7687. "" === d && (d = 0);
  7688. return m.hasOwnProperty(a) ? d + 1 : 0
  7689. },
  7690. avg: function () {
  7691. return e.sum()
  7692. }
  7693. };
  7694. if (!e[b]) throw "jqGrid Grouping No such method: " + b;
  7695. b = e[b]();
  7696. null != c && ("fixed" === g ? b = b.toFixed(c) : (c = Math.pow(10, c), b = Math.round(b * c) / c));
  7697. return b
  7698. }
  7699. }
  7700. })
  7701. })(jQuery); (function (d) {
  7702. d.jgrid.extend({
  7703. setTreeNode: function (b, c) {
  7704. return this.each(function () {
  7705. var a = this;
  7706. if (a.grid && a.p.treeGrid) for (var h = a.p.expColInd,
  7707. e = a.p.treeReader.expanded_field,
  7708. k = a.p.treeReader.leaf_field,
  7709. g = a.p.treeReader.level_field,
  7710. f = a.p.treeReader.icon_field,
  7711. n = a.p.treeReader.loaded,
  7712. m, p, q, l; b < c;) l = d.jgrid.stripPref(a.p.idPrefix, a.rows[b].id),
  7713. l = a.p.data[a.p._index[l]],
  7714. "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]),
  7715. m = parseInt(l[g], 10),
  7716. 0 === a.p.tree_root_level ? (q = m + 1, p = m) : (q = m, p = m - 1),
  7717. q = "<div class='tree-wrap tree-wrap-" + a.p.direction + "' style='width:" + 18 * q + "px;'>",
  7718. q += "<div style='" + ("rtl" === a.p.direction ? "right:" : "left:") + 18 * p + "px;' class='ui-icon ",
  7719. void 0 !== l[n] && (l[n] = "true" === l[n] || !0 === l[n] ? !0 : !1),
  7720. "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 = ""),
  7721. l[e] = ("true" === l[e] || !0 === l[e] ? !0 : !1) && (l[n] || void 0 === l[n]),
  7722. 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'"),
  7723. q += "></div></div>",
  7724. d(a.rows[b].cells[h]).wrapInner("<span class='cell-wrapper" + p + "'></span>").prepend(q),
  7725. 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")),
  7726. d(a.rows[b].cells[h]).find("div.treeclick").bind("click",
  7727. function (b) {
  7728. b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
  7729. b = a.p._index[b];
  7730. 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])));
  7731. return !1
  7732. }),
  7733. !0 === a.p.ExpandColClick && d(a.rows[b].cells[h]).find("span.cell-wrapper").css("cursor", "pointer").bind("click",
  7734. function (b) {
  7735. b = d.jgrid.stripPref(a.p.idPrefix, d(b.target || b.srcElement, a.rows).closest("tr.jqgrow")[0].id);
  7736. var c = a.p._index[b];
  7737. 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])));
  7738. d(a).jqGrid("setSelection", b);
  7739. return !1
  7740. }),
  7741. b++
  7742. })
  7743. },
  7744. setTreeGrid: function () {
  7745. return this.each(function () {
  7746. var b = this,
  7747. c = 0,
  7748. a, h = !1,
  7749. e, k, g = [];
  7750. if (b.p.treeGrid) {
  7751. b.p.treedatatype || d.extend(b.p, {
  7752. treedatatype: b.p.datatype
  7753. });
  7754. b.p.subGrid = !1;
  7755. b.p.altRows = !1;
  7756. b.p.pgbuttons = !1;
  7757. b.p.pginput = !1;
  7758. b.p.gridview = !0;
  7759. null === b.p.rowTotal && (b.p.rowNum = 1E4);
  7760. b.p.multiselect = !1;
  7761. b.p.rowList = [];
  7762. b.p.expColInd = 0;
  7763. a = "ui-icon-triangle-1-" + ("rtl" === b.p.direction ? "w" : "e");
  7764. b.p.treeIcons = d.extend({
  7765. plus: a,
  7766. minus: "ui-icon-triangle-1-s",
  7767. leaf: "ui-icon-radio-off"
  7768. },
  7769. b.p.treeIcons || {});
  7770. "nested" === b.p.treeGridModel ? b.p.treeReader = d.extend({
  7771. level_field: "level",
  7772. left_field: "lft",
  7773. right_field: "rgt",
  7774. leaf_field: "isLeaf",
  7775. expanded_field: "expanded",
  7776. loaded: "loaded",
  7777. icon_field: "icon"
  7778. },
  7779. b.p.treeReader) : "adjacency" === b.p.treeGridModel && (b.p.treeReader = d.extend({
  7780. level_field: "level",
  7781. parent_id_field: "parent",
  7782. leaf_field: "isLeaf",
  7783. expanded_field: "expanded",
  7784. loaded: "loaded",
  7785. icon_field: "icon"
  7786. },
  7787. b.p.treeReader));
  7788. 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);
  7789. d.each(b.p.treeReader,
  7790. function (a, e) {
  7791. e && -1 === d.inArray(e, g) && ("leaf_field" === a && (b.p._treeleafpos = c), c++, b.p.colNames.push(e), b.p.colModel.push({
  7792. name: e,
  7793. width: 1,
  7794. hidden: !0,
  7795. sortable: !1,
  7796. resizable: !1,
  7797. hidedlg: !0,
  7798. editable: !0,
  7799. search: !1
  7800. }))
  7801. })
  7802. }
  7803. })
  7804. },
  7805. expandRow: function (b) {
  7806. this.each(function () {
  7807. var c = this;
  7808. if (c.grid && c.p.treeGrid) {
  7809. var a = d(c).jqGrid("getNodeChildren", b),
  7810. h = c.p.treeReader.expanded_field;
  7811. d(a).each(function () {
  7812. var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
  7813. d(d(c).jqGrid("getGridRowById", a)).css("display", "");
  7814. this[h] && d(c).jqGrid("expandRow", this)
  7815. })
  7816. }
  7817. })
  7818. },
  7819. collapseRow: function (b) {
  7820. this.each(function () {
  7821. var c = this;
  7822. if (c.grid && c.p.treeGrid) {
  7823. var a = d(c).jqGrid("getNodeChildren", b),
  7824. h = c.p.treeReader.expanded_field;
  7825. d(a).each(function () {
  7826. var a = c.p.idPrefix + d.jgrid.getAccessor(this, c.p.localReader.id);
  7827. d(d(c).jqGrid("getGridRowById", a)).css("display", "none");
  7828. this[h] && d(c).jqGrid("collapseRow", this)
  7829. })
  7830. }
  7831. })
  7832. },
  7833. getRootNodes: function () {
  7834. var b = [];
  7835. this.each(function () {
  7836. var c = this;
  7837. if (c.grid && c.p.treeGrid) switch (c.p.treeGridModel) {
  7838. case "nested":
  7839. var a = c.p.treeReader.level_field;
  7840. d(c.p.data).each(function () {
  7841. parseInt(this[a], 10) === parseInt(c.p.tree_root_level, 10) && b.push(this)
  7842. });
  7843. break;
  7844. case "adjacency":
  7845. var h = c.p.treeReader.parent_id_field;
  7846. d(c.p.data).each(function () {
  7847. null !== this[h] && "null" !== String(this[h]).toLowerCase() || b.push(this)
  7848. })
  7849. }
  7850. });
  7851. return b
  7852. },
  7853. getNodeDepth: function (b) {
  7854. var c = null;
  7855. this.each(function () {
  7856. if (this.grid && this.p.treeGrid) switch (this.p.treeGridModel) {
  7857. case "nested":
  7858. c = parseInt(b[this.p.treeReader.level_field], 10) - parseInt(this.p.tree_root_level, 10);
  7859. break;
  7860. case "adjacency":
  7861. c = d(this).jqGrid("getNodeAncestors", b).length
  7862. }
  7863. });
  7864. return c
  7865. },
  7866. getNodeParent: function (b) {
  7867. var c = null;
  7868. this.each(function () {
  7869. var a = this;
  7870. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7871. case "nested":
  7872. var h = a.p.treeReader.left_field,
  7873. e = a.p.treeReader.right_field,
  7874. k = a.p.treeReader.level_field,
  7875. g = parseInt(b[h], 10),
  7876. f = parseInt(b[e], 10),
  7877. n = parseInt(b[k], 10);
  7878. d(this.p.data).each(function () {
  7879. if (parseInt(this[k], 10) === n - 1 && parseInt(this[h], 10) < g && parseInt(this[e], 10) > f) return c = this,
  7880. !1
  7881. });
  7882. break;
  7883. case "adjacency":
  7884. var m = a.p.treeReader.parent_id_field,
  7885. p = a.p.localReader.id;
  7886. d(this.p.data).each(function () {
  7887. if (this[p] === d.jgrid.stripPref(a.p.idPrefix, b[m])) return c = this,
  7888. !1
  7889. })
  7890. }
  7891. });
  7892. return c
  7893. },
  7894. getNodeChildren: function (b) {
  7895. var c = [];
  7896. this.each(function () {
  7897. var a = this;
  7898. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7899. case "nested":
  7900. var h = a.p.treeReader.left_field,
  7901. e = a.p.treeReader.right_field,
  7902. k = a.p.treeReader.level_field,
  7903. g = parseInt(b[h], 10),
  7904. f = parseInt(b[e], 10),
  7905. n = parseInt(b[k], 10);
  7906. d(this.p.data).each(function () {
  7907. parseInt(this[k], 10) === n + 1 && parseInt(this[h], 10) > g && parseInt(this[e], 10) < f && c.push(this)
  7908. });
  7909. break;
  7910. case "adjacency":
  7911. var m = a.p.treeReader.parent_id_field,
  7912. p = a.p.localReader.id;
  7913. d(this.p.data).each(function () {
  7914. this[m] == d.jgrid.stripPref(a.p.idPrefix, b[p]) && c.push(this)
  7915. })
  7916. }
  7917. });
  7918. return c
  7919. },
  7920. getFullTreeNode: function (b) {
  7921. var c = [];
  7922. this.each(function () {
  7923. var a = this,
  7924. h;
  7925. if (a.grid && a.p.treeGrid) switch (a.p.treeGridModel) {
  7926. case "nested":
  7927. var e = a.p.treeReader.left_field,
  7928. k = a.p.treeReader.right_field,
  7929. g = a.p.treeReader.level_field,
  7930. f = parseInt(b[e], 10),
  7931. n = parseInt(b[k], 10),
  7932. m = parseInt(b[g], 10);
  7933. d(this.p.data).each(function () {
  7934. parseInt(this[g], 10) >= m && parseInt(this[e], 10) >= f && parseInt(this[e], 10) <= n && c.push(this)
  7935. });
  7936. break;
  7937. case "adjacency":
  7938. if (b) {
  7939. c.push(b);
  7940. var p = a.p.treeReader.parent_id_field,
  7941. q = a.p.localReader.id;
  7942. d(this.p.data).each(function (b) {
  7943. h = c.length;
  7944. for (b = 0; b < h; b++) if (d.jgrid.stripPref(a.p.idPrefix, c[b][q]) === this[p]) {
  7945. c.push(this);
  7946. break
  7947. }
  7948. })
  7949. }
  7950. }
  7951. });
  7952. return c
  7953. },
  7954. getNodeAncestors: function (b) {
  7955. var c = [];
  7956. this.each(function () {
  7957. if (this.grid && this.p.treeGrid) for (var a = d(this).jqGrid("getNodeParent", b) ; a;) c.push(a),
  7958. a = d(this).jqGrid("getNodeParent", a)
  7959. });
  7960. return c
  7961. },
  7962. isVisibleNode: function (b) {
  7963. var c = !0;
  7964. this.each(function () {
  7965. if (this.grid && this.p.treeGrid) {
  7966. var a = d(this).jqGrid("getNodeAncestors", b),
  7967. h = this.p.treeReader.expanded_field;
  7968. d(a).each(function () {
  7969. c = c && this[h];
  7970. if (!c) return !1
  7971. })
  7972. }
  7973. });
  7974. return c
  7975. },
  7976. isNodeLoaded: function (b) {
  7977. var c;
  7978. this.each(function () {
  7979. if (this.grid && this.p.treeGrid) {
  7980. var a = this.p.treeReader.leaf_field,
  7981. h = this.p.treeReader.loaded;
  7982. c = void 0 !== b ? void 0 !== b[h] ? b[h] : b[a] || 0 < d(this).jqGrid("getNodeChildren", b).length ? !0 : !1 : !1
  7983. }
  7984. });
  7985. return c
  7986. },
  7987. expandNode: function (b) {
  7988. return this.each(function () {
  7989. if (this.grid && this.p.treeGrid) {
  7990. var c = this.p.treeReader.expanded_field,
  7991. a = this.p.treeReader.parent_id_field,
  7992. h = this.p.treeReader.loaded,
  7993. e = this.p.treeReader.level_field,
  7994. k = this.p.treeReader.left_field,
  7995. g = this.p.treeReader.right_field;
  7996. if (!b[c]) {
  7997. var f = d.jgrid.getAccessor(b, this.p.localReader.id),
  7998. n = d("#" + this.p.idPrefix + d.jgrid.jqID(f), this.grid.bDiv)[0],
  7999. m = this.p._index[f];
  8000. 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", {
  8001. postData: {
  8002. nodeid: f,
  8003. n_left: b[k],
  8004. n_right: b[g],
  8005. n_level: b[e]
  8006. }
  8007. }) : d(this).jqGrid("setGridParam", {
  8008. postData: {
  8009. nodeid: f,
  8010. parentid: b[a],
  8011. n_level: b[e]
  8012. }
  8013. }), d(this).trigger("reloadGrid"), b[h] = !0, "nested" === this.p.treeGridModel ? d(this).jqGrid("setGridParam", {
  8014. postData: {
  8015. nodeid: "",
  8016. n_left: "",
  8017. n_right: "",
  8018. n_level: ""
  8019. }
  8020. }) : d(this).jqGrid("setGridParam", {
  8021. postData: {
  8022. nodeid: "",
  8023. parentid: "",
  8024. n_level: ""
  8025. }
  8026. }))
  8027. }
  8028. }
  8029. })
  8030. },
  8031. collapseNode: function (b) {
  8032. return this.each(function () {
  8033. if (this.grid && this.p.treeGrid) {
  8034. var c = this.p.treeReader.expanded_field;
  8035. 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"))
  8036. }
  8037. })
  8038. },
  8039. SortTree: function (b, c, a, h) {
  8040. return this.each(function () {
  8041. if (this.grid && this.p.treeGrid) {
  8042. var e, k, g, f = [],
  8043. n = this,
  8044. m;
  8045. e = d(this).jqGrid("getRootNodes");
  8046. e = d.jgrid.from(e);
  8047. e.orderBy(b, c, a, h);
  8048. m = e.select();
  8049. e = 0;
  8050. for (k = m.length; e < k; e++) g = m[e],
  8051. f.push(g),
  8052. d(this).jqGrid("collectChildrenSortTree", f, g, b, c, a, h);
  8053. d.each(f,
  8054. function (a) {
  8055. var b = d.jgrid.getAccessor(this, n.p.localReader.id);
  8056. d("#" + d.jgrid.jqID(n.p.id) + " tbody tr:eq(" + a + ")").after(d("tr#" + d.jgrid.jqID(b), n.grid.bDiv))
  8057. });
  8058. f = m = e = null
  8059. }
  8060. })
  8061. },
  8062. collectChildrenSortTree: function (b, c, a, h, e, k) {
  8063. return this.each(function () {
  8064. if (this.grid && this.p.treeGrid) {
  8065. var g, f, n, m;
  8066. g = d(this).jqGrid("getNodeChildren", c);
  8067. g = d.jgrid.from(g);
  8068. g.orderBy(a, h, e, k);
  8069. m = g.select();
  8070. g = 0;
  8071. for (f = m.length; g < f; g++) n = m[g],
  8072. b.push(n),
  8073. d(this).jqGrid("collectChildrenSortTree", b, n, a, h, e, k)
  8074. }
  8075. })
  8076. },
  8077. setTreeRow: function (b, c) {
  8078. var a = !1;
  8079. this.each(function () {
  8080. this.grid && this.p.treeGrid && (a = d(this).jqGrid("setRowData", b, c))
  8081. });
  8082. return a
  8083. },
  8084. delTreeNode: function (b) {
  8085. return this.each(function () {
  8086. var c = this.p.localReader.id,
  8087. a, h = this.p.treeReader.left_field,
  8088. e = this.p.treeReader.right_field,
  8089. k, g, f;
  8090. if (this.grid && this.p.treeGrid && (a = this.p._index[b], void 0 !== a)) {
  8091. k = parseInt(this.p.data[a][e], 10);
  8092. g = k - parseInt(this.p.data[a][h], 10) + 1;
  8093. var n = d(this).jqGrid("getFullTreeNode", this.p.data[a]);
  8094. if (0 < n.length) for (a = 0; a < n.length; a++) d(this).jqGrid("delRowData", n[a][c]);
  8095. if ("nested" === this.p.treeGridModel) {
  8096. c = d.jgrid.from(this.p.data).greater(h, k, {
  8097. stype: "integer"
  8098. }).select();
  8099. if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][h] = parseInt(c[f][h], 10) - g);
  8100. c = d.jgrid.from(this.p.data).greater(e, k, {
  8101. stype: "integer"
  8102. }).select();
  8103. if (c.length) for (f in c) c.hasOwnProperty(f) && (c[f][e] = parseInt(c[f][e], 10) - g)
  8104. }
  8105. }
  8106. })
  8107. },
  8108. addChildNode: function (b, c, a, h) {
  8109. var e = this[0];
  8110. if (a) {
  8111. var k = e.p.treeReader.expanded_field,
  8112. g = e.p.treeReader.leaf_field,
  8113. f = e.p.treeReader.level_field,
  8114. n = e.p.treeReader.parent_id_field,
  8115. m = e.p.treeReader.left_field,
  8116. p = e.p.treeReader.right_field,
  8117. q = e.p.treeReader.loaded,
  8118. l, u, t, w, s;
  8119. l = 0;
  8120. var v = c,
  8121. x;
  8122. void 0 === h && (h = !1);
  8123. if (void 0 === b || null === b) {
  8124. s = e.p.data.length - 1;
  8125. if (0 <= s) for (; 0 <= s;) l = Math.max(l, parseInt(e.p.data[s][e.p.localReader.id], 10)),
  8126. s--;
  8127. b = l + 1
  8128. }
  8129. var y = d(e).jqGrid("getInd", c);
  8130. x = !1;
  8131. 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));
  8132. u = s + 1;
  8133. void 0 === a[k] && (a[k] = !1);
  8134. void 0 === a[q] && (a[q] = !1);
  8135. a[f] = w;
  8136. void 0 === a[g] && (a[g] = !0);
  8137. "adjacency" === e.p.treeGridModel && (a[n] = c);
  8138. if ("nested" === e.p.treeGridModel) {
  8139. var r;
  8140. if (null !== c) {
  8141. g = parseInt(t[p], 10);
  8142. f = d.jgrid.from(e.p.data);
  8143. f = f.greaterOrEquals(p, g, {
  8144. stype: "integer"
  8145. });
  8146. f = f.select();
  8147. 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]);
  8148. a[m] = g;
  8149. a[p] = g + 1
  8150. } else {
  8151. g = parseInt(d(e).jqGrid("getCol", p, !1, "max"), 10);
  8152. f = d.jgrid.from(e.p.data).greater(m, g, {
  8153. stype: "integer"
  8154. }).select();
  8155. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][m] = parseInt(f[r][m], 10) + 2);
  8156. f = d.jgrid.from(e.p.data).greater(p, g, {
  8157. stype: "integer"
  8158. }).select();
  8159. if (f.length) for (r in f) f.hasOwnProperty(r) && (f[r][p] = parseInt(f[r][p], 10) + 2);
  8160. a[m] = g + 1;
  8161. a[p] = g + 2
  8162. }
  8163. }
  8164. if (null === c || d(e).jqGrid("isNodeLoaded", t) || x) d(e).jqGrid("addRowData", b, a, l, v),
  8165. d(e).jqGrid("setTreeNode", s, u);
  8166. t && !t[k] && h && d(e.rows[y]).find("div.treeclick").click()
  8167. }
  8168. }
  8169. })
  8170. })(jQuery); (function (d) {
  8171. function I(d, n) {
  8172. var h, e, v = [],
  8173. r;
  8174. if (!this || "function" !== typeof d || d instanceof RegExp) throw new TypeError;
  8175. r = this.length;
  8176. for (h = 0; h < r; h++) if (this.hasOwnProperty(h) && (e = this[h], d.call(n, e, h, this))) {
  8177. v.push(e);
  8178. break
  8179. }
  8180. return v
  8181. }
  8182. d.assocArraySize = function (d) {
  8183. var n = 0,
  8184. h;
  8185. for (h in d) d.hasOwnProperty(h) && n++;
  8186. return n
  8187. };
  8188. d.jgrid.extend({
  8189. pivotSetup: function (q, n) {
  8190. var h = [],
  8191. e = [],
  8192. v = [],
  8193. r = [],
  8194. b = {
  8195. grouping: !0,
  8196. groupingView: {
  8197. groupField: [],
  8198. groupSummary: [],
  8199. groupSummaryPos: []
  8200. }
  8201. },
  8202. f = [],
  8203. c = d.extend({
  8204. rowTotals: !1,
  8205. rowTotalsText: "Total",
  8206. colTotals: !1,
  8207. groupSummary: !0,
  8208. groupSummaryPos: "header",
  8209. frozenStaticCols: !1
  8210. },
  8211. n || {});
  8212. this.each(function () {
  8213. function n(C, c, a) {
  8214. C = I.call(C, c, a);
  8215. return 0 < C.length ? C[0] : null
  8216. }
  8217. function J(c, a) {
  8218. var d = 0,
  8219. f = !0,
  8220. h;
  8221. for (h in c) {
  8222. if (c[h] != this[d]) {
  8223. f = !1;
  8224. break
  8225. }
  8226. d++;
  8227. if (d >= this.length) break
  8228. }
  8229. f && (D = a);
  8230. return f
  8231. }
  8232. function E(c, a, f, h) {
  8233. var g = a.length,
  8234. b, k, e, l;
  8235. l = d.isArray(f) ? f.length : 1;
  8236. r = [];
  8237. for (e = r.root = 0; e < l; e++) {
  8238. var n = [],
  8239. m;
  8240. for (b = 0; b < g; b++) {
  8241. if (null == f) m = k = d.trim(a[b].member) + "_" + a[b].aggregator;
  8242. else {
  8243. m = f[e].replace(/\s+/g, "");
  8244. try {
  8245. k = 1 === g ? m : m + "_" + a[b].aggregator + "_" + b
  8246. } catch (v) { }
  8247. }
  8248. var t = h,
  8249. u = k,
  8250. x = n,
  8251. y = k,
  8252. w = h[k],
  8253. p = a[b].member,
  8254. q = c,
  8255. s = void 0;
  8256. switch (a[b].aggregator) {
  8257. case "sum":
  8258. s = parseFloat(w || 0) + parseFloat(q[p] || 0);
  8259. break;
  8260. case "count":
  8261. if ("" === w || null == w) w = 0;
  8262. s = q.hasOwnProperty(p) ? w + 1 : 0;
  8263. break;
  8264. case "min":
  8265. s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.min(parseFloat(w), parseFloat(q[p] || 0));
  8266. break;
  8267. case "max":
  8268. s = "" === w || null == w ? parseFloat(q[p] || 0) : Math.max(parseFloat(w), parseFloat(q[p] || 0))
  8269. }
  8270. t[u] = x[y] = s
  8271. }
  8272. r[m] = n
  8273. }
  8274. return h
  8275. }
  8276. function H(a) {
  8277. var d, b, g, k, e;
  8278. for (g in a) if (a.hasOwnProperty(g)) {
  8279. 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] = {
  8280. useColSpanStyle: !1,
  8281. groupHeaders: []
  8282. })), F[a.level] !== a.text && a.children.length && "_r_Totals" !== a.text && 0 < a.level && (f[a.level - 1].groupHeaders.push({
  8283. titleText: a.text
  8284. }), 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) {
  8285. b = 1;
  8286. for (d in a.fields) 1 === b && f[l - 1].groupHeaders.push({
  8287. startColumnName: d,
  8288. numberOfColumns: 1,
  8289. titleText: a.text
  8290. }),
  8291. b++;
  8292. f[l - 1].groupHeaders[f[l - 1].groupHeaders.length - 1].numberOfColumns = b - 1
  8293. } else f.splice(l - 1, 1);
  8294. null != a[g] && "object" === typeof a[g] && H(a[g]);
  8295. if ("level" === g && 0 < a.level) for (d in b = 0, a.fields) {
  8296. e = {};
  8297. for (k in c.aggregates[b]) if (c.aggregates[b].hasOwnProperty(k)) switch (k) {
  8298. case "member":
  8299. case "label":
  8300. case "aggregator":
  8301. break;
  8302. default:
  8303. e[k] = c.aggregates[b][k]
  8304. }
  8305. 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);
  8306. h.push(e);
  8307. b++
  8308. }
  8309. }
  8310. }
  8311. var m, D, a, y = q.length,
  8312. s, l, z, k, p = 0;
  8313. c.rowTotals && 0 < c.yDimension.length && (c.yDimension.splice(0, 0, {
  8314. dataName: c.yDimension[0].dataName
  8315. }), c.yDimension[0].converter = function () {
  8316. return "_r_Totals"
  8317. });
  8318. s = d.isArray(c.xDimension) ? c.xDimension.length : 0;
  8319. l = c.yDimension.length;
  8320. z = d.isArray(c.aggregates) ? c.aggregates.length : 0;
  8321. if (0 === s || 0 === z) throw "xDimension or aggregates optiona are not set!";
  8322. var x;
  8323. for (a = 0; a < s; a++) x = {
  8324. name: c.xDimension[a].dataName,
  8325. frozen: c.frozenStaticCols
  8326. },
  8327. x = d.extend(!0, x, c.xDimension[a]),
  8328. h.push(x);
  8329. x = s - 1;
  8330. for (var A = {}; p < y;) {
  8331. m = q[p];
  8332. var t = [],
  8333. u = [];
  8334. k = {};
  8335. a = 0;
  8336. do t[a] = d.trim(m[c.xDimension[a].dataName]),
  8337. k[c.xDimension[a].dataName] = t[a],
  8338. a++;
  8339. while (a < s);
  8340. var g = 0;
  8341. D = -1;
  8342. a = n(e, J, t);
  8343. if (!a) {
  8344. g = 0;
  8345. if (1 <= l) {
  8346. for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
  8347. c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
  8348. k = E(m, c.aggregates, u, k)
  8349. } else 0 === l && (k = E(m, c.aggregates, null, k));
  8350. e.push(k)
  8351. } else if (0 <= D) {
  8352. g = 0;
  8353. if (1 <= l) {
  8354. for (g = 0; g < l; g++) u[g] = d.trim(m[c.yDimension[g].dataName]),
  8355. c.yDimension[g].converter && d.isFunction(c.yDimension[g].converter) && (u[g] = c.yDimension[g].converter.call(this, u[g], t, u));
  8356. a = E(m, c.aggregates, u, a)
  8357. } else 0 === l && (a = E(m, c.aggregates, null, a));
  8358. e[D] = a
  8359. }
  8360. m = 0;
  8361. var t = k = null,
  8362. B;
  8363. for (B in r) {
  8364. if (0 === m) A.children && void 0 !== A.children || (A = {
  8365. text: B,
  8366. level: 0,
  8367. children: []
  8368. }),
  8369. k = A.children;
  8370. else {
  8371. t = null;
  8372. for (a = 0; a < k.length; a++) if (k[a].text === B) {
  8373. t = k[a];
  8374. break
  8375. }
  8376. t ? k = t.children : (k.push({
  8377. children: [],
  8378. text: B,
  8379. level: m,
  8380. fields: r[B]
  8381. }), k = k[k.length - 1].children)
  8382. }
  8383. m++
  8384. }
  8385. p++
  8386. }
  8387. var F = [],
  8388. G = h.length,
  8389. K = G;
  8390. 0 < l && (f[l - 1] = {
  8391. useColSpanStyle: !1,
  8392. groupHeaders: []
  8393. });
  8394. H(A, 0);
  8395. if (c.colTotals) for (p = e.length; p--;) for (a = s; a < h.length; a++) y = h[a].name,
  8396. v[y] = v[y] ? v[y] + parseFloat(e[p][y] || 0) : parseFloat(e[p][y] || 0);
  8397. if (0 < x) for (a = 0; a < x; a++) b.groupingView.groupField[a] = h[a].name,
  8398. b.groupingView.groupSummary[a] = c.groupSummary,
  8399. b.groupingView.groupSummaryPos[a] = c.groupSummaryPos;
  8400. else b.grouping = !1;
  8401. b.sortname = h[x].name;
  8402. b.groupingView.hideFirstGroupCol = !0
  8403. });
  8404. return {
  8405. colModel: h,
  8406. rows: e,
  8407. groupOptions: b,
  8408. groupHeaders: f,
  8409. summary: v
  8410. }
  8411. },
  8412. jqPivot: function (q, n, h, e) {
  8413. return this.each(function () {
  8414. function v(b) {
  8415. var f = jQuery(r).jqGrid("pivotSetup", b, n),
  8416. c = 0 < d.assocArraySize(f.summary) ? !0 : !1,
  8417. e = d.jgrid.from(f.rows);
  8418. for (b = 0; b < f.groupOptions.groupingView.groupField.length; b++) e.orderBy(f.groupOptions.groupingView.groupField[b], "a", "text", "");
  8419. jQuery(r).jqGrid(d.extend({
  8420. datastr: d.extend(e.select(), c ? {
  8421. userdata: f.summary
  8422. } : {}),
  8423. datatype: "jsonstring",
  8424. footerrow: c,
  8425. userDataOnFooter: c,
  8426. colModel: f.colModel,
  8427. viewrecords: !0,
  8428. sortname: n.xDimension[0].dataName
  8429. },
  8430. h || {},
  8431. f.groupOptions));
  8432. f = f.groupHeaders;
  8433. if (f.length) for (b = 0; b < f.length; b++) f[b] && f[b].groupHeaders.length && jQuery(r).jqGrid("setGroupHeaders", f[b]);
  8434. n.frozenStaticCols && jQuery(r).jqGrid("setFrozenColumns")
  8435. }
  8436. var r = this;
  8437. "string" === typeof q ? d.ajax(d.extend({
  8438. url: q,
  8439. dataType: "json",
  8440. success: function (b) {
  8441. v(d.jgrid.getAccessor(b, e && e.reader ? e.reader : "rows"))
  8442. }
  8443. },
  8444. e || {})) : v(q)
  8445. })
  8446. }
  8447. })
  8448. })(jQuery); (function (c) {
  8449. c.jgrid.extend({
  8450. jqGridImport: function (a) {
  8451. a = c.extend({
  8452. imptype: "xml",
  8453. impstring: "",
  8454. impurl: "",
  8455. mtype: "GET",
  8456. impData: {},
  8457. xmlGrid: {
  8458. config: "roots>grid",
  8459. data: "roots>rows"
  8460. },
  8461. jsonGrid: {
  8462. config: "grid",
  8463. data: "data"
  8464. },
  8465. ajaxOptions: {}
  8466. },
  8467. a || {});
  8468. return this.each(function () {
  8469. var d = this,
  8470. f = function (a, b) {
  8471. var e = c(b.xmlGrid.config, a)[0],
  8472. h = c(b.xmlGrid.data, a)[0],
  8473. f,
  8474. g;
  8475. if (xmlJsonClass.xml2json && c.jgrid.parse) {
  8476. e = xmlJsonClass.xml2json(e, " ");
  8477. e = c.jgrid.parse(e);
  8478. for (g in e) e.hasOwnProperty(g) && (f = e[g]);
  8479. h ? (h = e.grid.datatype, e.grid.datatype = "xmlstring", e.grid.datastr = a, c(d).jqGrid(f).jqGrid("setGridParam", {
  8480. datatype: h
  8481. })) : c(d).jqGrid(f)
  8482. } else alert("xml2json or parse are not present")
  8483. },
  8484. b = function (a, b) {
  8485. if (a && "string" === typeof a) {
  8486. var e = !1;
  8487. c.jgrid.useJSON && (c.jgrid.useJSON = !1, e = !0);
  8488. var f = c.jgrid.parse(a);
  8489. e && (c.jgrid.useJSON = !0);
  8490. e = f[b.jsonGrid.config];
  8491. if (f = f[b.jsonGrid.data]) {
  8492. var g = e.datatype;
  8493. e.datatype = "jsonstring";
  8494. e.datastr = f;
  8495. c(d).jqGrid(e).jqGrid("setGridParam", {
  8496. datatype: g
  8497. })
  8498. } else c(d).jqGrid(e)
  8499. }
  8500. };
  8501. switch (a.imptype) {
  8502. case "xml":
  8503. c.ajax(c.extend({
  8504. url:
  8505. a.impurl,
  8506. type: a.mtype,
  8507. data: a.impData,
  8508. dataType: "xml",
  8509. complete: function (b, g) {
  8510. "success" === g && (f(b.responseXML, a), c(d).triggerHandler("jqGridImportComplete", [b, a]), c.isFunction(a.importComplete) && a.importComplete(b))
  8511. }
  8512. },
  8513. a.ajaxOptions));
  8514. break;
  8515. case "xmlstring":
  8516. if (a.impstring && "string" === typeof a.impstring) {
  8517. var g = c.parseXML(a.impstring);
  8518. g && (f(g, a), c(d).triggerHandler("jqGridImportComplete", [g, a]), c.isFunction(a.importComplete) && a.importComplete(g), a.impstring = null);
  8519. g = null
  8520. }
  8521. break;
  8522. case "json":
  8523. c.ajax(c.extend({
  8524. url:
  8525. a.impurl,
  8526. type: a.mtype,
  8527. data: a.impData,
  8528. dataType: "json",
  8529. complete: function (f) {
  8530. try {
  8531. b(f.responseText, a),
  8532. c(d).triggerHandler("jqGridImportComplete", [f, a]),
  8533. c.isFunction(a.importComplete) && a.importComplete(f)
  8534. } catch (g) { }
  8535. }
  8536. },
  8537. a.ajaxOptions));
  8538. break;
  8539. case "jsonstring":
  8540. 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)
  8541. }
  8542. })
  8543. },
  8544. jqGridExport: function (a) {
  8545. a = c.extend({
  8546. exptype: "xmlstring",
  8547. root: "grid",
  8548. ident: "\t"
  8549. },
  8550. a || {});
  8551. var d = null;
  8552. this.each(function () {
  8553. if (this.grid) {
  8554. var f, b = c.extend(!0, {},
  8555. c(this).jqGrid("getGridParam"));
  8556. b.rownumbers && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8557. b.multiselect && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8558. b.subGrid && (b.colNames.splice(0, 1), b.colModel.splice(0, 1));
  8559. b.knv = null;
  8560. 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));
  8561. switch (a.exptype) {
  8562. case "xmlstring":
  8563. d = "<" + a.root + ">" + xmlJsonClass.json2xml(b, a.ident) + "</" + a.root + ">";
  8564. break;
  8565. case "jsonstring":
  8566. d = "{" + xmlJsonClass.toJson(b, a.root, a.ident, !1) + "}",
  8567. void 0 !== b.postData.filters && (d = d.replace(/filters":"/, 'filters":'), d = d.replace(/}]}"/, "}]}"))
  8568. }
  8569. }
  8570. });
  8571. return d
  8572. },
  8573. excelExport: function (a) {
  8574. a = c.extend({
  8575. exptype: "remote",
  8576. url: null,
  8577. oper: "oper",
  8578. tag: "excel",
  8579. exportOptions: {}
  8580. },
  8581. a || {});
  8582. return this.each(function () {
  8583. if (this.grid) {
  8584. var d;
  8585. "remote" === a.exptype && (d = c.extend({},
  8586. 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)
  8587. }
  8588. })
  8589. }
  8590. })
  8591. })(jQuery);
  8592. var xmlJsonClass = {
  8593. xml2json: function (a, b) {
  8594. 9 === a.nodeType && (a = a.documentElement);
  8595. var g = this.removeWhite(a),
  8596. g = this.toObj(g),
  8597. g = this.toJson(g, a.nodeName, "\t");
  8598. return "{\n" + b + (b ? g.replace(/\t/g, b) : g.replace(/\t|\n/g, "")) + "\n}"
  8599. },
  8600. json2xml: function (a, b) {
  8601. var g = function (a, b, e) {
  8602. var d = "",
  8603. f, k;
  8604. if (a instanceof Array) if (0 === a.length) d += e + "<" + b + ">__EMPTY_ARRAY_</" + b + ">\n";
  8605. else for (f = 0, k = a.length; f < k; f += 1) var n = e + g(a[f], b, e + "\t") + "\n",
  8606. d = d + n;
  8607. else if ("object" === typeof a) {
  8608. f = !1;
  8609. d += e + "<" + b;
  8610. for (k in a) a.hasOwnProperty(k) && ("@" === k.charAt(0) ? d += " " + k.substr(1) + '="' + a[k].toString() + '"' : f = !0);
  8611. d += f ? ">" : "/>";
  8612. if (f) {
  8613. 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")));
  8614. d += ("\n" === d.charAt(d.length - 1) ? e : "") + "</" + b + ">"
  8615. }
  8616. } 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 + ">"));
  8617. return d
  8618. },
  8619. f = "",
  8620. e;
  8621. for (e in a) a.hasOwnProperty(e) && (f += g(a[e], e, ""));
  8622. return b ? f.replace(/\t/g, b) : f.replace(/\t|\n/g, "")
  8623. },
  8624. toObj: function (a) {
  8625. var b = {},
  8626. g = /function/i;
  8627. if (1 === a.nodeType) {
  8628. if (a.attributes.length) {
  8629. var f;
  8630. for (f = 0; f < a.attributes.length; f += 1) b["@" + a.attributes[f].nodeName] = (a.attributes[f].nodeValue || "").toString()
  8631. }
  8632. if (a.firstChild) {
  8633. var e = f = 0,
  8634. h = !1,
  8635. c;
  8636. 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);
  8637. 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);
  8638. else a.attributes.length ? b["#text"] = this.escape(this.innerXml(a)) : b = this.escape(this.innerXml(a));
  8639. 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 = ""));
  8640. else if (e) if (1 < e) b = this.escape(this.innerXml(a));
  8641. else for (c = a.firstChild; c; c = c.nextSibling) if (g.test(a.firstChild.nodeValue)) {
  8642. b = a.firstChild.nodeValue;
  8643. break
  8644. } else b["#cdata"] = this.escape(c.nodeValue)
  8645. }
  8646. a.attributes.length || a.firstChild || (b = null)
  8647. } else 9 === a.nodeType ? b = this.toObj(a.documentElement) : alert("unhandled node type: " + a.nodeType);
  8648. return b
  8649. },
  8650. toJson: function (a, b, g, f) {
  8651. void 0 === f && (f = !0);
  8652. var e = b ? '"' + b + '"' : "",
  8653. h = "\t",
  8654. c = "\n";
  8655. f || (c = h = "");
  8656. if ("[]" === a) e += b ? ":[]" : "[]";
  8657. else if (a instanceof Array) {
  8658. var l, d, m = [];
  8659. d = 0;
  8660. for (l = a.length; d < l; d += 1) m[d] = this.toJson(a[d], "", g + h, f);
  8661. e += (b ? ":[" : "[") + (1 < m.length ? c + g + h + m.join("," + c + g + h) + c + g : m.join("")) + "]"
  8662. } else if (null === a) e += (b && ":") + "null";
  8663. else if ("object" === typeof a) {
  8664. l = [];
  8665. for (d in a) a.hasOwnProperty(d) && (l[l.length] = this.toJson(a[d], d, g + h, f));
  8666. e += (b ? ":{" : "{") + (1 < l.length ? c + g + h + l.join("," + c + g + h) + c + g : l.join("")) + "}"
  8667. } else e = "string" === typeof a ? e + ((b && ":") + '"' + a.replace(/\\/g, "\\\\").replace(/\"/g, '\\"') + '"') : e + ((b && ":") + a.toString());
  8668. return e
  8669. },
  8670. innerXml: function (a) {
  8671. var b = "";
  8672. if ("innerHTML" in a) b = a.innerHTML;
  8673. else {
  8674. var g = function (a) {
  8675. var b = "",
  8676. h;
  8677. if (1 === a.nodeType) {
  8678. b += "<" + a.nodeName;
  8679. for (h = 0; h < a.attributes.length; h += 1) b += " " + a.attributes[h].nodeName + '="' + (a.attributes[h].nodeValue || "").toString() + '"';
  8680. if (a.firstChild) {
  8681. b += ">";
  8682. for (h = a.firstChild; h; h = h.nextSibling) b += g(h);
  8683. b += "</" + a.nodeName + ">"
  8684. } else b += "/>"
  8685. } else 3 === a.nodeType ? b += a.nodeValue : 4 === a.nodeType && (b += "<![CDATA[" + a.nodeValue + "]]\x3e");
  8686. return b
  8687. };
  8688. for (a = a.firstChild; a; a = a.nextSibling) b += g(a)
  8689. }
  8690. return b
  8691. },
  8692. escape: function (a) {
  8693. return a.replace(/[\\]/g, "\\\\").replace(/[\"]/g, '\\"').replace(/[\n]/g, "\\n").replace(/[\r]/g, "\\r")
  8694. },
  8695. removeWhite: function (a) {
  8696. a.normalize();
  8697. var b;
  8698. for (b = a.firstChild; b;) if (3 === b.nodeType) if (b.nodeValue.match(/[^ \f\n\r\t\v]/)) b = b.nextSibling;
  8699. else {
  8700. var g = b.nextSibling;
  8701. a.removeChild(b);
  8702. b = g
  8703. } else 1 === b.nodeType && this.removeWhite(b),
  8704. b = b.nextSibling;
  8705. return a
  8706. }
  8707. };
  8708. function tableToGrid(l, m) {
  8709. jQuery(l).each(function () {
  8710. if (!this.grid) {
  8711. jQuery(this).width("99%");
  8712. var b = jQuery(this).width(),
  8713. c = jQuery("tr td:first-child input[type=checkbox]:first", jQuery(this)),
  8714. a = jQuery("tr td:first-child input[type=radio]:first", jQuery(this)),
  8715. c = 0 < c.length,
  8716. a = !c && 0 < a.length,
  8717. k = c || a,
  8718. d = [],
  8719. e = [];
  8720. jQuery("th", jQuery(this)).each(function () {
  8721. 0 === d.length && k ? (d.push({
  8722. name: "__selection__",
  8723. index: "__selection__",
  8724. width: 0,
  8725. hidden: !0
  8726. }), e.push("__selection__")) : (d.push({
  8727. name: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  8728. index: jQuery(this).attr("id") || jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  8729. width: jQuery(this).width() || 150
  8730. }), e.push(jQuery(this).html()))
  8731. });
  8732. var f = [],
  8733. g = [],
  8734. h = [];
  8735. jQuery("tbody > tr", jQuery(this)).each(function () {
  8736. var b = {},
  8737. a = 0;
  8738. jQuery("td", jQuery(this)).each(function () {
  8739. if (0 === a && k) {
  8740. var c = jQuery("input", jQuery(this)),
  8741. e = c.attr("value");
  8742. g.push(e || f.length);
  8743. c.is(":checked") && h.push(e);
  8744. b[d[a].name] = c.attr("value")
  8745. } else b[d[a].name] = jQuery(this).html();
  8746. a++
  8747. });
  8748. 0 < a && f.push(b)
  8749. });
  8750. jQuery(this).empty();
  8751. jQuery(this).addClass("scroll");
  8752. jQuery(this).jqGrid(jQuery.extend({
  8753. datatype: "local",
  8754. width: b,
  8755. colNames: e,
  8756. colModel: d,
  8757. multiselect: c
  8758. },
  8759. m || {}));
  8760. for (b = 0; b < f.length; b++) a = null,
  8761. 0 < g.length && (a = g[b]) && a.replace && (a = encodeURIComponent(a).replace(/[.\-%]/g, "_")),
  8762. null === a && (a = b + 1),
  8763. jQuery(this).jqGrid("addRowData", a, f[b]);
  8764. for (b = 0; b < h.length; b++) jQuery(this).jqGrid("setSelection", h[b])
  8765. }
  8766. })
  8767. }; (function (b) {
  8768. b.jgrid.msie && 8 === b.jgrid.msiever() && (b.expr[":"].hidden = function (b) {
  8769. return 0 === b.offsetWidth || 0 === b.offsetHeight || "none" === b.style.display
  8770. });
  8771. b.jgrid._multiselect = !1;
  8772. if (b.ui && b.ui.multiselect) {
  8773. if (b.ui.multiselect.prototype._setSelected) {
  8774. var r = b.ui.multiselect.prototype._setSelected;
  8775. b.ui.multiselect.prototype._setSelected = function (a, d) {
  8776. var c = r.call(this, a, d);
  8777. if (d && this.selectedList) {
  8778. var e = this.element;
  8779. this.selectedList.find("li").each(function () {
  8780. b(this).data("optionLink") && b(this).data("optionLink").remove().appendTo(e)
  8781. })
  8782. }
  8783. return c
  8784. }
  8785. }
  8786. b.ui.multiselect.prototype.destroy && (b.ui.multiselect.prototype.destroy = function () {
  8787. this.element.show();
  8788. this.container.remove();
  8789. void 0 === b.Widget ? b.widget.prototype.destroy.apply(this, arguments) : b.Widget.prototype.destroy.apply(this, arguments)
  8790. });
  8791. b.jgrid._multiselect = !0
  8792. }
  8793. b.jgrid.extend({
  8794. sortableColumns: function (a) {
  8795. return this.each(function () {
  8796. function d() {
  8797. c.p.disableClick = !0
  8798. }
  8799. var c = this,
  8800. e = b.jgrid.jqID(c.p.id),
  8801. e = {
  8802. tolerance: "pointer",
  8803. axis: "x",
  8804. scrollSensitivity: "1",
  8805. items: ">th:not(:has(#jqgh_" + e + "_cb,#jqgh_" + e + "_rn,#jqgh_" + e + "_subgrid),:hidden)",
  8806. placeholder: {
  8807. element: function (a) {
  8808. return b(document.createElement(a[0].nodeName)).addClass(a[0].className + " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]
  8809. },
  8810. update: function (b, a) {
  8811. a.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10));
  8812. a.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10))
  8813. }
  8814. },
  8815. update: function (a, e) {
  8816. var d = b(e.item).parent(),
  8817. d = b(">th", d),
  8818. f = {},
  8819. g = c.p.id + "_";
  8820. b.each(c.p.colModel,
  8821. function (b) {
  8822. f[this.name] = b
  8823. });
  8824. var l = [];
  8825. d.each(function () {
  8826. var a = b(">div", this).get(0).id.replace(/^jqgh_/, "").replace(g, "");
  8827. f.hasOwnProperty(a) && l.push(f[a])
  8828. });
  8829. b(c).jqGrid("remapColumns", l, !0, !0);
  8830. b.isFunction(c.p.sortable.update) && c.p.sortable.update(l);
  8831. setTimeout(function () {
  8832. c.p.disableClick = !1
  8833. },
  8834. 50)
  8835. }
  8836. };
  8837. c.p.sortable.options ? b.extend(e, c.p.sortable.options) : b.isFunction(c.p.sortable) && (c.p.sortable = {
  8838. update: c.p.sortable
  8839. });
  8840. if (e.start) {
  8841. var g = e.start;
  8842. e.start = function (b, a) {
  8843. d();
  8844. g.call(this, b, a)
  8845. }
  8846. } else e.start = d;
  8847. c.p.sortable.exclude && (e.items += ":not(" + c.p.sortable.exclude + ")");
  8848. a.sortable(e).data("sortable").floating = !0
  8849. })
  8850. },
  8851. columnChooser: function (a) {
  8852. function d(a, c) {
  8853. 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)))
  8854. }
  8855. var c = this;
  8856. if (!b("#colchooser_" + b.jgrid.jqID(c[0].p.id)).length) {
  8857. var e = b('<div id="colchooser_' + c[0].p.id + '" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),
  8858. g = b("select", e);
  8859. a = b.extend({
  8860. width: 420,
  8861. height: 240,
  8862. classname: null,
  8863. done: function (b) {
  8864. b && c.jqGrid("remapColumns", b, !0)
  8865. },
  8866. msel: "multiselect",
  8867. dlog: "dialog",
  8868. dialog_opts: {
  8869. minWidth: 470
  8870. },
  8871. dlog_opts: function (a) {
  8872. var c = {};
  8873. c[a.bSubmit] = function () {
  8874. a.apply_perm();
  8875. a.cleanup(!1)
  8876. };
  8877. c[a.bCancel] = function () {
  8878. a.cleanup(!0)
  8879. };
  8880. return b.extend(!0, {
  8881. buttons: c,
  8882. close: function () {
  8883. a.cleanup(!0)
  8884. },
  8885. modal: a.modal || !1,
  8886. resizable: a.resizable || !0,
  8887. width: a.width + 20
  8888. },
  8889. a.dialog_opts || {})
  8890. },
  8891. apply_perm: function () {
  8892. b("option", g).each(function () {
  8893. this.selected ? c.jqGrid("showCol", k[this.value].name) : c.jqGrid("hideCol", k[this.value].name)
  8894. });
  8895. var e = [];
  8896. b("option:selected", g).each(function () {
  8897. e.push(parseInt(this.value, 10))
  8898. });
  8899. b.each(e,
  8900. function () {
  8901. delete p[k[parseInt(this, 10)].name]
  8902. });
  8903. b.each(p,
  8904. function () {
  8905. var b = parseInt(this, 10);
  8906. var a = e,
  8907. c = b;
  8908. if (0 <= c) {
  8909. var d = a.slice(),
  8910. k = d.splice(c, Math.max(a.length - c, c));
  8911. c > a.length && (c = a.length);
  8912. d[c] = b;
  8913. e = d.concat(k)
  8914. } else e = void 0
  8915. });
  8916. a.done && a.done.call(c, e)
  8917. },
  8918. cleanup: function (b) {
  8919. d(a.dlog, e, "destroy");
  8920. d(a.msel, g, "destroy");
  8921. e.remove();
  8922. b && a.done && a.done.call(c)
  8923. },
  8924. msel_opts: {}
  8925. },
  8926. b.jgrid.col, a || {});
  8927. if (b.ui && b.ui.multiselect && "multiselect" === a.msel) {
  8928. if (!b.jgrid._multiselect) {
  8929. alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
  8930. return
  8931. }
  8932. a.msel_opts = b.extend(b.ui.multiselect.defaults, a.msel_opts)
  8933. }
  8934. a.caption && e.attr("title", a.caption);
  8935. a.classname && (e.addClass(a.classname), g.addClass(a.classname));
  8936. a.width && (b(">div", e).css({
  8937. width: a.width,
  8938. margin: "0 auto"
  8939. }), g.css("width", a.width));
  8940. a.height && (b(">div", e).css("height", a.height), g.css("height", a.height - 10));
  8941. var k = c.jqGrid("getGridParam", "colModel"),
  8942. t = c.jqGrid("getGridParam", "colNames"),
  8943. p = {},
  8944. f = [];
  8945. g.empty();
  8946. b.each(k,
  8947. function (a) {
  8948. p[this.name] = a;
  8949. this.hidedlg ? this.hidden || f.push(a) : g.append("<option value='" + a + "' " + (this.hidden ? "" : "selected='selected'") + ">" + b.jgrid.stripHtml(t[a]) + "</option>")
  8950. });
  8951. var q = b.isFunction(a.dlog_opts) ? a.dlog_opts.call(c, a) : a.dlog_opts;
  8952. d(a.dlog, e, q);
  8953. q = b.isFunction(a.msel_opts) ? a.msel_opts.call(c, a) : a.msel_opts;
  8954. d(a.msel, g, q)
  8955. }
  8956. },
  8957. sortableRows: function (a) {
  8958. return this.each(function () {
  8959. var d = this;
  8960. d.grid && !d.p.treeGrid && b.fn.sortable && (a = b.extend({
  8961. cursor: "move",
  8962. axis: "y",
  8963. items: ".jqgrow"
  8964. },
  8965. 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) {
  8966. b(e.item).css("border-width", "0");
  8967. b("td", e.item).each(function (b) {
  8968. this.style.width = d.grid.cols[b].style.width
  8969. });
  8970. if (d.p.subGrid) {
  8971. var g = b(e.item).attr("id");
  8972. try {
  8973. b(d).jqGrid("collapseSubGridRow", g)
  8974. } catch (k) { }
  8975. }
  8976. a._start_ && a._start_.apply(this, [c, e])
  8977. },
  8978. a.update = function (c, e) {
  8979. b(e.item).css("border-width", ""); !0 === d.p.rownumbers && b("td.jqgrid-rownum", d.rows).each(function (a) {
  8980. b(this).html(a + 1 + (parseInt(d.p.page, 10) - 1) * parseInt(d.p.rowNum, 10))
  8981. });
  8982. a._update_ && a._update_.apply(this, [c, e])
  8983. },
  8984. b("tbody:first", d).sortable(a), b("tbody:first", d).disableSelection())
  8985. })
  8986. },
  8987. gridDnD: function (a) {
  8988. return this.each(function () {
  8989. function d() {
  8990. var a = b.data(c, "dnd");
  8991. b("tr.jqgrow:not(.ui-draggable)", c).draggable(b.isFunction(a.drag) ? a.drag.call(b(c), a) : a.drag)
  8992. }
  8993. var c = this,
  8994. e, g;
  8995. 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();
  8996. else if (a = b.extend({
  8997. drag: function (a) {
  8998. return b.extend({
  8999. start: function (e, d) {
  9000. var f;
  9001. if (c.p.subGrid) {
  9002. f = b(d.helper).attr("id");
  9003. try {
  9004. b(c).jqGrid("collapseSubGridRow", f)
  9005. } catch (g) { }
  9006. }
  9007. 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", {});
  9008. d.helper.addClass("ui-state-highlight");
  9009. b("td", d.helper).each(function (b) {
  9010. this.style.width = c.grid.headers[b].width + "px"
  9011. });
  9012. a.onstart && b.isFunction(a.onstart) && a.onstart.call(b(c), e, d)
  9013. },
  9014. stop: function (e, d) {
  9015. var f;
  9016. d.helper.dropped && !a.dragcopy && (f = b(d.helper).attr("id"), void 0 === f && (f = b(this).attr("id")), b(c).jqGrid("delRowData", f));
  9017. for (f = 0; f < b.data(c, "dnd").connectWith.length; f++) b(b.data(c, "dnd").connectWith[f]).jqGrid("delRowData", "jqg_empty_row");
  9018. a.onstop && b.isFunction(a.onstop) && a.onstop.call(b(c), e, d)
  9019. }
  9020. },
  9021. a.drag_opts || {})
  9022. },
  9023. drop: function (a) {
  9024. return b.extend({
  9025. accept: function (a) {
  9026. if (!b(a).hasClass("jqgrow")) return a;
  9027. a = b(a).closest("table.ui-jqgrid-btable");
  9028. 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
  9029. },
  9030. drop: function (e, d) {
  9031. if (b(d.draggable).hasClass("jqgrow")) {
  9032. var f = b(d.draggable).attr("id"),
  9033. f = d.draggable.parent().parent().jqGrid("getRowData", f);
  9034. if (!a.dropbyname) {
  9035. var g = 0,
  9036. l = {},
  9037. h, n, s = b("#" + b.jgrid.jqID(this.id)).jqGrid("getGridParam", "colModel");
  9038. try {
  9039. 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++);
  9040. f = l
  9041. } catch (r) { }
  9042. }
  9043. d.helper.dropped = !0;
  9044. 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));
  9045. if (d.helper.dropped) {
  9046. var m;
  9047. a.autoid && (b.isFunction(a.autoid) ? m = a.autoid.call(this, f) : (m = Math.ceil(1E3 * Math.random()), m = a.autoidprefix + m));
  9048. b("#" + b.jgrid.jqID(this.id)).jqGrid("addRowData", m, f, a.droppos)
  9049. }
  9050. a.ondrop && b.isFunction(a.ondrop) && a.ondrop.call(this, e, d, f)
  9051. }
  9052. }
  9053. },
  9054. a.drop_opts || {})
  9055. },
  9056. onstart: null,
  9057. onstop: null,
  9058. beforedrop: null,
  9059. ondrop: null,
  9060. drop_opts: {
  9061. activeClass: "ui-state-active",
  9062. hoverClass: "ui-state-hover"
  9063. },
  9064. drag_opts: {
  9065. revert: "invalid",
  9066. helper: "clone",
  9067. cursor: "move",
  9068. appendTo: "#jqgrid_dnd",
  9069. zIndex: 5E3
  9070. },
  9071. dragcopy: !1,
  9072. dropbyname: !1,
  9073. droppos: "first",
  9074. autoid: !0,
  9075. autoidprefix: "dnd_"
  9076. },
  9077. a || {}), a.connectWith) for (a.connectWith = a.connectWith.split(","), a.connectWith = b.map(a.connectWith,
  9078. function (a) {
  9079. return b.trim(a)
  9080. }), 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],
  9081. b(g).droppable(b.isFunction(a.drop) ? a.drop.call(b(c), a) : a.drop)
  9082. })
  9083. },
  9084. gridResize: function (a) {
  9085. return this.each(function () {
  9086. var d = this,
  9087. c = b.jgrid.jqID(d.p.id);
  9088. d.grid && b.fn.resizable && (a = b.extend({},
  9089. 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) {
  9090. b(d).jqGrid("setGridParam", {
  9091. height: b("#gview_" + c + " .ui-jqgrid-bdiv").height()
  9092. });
  9093. b(d).jqGrid("setGridWidth", g.size.width, a.shrinkToFit);
  9094. a._stop_ && a._stop_.call(d, e, g)
  9095. },
  9096. 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))
  9097. })
  9098. }
  9099. })
  9100. })(jQuery);