| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166 |
- package core.page;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.StringReader;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Comparator;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.LinkedList;
- import java.util.List;
- import java.util.Map;
- import java.util.Map.Entry;
- import java.util.Optional;
- import java.util.Set;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- import java.util.stream.Collectors;
- import com.google.gson.Gson;
- import com.google.gson.JsonArray;
- import com.google.gson.JsonElement;
- import com.google.gson.JsonObject;
- import com.google.gson.JsonParser;
- import org.apache.commons.lang3.StringUtils;
- import org.apache.logging.log4j.LogManager;
- import org.apache.logging.log4j.Logger;
- import org.dom4j.Document;
- import org.dom4j.DocumentHelper;
- import org.dom4j.Element;
- import base.SsC;
- import core.PrjApp;
- import ss.AppB;
- import ss.AppC;
- import ss.ccp.CcpB;
- import ss.ccp.CcpFieldB;
- import ss.cmn.file.FileU;
- import ss.cmn.ser.SerU;
- import ss.cmn.str.StrU;
- import ss.cmn.str.StrWeb;
- import ss.log.SsLog;
- import ss.log.ThdLog;
- import ss.obj.ObjB;
- import ss.obj.ObjC;
- import ss.obj.ObjFieldB;
- import ss.page.PageB;
- import ss.page.PageC;
- import ss.page.PageU;
- import ss.page.TabC;
- import ss.search.SearchC;
- import ss.skin.SkinC;
- // 来自 pms-core:XmslBjCompiler implements BjCompiler(接口类)。Lin
- public class PageComper {
- // 增加,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- private static final Logger log4j = LogManager.getLogger(PageComper.class);
- ///// 来自 FileTranslator。 // 移到 PageCompC。Lin
- // private static final String INTERPOLE_JSPTOP_BEGIN = "<!-- jsptopstart -->";
- // private static final String INTERPOLE_JSPTOP_END = "<!-- jsptopend -->";
- // private static final String INTERPOLE_HEAD_BEGIN = "<!-- injectheadstart -->";
- // private static final String INTERPOLE_HEAD_END = "<!-- injectheadend -->";
- /* 去掉,不写应用名。Lin
- private static final String SET_APPNAME_JSP = "pms/clip/SetAppName.jsp"; // "/main/sheji/setAppName.jsp"。Lin
- private static final String SET_APPNAME_SCRIPT = "<%-- setAppName.jsp is 404 --%><% pageContext.setAttribute(wd.core.web.service.ServiceConst.APP_NAME,\"#{APPNAME}#\");%>\n";
- private static final String SET_XMDM_JSP = "pms/clip/SetXmdm.jsp"; // "/main/sheji/setXmdm.jsp"。Lin
- private static final String SET_XMDM_SCRIPT = "<%-- setXmdm.jsp is 404 --%><% r\n if(pageContext.getSession().getAttribute(wd.core.common.CoreConstVars.XMMC)==null)\r\n\tpageContext.getSession().setAttribute(wd.core.common.CoreConstVars.XMMC,\"#{XMDM}#\");\r\n %>\r\n";
- */
- /* 去掉,不用文件,用常量 PageCompC.SCR_clearToken。Lin
- private static final String CLEAR_TOKEN_JSP = "pms/clip/ClearToken.jsp"; // "/main/sheji/tokenClear.jsp"。Lin
- private static final String CLEAR_TOKEN_SCRIPT = "<%-- tokenClear.jsp is 404 --%><script> tokenCleanser('<wd:token service='wd.removePageToken' dest='' param='' />',{'tokenList':'<%= pageContext.getAttribute(wd.core.common.CoreConstVars.WD_PAGE_TOKENLIST)%>'});</script>\r\n";
- */
- // private static final String ADD_REMOVE_TOKEN_SCRIPT = "<script> addRemoveToken('<%= pageContext.getAttribute(wd.core.common.CoreConstVars.WD_PAGE_TOKENLIST)%>');</script>\r\n";
- /////
- // 浅编译部件。Lin
- // 入口参数 fileName 优先。
- // 不分 MiniBuilder、P18Builder
- // 区别只在于 PageObject 是否为 null
- // 把 fileName、pageB 都做为入口参数
- // public boolean miniCompile(String fileName, PageB pageobj, int type, String destDir)
- // 入口参数改为只有 pageName。Lin
- // 再调整为 PMS 编译项目的部件 -- 增加支持多线程。Lin
- // 增加 compPage(CompPageB),去掉 pageName(String) 和 srcDir(String) -- 上层直接产生到文件名
- // 增加 prjApp(PrjApp) -- 用 PrjApp 和 CompPageB 来生成编译后的文件位置和文件名
- // 另,对 PMS 本身的首页 编译后的存放位置,不做特别处理 -- 手工再拷贝到 PMS 项目的 webapp 目录里
- public static boolean compPage(CompPageB compPage, PrjApp prjApp) {
- String pageName = compPage.pageName; // 增加。Lin
- /* 再调整为 PMS 编译项目的部件。Lin
- PageB pageObj = PrjApp.pageMap.get(pageName);
- */ PageB pageObj = prjApp.pageMap.get(pageName);
- ///// 来自 MiniBuilder.build()。(@Override
- // extends PageBuilder
- /* 再去掉,改为入口参数 -- 直接由上层产生到文件名 -- PMS/CompPage.jsp。Lin
- String reader; // StringReader。改用 fileName。Lin
- */
- try {
- /* 改用 fileName。Lin
- reader = getSourceCode(AppB.webRoot + srcDir + pageName +".jsp"); // 统一用 srcDir。Lin
- */
- /* 再去掉,改为入口参数 -- 直接由上层产生到文件名 -- PMS/CompPage.jsp。Lin
- reader = prjApp.webRoot + srcDir + pageName +".jsp"; // 统一用 srcDir。Lin // = AppB.。再增加支持多线程。Lin
- */
- if (pageObj == null) { // 登录页、个人首页。Lin
- SsLog.print("prjApp.pageMap 没有找到:"+ pageName);
- // 少一级 PageC.PAGE_dir 目录。Lin
- // reader = getSourceCode(SsApp.webRoot + srcDir + pageName +".jsp"); // 统一用 srcDir。Lin
- /* 再去掉 false = bySys,原来的程序有增加 <html>、<body> 等 -- 在 main/sheji/object/baseInfo/init.jsp 里。Lin
- createNewFileWithUrl(reader, null, AppB.webRoot + pageName +".jsp", false); // 不用 .Md5Name。Lin
- */
- /* 再调整为 PMS 编译项目的部件。Lin
- * 增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程
- * pageObj(PageB) 移到 prjApp 前面
- * 源文件为 ".ss.jsp"(PageC.PAGE_ssExt),编译后的目标文件为 ".jsp"(AppC.EXT_jsp)
- createNewFileWithUrl(reader, null, prjApp.webRoot + pageName +".jsp"); // , AppB.。再增加支持多线程。Lin
- */ doCompPage(compPage.srcFileName, prjApp.webRoot + pageName + AppC.EXT_jsp, null, prjApp);
- } else {
- // reader = getSourceCode(SsApp.webRoot + srcDir + PageC.PAGE_dir + pageName +".jsp"); // 统一用 srcDir。Lin
- /* 兜兜转转,直接点。Lin
- * 去掉 FileTranslator
- FileTranslator f=new FileTranslator();
- f.setAppName(getFactory().getWebapp().getName());
- f.setJapSuffix(common.ConstVars.RUN);
- f.setPageobj(null);
- if(reader!=null)
- f.createNewFileWithUrl(reader, getFactory().getGeneratePath());
- */
- /* 再去掉 false = bySys,原来的程序有增加 <html>、<body> 等 -- 在 main/sheji/object/baseInfo/init.jsp 里。Lin
- createNewFileWithUrl(reader, pageObj, AppB.webRoot + PageU.cmptPageFileName(pageObj), false);
- */
- /* 再增加支持多线程 -- PMS 需要。Lin
- createNewFileWithUrl(reader, pageObj, AppB.webRoot + PageU.cmptPageFileName(pageObj));
- */
- /* 再调整为 PMS 编译项目的部件。Lin
- * 增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程
- * pageObj(PageB) 移到 prjApp 前面
- createNewFileWithUrl(reader, pageObj, prjApp.webRoot + PageU.cmptPageFileName(pageObj));
- */
- String tgtPageName = (prjApp.inDebug)? pageName : PageU.md5PageName(pageName); // MD5 部件名。Lin
- doCompPage(compPage.srcFileName, prjApp.webRoot + PageU.cmptPageFileName(tgtPageName), pageObj, prjApp);
- /// 增加自动生成 _baseInfo、_miniInfo,并编译刷新 pageMap。Lin
- /* 再改,部件文件名前缀 "env_" 改为增加的属性 env= 了。Lin
- * 就是找 dw_inp 等,直接找 "_inp"/"_miniInp" 就行了 -- 去掉了 "env_" 后,env_inp 改为 objInp,没有 "_inp" 了。Lin
- if (!pageName.startsWith(PageC.PAGE_envPre) && // 不包含 "env_inp"。Lin
- (pageName.endsWith(PageC.PAGE_inpSuf) || // "_input")。Lin
- pageName.endsWith(PageC.PAGE_miniInpSuf))) { // "_miniInput")。Lin
- */ if (pageName.endsWith(PageC.PAGE_inpSfx) ||
- pageName.endsWith(PageC.PAGE_miniInpSfx)) {
- String infoPageName = pageName.replace(PageC.PAGE_inpSfx, PageC.PAGE_baseInfoSfx) // "_input", "_baseInfo")。Lin
- .replace(PageC.PAGE_miniInpSfx, PageC.PAGE_miniInfoSfx); // "_miniInput", "_miniBaseInfo")。Lin
- PageB infoPage = prjApp.pageMap.get(infoPageName); // = PrjApp.。再增加支持多线程。Lin
- if (infoPage != null && !infoPage.bySys) // 手工写的 Info Page。Lin
- return true;
- /* 复制到 "_baseInfo"/"_miniInfo"。Lin
- * 不复制了,直接从 "_inp"/"_miniInp" 读
- FileU.copyFile(reader, AppB.webRoot + srcDir + infoPageName +".jsp");
- */
- infoPage = makeInfoPageB(pageObj, infoPageName, prjApp); // 生成 Info PageB。Lin
- String serDir = prjApp.webRoot + AppC.CFG_serDir; // = PrjApp.appRoot。再增加支持多线程。Lin
- SerU.doSer(infoPage, serDir + pageName); // 用 "_inp" 保存 -- 项目启动时加载。Lin
- prjApp.pageMap.put(infoPage.name, infoPage); // 更新 pageMap。Lin // PrjApp.。再增加支持多线程。Lin
- /* 再去掉 true = bySys,原来的程序有增加 <html>、<body> 等 -- 在 main/sheji/object/baseInfo/init.jsp 里。Lin
- createNewFileWithUrl(reader, infoPage, AppB.webRoot + PageU.cmptPageFileName(infoPage), true);
- */
- /* 再增加支持多线程 -- PMS 需要。Lin
- createNewFileWithUrl(reader, infoPage, AppB.webRoot + PageU.cmptPageFileName(infoPage));
- */
- /* 再调整为 PMS 编译项目的部件。Lin
- * 增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程
- * pageObj(PageB) 移到 prjApp 前面
- createNewFileWithUrl(reader, infoPage, prjApp.webRoot + PageU.cmptPageFileName(infoPage));
- */
- tgtPageName = (prjApp.inDebug)? infoPageName : PageU.md5PageName(infoPageName); // MD5 部件名。Lin
- doCompPage(compPage.srcFileName,
- prjApp.webRoot + PageU.cmptPageFileName(tgtPageName), infoPage, prjApp);
- }
- ///
- }
- } catch (Exception e) {
- /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- e.printStackTrace();
- */ log4j.error("PageComper.compPage( 异常", e);
- ThdLog.wrMsg(String.format(AppC.TITLE_errLine, "编译部件错误"), e.toString(), e.getCause()); // RlsLoger.。Lin
- return false;
- }
- return true;
- /////
- }
- // 生成 Info PageB。Lin
- // 参考自 pms-core:PmsUtil.(Wj) addRealate_baseinfo(Wj wj, Long yhid, GeneralDBAccess gdba)。Lin
- // 再增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程 -- PMS 需要。Lin
- private static PageB makeInfoPageB(PageB pageObj, String infoPageName, PrjApp prjApp) {
- /* 改。Lin
- ViewObject vo = PmsFinder.findViewObject(wj.getDxm(), wj.getXmslid(), gdba);
- */ ObjB vo = prjApp.objMap.get(pageObj.objName); // 一定有 .objName。Lin // PrjApp.。再增加支持多线程。Lin
- String infoDesc = vo.desc +"基本情况";
- /* 再去掉,即使有细分部件,也叫 "文书基本情况"。Lin
- * 即使用改成了 "文书来文基本情况" 也是没用的,"查看文书"/"查看文书.来文" 是在 ??? 重新生成的。Lin
- for (ObjFuncB f : vo.funcMap.values()) { // .getFuns()。Lin
- for (ObjFuncPluginB plu : f.pluginList) {
- if (infoPageName.equals(plu.name)) {
- infoDesc = vo.desc + plu.desc +"基本情况";
- break;
- }
- }
- }
- */
- PageB info = new PageB(); // 与 PageB 的成员变量一致。Lin
- info.biz = pageObj.biz;
- info.objName = pageObj.objName;
- info.isEnv = true;
- info.isInfo = true;
- info.isInp = false;
- info.bySys = true;
- /* 去掉 PageB.type 了。同时,MD 的部件名,加前缀 mp_/pad_/ext_(外部访问,微信) 了。Lin
- * 去掉 <page type="12101",改为 插件主页面 写 type="info"/"task"/"urge"(插件类别名)
- info.type = PageC.PAGE_baseInfoType; // 不会有 迷你录入部件(miniInp),所以是 基本情况部件(baseInfo)。Lin
- */
- info.md5Name = null; // MD 首页部件名
- info.name = infoPageName;
- info.md5Name = PageU.md5PageName(infoPageName);
- info.desc = infoDesc;
- info.width = pageObj.width;
- info.height = pageObj.height;
- info.fixHeight = pageObj.fixHeight;
- info.rowNumPer = pageObj.rowNumPer;
- return info;
- }
-
- //// 来自 FileTranslator
- /////
-
- // 来自 FileTranslator.createNewFileWithUrl(StringReader reader,// 被替换的源文件路径(此文件不会被修改)
- // String newFilePath)// 替换后生成的新文件路径。Lin
- // 兜兜转转,直接点 -- 去掉 FileTranslator
- // 去掉 public,改为私有 private
- // FileTranslator.pageobj(PageObject) 改为用入口参数 pageobj(PageB)传递
- // reader 改为 fileName,在 compFile() 里读入
- // 增加 bySys -- 根据 dw_inp.jsp 生成 dw_baseInfo.jsp -- 增加 <html>、<body> 等。Lin
- // 再去掉 bySys,原来的程序有增加 <html>、<body> 等 -- 在 main/sheji/object/baseInfo/init.jsp 里。Lin
- // 再增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程
- // pageObj(PageB) 移到 prjApp 前面
- private static void doCompPage(String srcFileName, // 被替换的源文件路径(此文件不会被修改)
- String tgtFileName, // 替换后生成的新文件路径
- PageB pageobj, // 被替换的源 PageB
- PrjApp prjApp
- /* 再去掉 bySys。Lin
- boolean bySys // 根据 dw_inp.jsp 生成 dw_baseInfo.jsp -- 增加 <html>、<body> 等。Lin
- */
- ) throws Exception {
-
- /* 再改,IDEA:'StringBuffer result' may be declared as 'StringBuilder'。Lin
- StringBuffer result=new StringBuffer();
- */ StringBuilder result = new StringBuilder();
- // CACHE = new ThreadLocal<Map<String, WdFitHeightParam>>();
- /* 去掉,没有 _view.jsp 了。Lin
- boolean isViewJsp = ConstVars.VIEW.equals(japSuffix);
- */
- boolean isHelpJsp = false;
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- List<String> fileContentStrList = new LinkedList<>();// 包含文件中所有内容的字符串
- */ List<StringBuilder> fileContentStrList = new LinkedList<>();// 包含文件中所有内容的字符串
- // 发布程序自动添加html、head、body start 150209 by ye
- /*
- * fileContentStrList.add("<html>"); fileContentStrList.add("<head>");
- * fileContentStrList.add("<LINK href=\"/wd/theme/standard/style.css\"
- * rel=\"stylesheet\" type=\"text/css\">");
- * fileContentStrList.add("</head>"); fileContentStrList.add("<body>");
- */
- // 发布程序自动添加html、head、body end 150209 by ye
- /// 改为在这添加,且只对 dw_inp.jsp 生成 dw_baseInfo.jsp 时。Lin
- /* 再去掉,原来的程序有增加 <html>、<body> 等 -- 在 main/sheji/object/baseInfo/init.jsp 里。Lin
- if (bySys) {
- fileContentStrList.add("<html>");
- fileContentStrList.add("<head>");
- // fileContentStrList.add("<skin@ss file='/ss/main'/>");
- fileContentStrList.add("</head>");
- fileContentStrList.add("<body>");
- }
- */
- ///
- List<String> jsFileList = new ArrayList<>();
- List<String> tbodyFileList = new ArrayList<>();
- Map<String, String> tldFileMap = new HashMap<>();
- BufferedReader in = null;
- String s;
- // PrintStream ps = null;
- try {
- /* 再改,IDEA:Type may be primitive。Lin
- Boolean pageExist = (pageobj != null);
- */ boolean pageExist = (pageobj != null);
- // String yyxtidSql="select yyxt_id from ejlm where ymid="+ymid;
- // gdba.select( yyxtidSql);
- // String yyxtid=null;
- // if (gdba.getNowselect().getRowCount() > 0) {
- // yyxtid=gdba.getColumnAsString("yyxt_id");
- // }
- // String dm = WebUtil.getYyhByWzid(gdba, wzid);
- // 读取源文件的所有内容
- // System.out.println(new File(srcFilePath).exists());
- /* 去掉,移到 jspUpdate() 里 -- 只有这里用到。Lin
- String[] array = { WebC.SS_name, PrjApp.prjName }; // "wd",appName。Lin
- */
- /// 帮助功能变量准备start ///
- // String bjdm = pageobj.getName();
- // String gdgd = null;
- // Bj bj = new Bj();
- // bj.setBjid(Long.valueOf(bjId));
- //
- // gdba.selectById(bj);
- // bjdm = bj.getDm();
- // if (bjdm != null && bjdm.startsWith("help_")) {
- // isHelpJsp = true;
- // }
- /* 去掉 csc(保存所有属性的键值对),已经写到 .name、.width 等了。Lin
- Map<String, String> json = pageExist?pageobj.getCsc():new HashMap();
- */
- // gdgd = json.get("gdgd");
- // DesignOutSide dots = new DesignOutSide(Long.parseLong(ymid), gdba);
- /* 去掉 csc(保存所有属性的键值对),已经写到 .name、.width 等了 -- 用 .isMakeBySys。Lin
- boolean systemCreate = "1".equals(json.get("sfxtcj") + "");
- */
- /* 再改,IDEA:Variable 'systemCreate' is never used。Lin
- boolean systemCreate = pageExist? pageobj.bySys : false;
- */
- // Ym ym = new Ym();
- // ym.setYmid(Long.parseLong(ymid));
- // gdba.selectById(ym);
- // if (bjId != null) {
- // String bjdmSql = "select dm,bqgd from bj where bjid = :bjid";
- // SqlCommandImpl sqlCmd = new SqlCommandImpl(bjdmSql);
- // sqlCmd.setInt("bjid", Long.valueOf(bjId));
- // gdba.select(sqlCmd);
- // if (gdba.getRowCount() > 0) {
- // bjdm = gdba.getColumnAsString("dm");
- // bqgd = gdba.getColumnAsString("bqgd");
- // }
- // }
- // List<String> wdHelpExecutableJsStringList = new
- // ArrayList<String>();
- // String wdhelpForPagejs = new
- // WdHelpForWholePage().getExecutableJsString("", dm, bjdm);
- // // 整个页面的帮助
- // if (wdhelpForPagejs != null) {
- // wdHelpExecutableJsStringList.add(wdhelpForPagejs);
- // }
- /// 存储帮助功能的可执行js代码段 ///
- /// 帮助功能变量准备 end ///
- // StringReader reader = null;
-
- /* 去掉入口参数 ymid、wzid、gdba(wdgdba)。Lin
- * 去掉 appName,直接用 PrjApp.prjName
- * 移到 PageCompU,reader 改为 fileName -- 在 compFile() 里读入
- reader = transformCommonwrite(reader, appName, null, null, wdgdba);
- */
- StringReader reader = PageCompU.compFile(srcFileName);
- //noinspection SuspiciousIndentAfterControlStatement
- if (pageExist)
- if (pageobj.isInfo || pageobj.isInp) {
- // if (isMobile()) {
- //// reader = addMobileViewObjectTools(reader, dm, ym.getObject(), bj.getDm(), ymid, wzid, isViewJsp, systemCreate, gdba);
- // } else {
- /* 去掉 appName,不支持多个应用。Lin
- * 去掉 isViewJsp,没有 ViewJsp 了。Lin
- * 去掉 pageobj.getObjectName(),有 pageobj 就够了。Lin
- * 去掉 wdgdba,需要时再获取数据库连接。Lin
- * 去掉 ymid、wzid -- 两个 null。Lin
- * 去掉 appName,直接用 PrjApp.prjName
- * 再增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程。Lin
- reader = addViewObjectTools(reader, appName , pageobj.getObjectName(),pageobj, null, null, isViewJsp, systemCreate, wdgdba);
- */ reader = addViewObjectTools(reader, pageobj, prjApp);
- // }
- }
- if (reader == null)
- return;
- in = new BufferedReader(reader);
- boolean hasTab = false;
- boolean wdFitHeight = false;
- boolean wdDragHeight = false;
- boolean wdDragWidth = false;
- boolean showMsgPopup=false;
- // 新增,修改,变动三合一部件:没有html,body,head,form
- boolean isObjectInput = true;
- String reg_applicationcode = "@applicationCode";
- // String reg_pagewrite = "<page:write\\s*.*?\\s*/>"; // 去掉,归入 JspTagComper。Lin
- /* 再改,规范命名。Lin
- * wdOddClass > ssOddClazz
- * wdEvenClass > ssEvenClazz
- * wdHoverClass > ssHovClazz
- String reg_tbody = "<(tbody\\s*.*)(wdOddClass.*|wdEvenClass.*|wdHoverClass.*)>";
- */ String reg_tbody = "<(tbody\\s*.*)(ssOddClazz.*|ssEvenClazz.*|ssHovClazz.*)>";
- String reg_goto = "@goto\\{.*?\\}@";
- // String reg_wdpage = "<wd:page\\s*.*?\\s*/>"; // 去掉,归入 JspTagComper。Lin
- // String common_write_regexp =
- // "<wd:write([^>]*?)(/>|(>[\\s\\S]*?</wd:write>))";
- // String jsonStr=null;
- int index = 0;
- while ((s = in.readLine()) != null) {
- /// ???
- // if (s.contains("${delete}"))
- // System.out.println("in.readLine()");
- ///???
- // String strUrl = ""; // 再,移到下面用到的地方。按 IDEA 规范 -- Variable 'strUrl' initializer '""' is redundant。Lin
- // ArrayList<String> list = matchAll(ss,reg,0);
- // 判断是否有wdSecondaryTab
- if (s.contains("tab-div"))
- hasTab = true;
- if (s.contains("ssFith")) // ("wdFitHeight"))。Lin
- wdFitHeight = true;
- if (s.contains("ssDragh")) // ("wdDragHeight"))。Lin
- wdDragHeight = true;
- if (s.contains("ssDragw")) // ("wdDragWidth"))。Lin
- wdDragWidth = true;
- if (s.contains("wd.display.showMsgPopup"))
- showMsgPopup = true;
- //noinspection SuspiciousIndentAfterControlStatement
- if(pageExist)
- if (isHelpJsp // isHelpJsp 没有被赋值 -- false???Lin
- && (s.contains("<img") || s.contains("video"))) {
- s = s.replace("wdSrc=\"", "src=\"${sessionScope['ssUser'].skinDir}/help/PC/"+ pageobj.biz +"/");
- // s=s.replaceAll(Pattern.quote("wdSrc=\""),Matcher.quoteReplacement(
- // "src=\"${sessionScope['wd.yh'].pflj}/help/PC/"+ym.getBusiness()+"/"));
- System.out.println(s);
- }
- // 新增,修改,变动三合一部件:没有html,body,head,form
- if (isObjectInput &&
- (s.contains("<html") || s.contains("<body") || s.contains("<head") || s.contains("<form")))
- isObjectInput = false;
- String strUrl; // 再,从上面移到这。Lin
- /* 只有 "run"("_run.jsp")了,没有 "view" 了。Lin
- * 去掉 replaceStr(),直接用 .replaceAll(replacedStr, "")
- * 去掉 appName,直接用 PrjApp.prjName
- * replacedStrs(String[]) 值为 [START_TAG, END_TAG]
- if (CoreConstVars.RUN.equals(japSuffix)) {
- strUrl = s.replaceAll(reg_applicationcode, appName);
- strUrl = replaceStr(strUrl, // 被替换的目标字符串
- replacedStrs);// 被替换掉的字符串数组
- } else {
- strUrl = s;
- }
- */
- strUrl = s.replaceAll(reg_applicationcode, prjApp.name); // , PrjApp.。再,支持多线程。Lin
- strUrl = strUrl.replaceAll(PageCompC.HTML_begTag, "");
- strUrl = strUrl.replaceAll(PageCompC.HTML_endTag, "");
- // if (MobileSupport.isMobileYm(ymid)
- // && CoreConstVars.VIEW.equals(japSuffix)
- // && strUrl.indexOf("base.css") != -1) {
- // strUrl = strUrl.replace("base.css", "base_view.css");
- // }
- /* 去掉 appName,直接用 PrjApp.prjName。Lin
- strUrl = transFormAtService(strUrl, appName, null, null, wdgdba);
- strUrl = transwdPluginsrc(strUrl, appName, null, null, wdgdba);
- */
- // strUrl = transFormAtService(strUrl); // 归入 XxxTagComper 了。Lin
- strUrl = transwdPluginsrc(strUrl);
- /* 去掉,归入 JspTagComper。Lin
- List<Map<String, Object>> pageList = StrU.findMatch2(strUrl, reg_pagewrite, 0);
- List<Map<String, Object>> wdpageList = StrU.findMatch2(strUrl, reg_wdpage, 0);
- */
- List<Map<String, Object>> tbodyList = StrU.findMatch2(strUrl, reg_tbody, 0);
- List<Map<String, Object>> gotoList = StrU.findMatch2(strUrl, reg_goto, 0);
- // ArrayList<Map<String, Object>> matchedCommonWriteList =
- // new ArrayList<Map<String, Object>>();
- // if (CoreConstVars.TRANSFORM_COMMONWRITE_TAG)
- // matchedCommonWriteList.addAll(matchAll2(strUrl,
- // common_write_regexp, 0));
- // 获取帮助功能的js代码段 start
- // if (bjdm != null) {
- // String executableJsString = new
- // WdHelpAssistAjaxImpl().getExecutableJsString(strUrl, dm,
- // bjdm);
- // if (executableJsString != null) {
- // wdHelpExecutableJsStringList.add(executableJsString);
- // }
- // }
- // 获取帮助功能的js代码段 end
- /* 去掉,归入 JspTagComper。Lin
- if (pageList.size() > 0)
- strUrl = pageUpdate(strUrl, pageList);
- if (wdpageList.size() > 0)
- strUrl = pageUpdate(strUrl, wdpageList);
- */
- /* 再改,IDEA:'tbodyList.size() > 0' can be replaced with '!tbodyList.isEmpty()'。Lin
- if (tbodyList.size() > 0) {
- */ if (!(tbodyList.isEmpty())) {
- String tmpe;
- for (Map<String, Object> map : tbodyList) {
- // String tmpe = ""; // 再,移到 for 上面。IDEA -- Variable 'tmpe' initializer '""' is redundant。Lin
- String content = (String) map.get("content");
- /* 再改,去掉 id="wdTbody?",好像没用到。Lin
- * .ss.jsp 的 <tbody 里,也不写 id="wdTbody0" 了
- if (!content.matches(".*id=.*")) {
- tmpe = content.replaceAll(">", " id=\"wdTbody" + index++ + "\">");
- /// 另,content 里的 <tbody ssOddClazz= ... ssFith='{list:true,rowHeight:35}'> 里的 {} 会导致 java.util.regex.PatternSyntaxException。Lin
- strUrl = strUrl.replaceAll(content, tmpe);
- ///
- content = tmpe;
- }
- */
- tbodyUpdate(tbodyFileList, content);
- }
- }
- /* 再改,IDEA:'gotoList.size() > 0' can be replaced with '!gotoList.isEmpty()'。Lin
- if (gotoList.size() > 0) { // new
- */ if (!(gotoList.isEmpty())) // new
- /* 去掉 appName、ymid、wzid、gdba。Lin
- * null = ymid,null = wzid
- strUrl = gotoUpdate(strUrl, gotoList, appName, null, null, wdgdba);
- */ strUrl = gotoUpdate(strUrl, gotoList);
- // if (matchedCommonWriteList.size() > 0) {
- // strUrl = updateCommonWriteStr(strUrl,
- // matchedCommonWriteList, dm, ymid, wzid);
- // }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- fileContentStrList.add(strUrl);
- */ fileContentStrList.add(new StringBuilder(strUrl));
- }
- // 发布程序自动添加html、head、body start 150209 by ye
- /*
- * fileContentStrList.add("</body>");
- * fileContentStrList.add("</html>");
- */
- // 发布程序自动添加html、head、body end 150209 by ye
- /// 改为在这添加,且只对 dw_inp.jsp 生成 dw_baseInfo.jsp 时。Lin
- /* 再去掉,原来的程序有增加 <html>、<body> 等 -- 在 main/sheji/object/baseInfo/init.jsp 里。Lin
- if (bySys) {
- fileContentStrList.add("</body>");
- fileContentStrList.add("</html>");
- }
- */
- ///
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- for (String ss : fileContentStrList) {
- */ for (StringBuilder ss : fileContentStrList) {
- /// ???
- //if (ss.contains("${delete}"))
- // System.out.println("fileContentStrList");
- ///???
- /* 去掉 array 入口参数,直接在方法里定义。Lin
- jspUpdate(ss, array, jsFileList, tldFileMap);
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- loadExtFileName(ss, jsFileList, tldFileMap, prjApp); // 再增加 PrjApp。Lin
- */ loadExtFileName(String.valueOf(ss), jsFileList, tldFileMap, prjApp); // 再增加 PrjApp。Lin
- }
- boolean tldInited = false;
- // ps = new PrintStream(newFilePath);
-
- /* 去掉,isLastOne 没用到。Lin
- * 因为 isLastOne 没用到,lastcount 也没用到了
- // 计算输出最后一行
- int lastcount = 0;
- boolean isLastOne = false;
- */
-
- // 系统部件
- /* 去掉 PageConfig.systemComponent(),直接在 page.xml 里的 <page cat=> 写 "website"/"phome"。Lin
- * 去掉 cat,改回用 type 了
- * systemComponent(),原:true = 除 "18=PC,80=MD,90=Pad,85=MD Home,95=Pad Home" 外
- boolean sysPage = pageExist && PageConfig.systemComponent(pageobj.getType());
- */
- /* 去掉 isHomep(PageB.type 和 isWebsite(PageB.type,增加 .isHomep 和 .isSitep -- 来自插件的 <pages homep="true"/sitep="true"。Lin
- boolean sysPage = pageExist && (isWebsite(pageobj.type, null) // null = DevType。Lin
- || isHomep(pageobj.type, null)); // null = DevType。Lin
- */ boolean sysPage = pageExist && (pageobj.isSitep || pageobj.isHomep); // null = DevType。Lin
- //网站部件不加tld
- //属性,预览部件需要
- /* 直接用 pageobj.cat 来写判断。Lin
- * 去掉 PageObject.tempcode(TempCode) 了
- if(sysPage && Long.parseLong(pageobj.getType())<5000l)
- tldInited=!pageobj.getTempcode().getName().matches("(property|preview|style)\\_.*");
- */
- if (pageExist) // 加 pageExist。Lin
- /* 去掉 isHomep(PageB.type 和 isWebsite(PageB.type,增加 .isHomep 和 .isSitep -- 来自插件的 <pages homep="true"/sitep="true"。Lin
- if (isWebsite(pageobj.type, null)) // null = DevType。Lin
- */ if (pageobj.isSitep)
- /* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
- tldInited = !((pageobj.name).matches("(property|preview|style)\\_.*"));
- */ tldInited = !((pageobj.name).matches("(property|preview|style)_.*"));
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- for (String str : fileContentStrList) {
- */ for (StringBuilder str : fileContentStrList) {
- /// ???
- //if (str.contains("<equal@ss"))
- // System.out.println("fileContentStrList");
- ///???
- /* 去掉,isLastOne 没用到。Lin
- * 因为 isLastOne 没用到,lastcount 也没用到了
- lastcount++;
- if (fileContentStrList.size() == lastcount) {
- isLastOne = true;
- }
- */
-
- // js自动补充项目代码 <script src="js/a/b.js">---<script
- // src="/zzfb_/js/a/b.js">
- // String ss[] = findLabelName(str, "script", "src");
- // if (ss != null) {
- // String src = ss[1];
- // String srcV = ss[1];
- // if (!src.startsWith("/wd") && !src.startsWith("/")) {
- // str = str.replace(srcV, "/" + appName + "/" + srcV);
- // }
- // }
- /* 去掉 appName,直接用 PrjApp.prjName。Lin
- str = translateScriptSrc(str, appName);
- */
- // str = translateScriptSrc(str); // 再去掉,不支持多个应用。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- if (!tldInited && (("<html>".equalsIgnoreCase(str.trim())) || (isObjectInput)
- */ if (!tldInited && (("<html>".equalsIgnoreCase(str.toString().trim())) || (isObjectInput)
- // ||(dots.isOutSidePage())
- ||(pageExist&&sysPage))) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin。Lin
- String top = PageCompC.INTERPOLE_JSPTOP_BEGIN +"\r\n";
- */ StringBuilder top = new StringBuilder(PageCompC.INTERPOLE_JSPTOP_BEGIN +"\r\n");
- /* 用 PageCompC.HTML_page。Lin
- top += "<%@ page language=\"java\" pageEncoding=\"UTF-8\" isELIgnored=\"false\" %>\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin。Lin
- top += PageCompC.HTML_page +"\r\n";
- */ top.append(PageCompC.HTML_page +"\r\n");
- // Set<Entry<String, String>> set = tldFileMap.entrySet();
- // Iterator<Entry<String, String>> it = set.iterator();
- if (sysPage) {
- /* 先去掉,网站页面用到再弄。Lin
- * 合并为一个 ss:xxx
- top += "<%@ taglib uri=\"/WEB-INF/struts-html.tld\" prefix=\"html\"%>\r\n";
- top += "<%@ taglib uri=\"/WEB-INF/struts-bean.tld\" prefix=\"bean\"%>\r\n";
- top += "<%@ taglib uri=\"/WEB-INF/struts-logic.tld\" prefix=\"logic\"%>\r\n";
- top += "<%@ taglib uri=\"/wd/tld/webcommon.tld\" prefix=\"webcommon\"%>\r\n";
- top += "<%@ taglib uri=\"/wd/tld/validation.tld\" prefix=\"validation\" %>\r\n";
- top += "<%@ taglib uri=\"/wd/tld/codebook.tld\" prefix=\"codebook\" %>\r\n";
- top += "<%@ taglib uri=\"/wd/tld/wd.tld\" prefix=\"wd\" %>\r\n";
- top += "<%@ taglib uri=\"/wd/tld/common.tld\" prefix=\"common\" %>\r\n";
- top += "<%@ taglib uri=\"/wd/tld/cw.tld\" prefix=\"cw\"%>\r\n";
- */
- ///// top += PageCompC.HTML_ssTagLib +"\r\n";
- top.append(PageCompC.HTML_ssTagLib + "\r\n");
- //
- } else {
- for (Entry<String, String> entry : tldFileMap.entrySet()) {
- if ("common".equals(entry.getKey()))
- continue;
- /* 用 PageCompC.PAGE_taglib。Lin
- top += "<%@ taglib uri=\"" + entry.getValue().toString() + "\" prefix=\"" + entry.getKey().toString() + "\"%>\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin。Lin
- top += String.format(PageCompC.HTML_tagLib, entry.getValue(), entry.getKey()) +"\r\n";
- */ top.append(String.format(PageCompC.HTML_tagLib, entry.getValue(), entry.getKey())).append("\r\n");
- }
- /* 统一用 ss。Lin
- if (!top.contains("prefix=\"wd\"%>"))
- top += "<%@ taglib uri=\"/wd/tld/wd.tld\" prefix=\"wd\"%>\n";
- if (!top.contains("prefix=\"common\"%>"))
- top += "<%@ taglib uri=\"/wd/common.tld\" prefix=\"common\"%>\n";
- if (!top.contains("prefix=\"cw\"%>"))
- top += "<%@ taglib uri=\"/wd/tld/cw.tld\" prefix=\"cw\"%>\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin。Lin
- if (!top.contains("prefix=\"ss\"%>"))
- top += PageCompC.HTML_ssTagLib +"\r\n";
- */
- if (!top.toString().contains("prefix=\"ss\"%>"))
- top.append(PageCompC.HTML_ssTagLib + "\r\n");
- }
- // if (CoreConstVars.TRANSFORM_COMMONWRITE_TAG)
- // top +=
- // "<%@ taglib uri=\"/wd/cw.tld\" prefix=\"cw\"%>\n";
- /* 去掉 getSetAppNameStr(),直接用 readJspCont(String jspPath, String defaultCont, String reg, String replace)。Lin
- * 去掉 appName,直接用 PrjApp.prjName
- top += getSetAppNameStr(appName);
- */
- // 再去掉,不写应用名。Lin
- // top += PageU.readJspCont(SET_APPNAME_JSP, SET_APPNAME_SCRIPT, "#{APPNAME}#", PrjApp.prjName);
- if (pageExist && (StringUtils.isNotBlank(pageobj.objName))) {
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 去掉 CoreConstVars.PAGE_CONTEXT_VIEWOBJECT,用 。Lin
- top+="\r\n<% pageContext.setAttribute(wd.core.common.CoreConstVars.PAGE_CONTEXT_VIEWOBJECT,\""+pageobj.getObjectName()+"\");%>\r\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin。Lin
- top+="\r\n<% pageContext.setAttribute(ss.page.PageC.PAGE_objName,\""
- + pageobj.objName +"\");%>\r\n";
- */ top.append("\r\n<% pageContext.setAttribute(ss.page.PageC.PAGE_objName,\"")
- .append(pageobj.objName).append("\");%>\r\n");
- }
- if (pageExist) {
- Map<String,String> a = new HashMap<>();
- a.put("hastab", (hasTab? "1" : "0")); // UrlEntry.RUNNING_CONDITION_HAS_TAB
- /* toJsonStr() 的串里,\" 改用 '。Lin
- * 原 "{\"hastab\":\"0\"}",改为 ,"{'hastab':'0'}"
- top += "\r\n<%pageContext.setAttribute(\"wdpageinformation\",\""
- + StrJson.toJsonStr(a).replaceAll("\"","\\\\\"")+"\");%>\r\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin。Lin
- top += "<%pageContext.setAttribute(\"wdpageinformation\",\""
- + new Gson().toJson(a).replaceAll("\"", "'") +"\");%>\r\n";
- */ top.append("<%pageContext.setAttribute(\"wdpageinformation\",\"")
- .append(new Gson().toJson(a).replaceAll("\"", "'")).append("\");%>\r\n");
- // 去掉 StrJson.toJsonStr(),直接用 new Gson().toJson()。Lin
- }
- /* 用 PageCompC.。Lin
- top += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- top += PageCompC.HTML_docType +"\r\n";
- */ top.append(PageCompC.HTML_docType +"\r\n");
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- top += PageCompC.INTERPOLE_JSPTOP_END +"\r\n";
- */ top.append(PageCompC.INTERPOLE_JSPTOP_END +"\r\n");
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str = top + str;
- */ str = top.append(str);
- tldInited = true;
- /* 去掉,没有 _view.jsp 了。Lin
- if (isViewJsp && isObjectInput) {
- // str += "<wd:write type='skin'></wd:write>\n";
- str += new CommonWriteFactory(appName, null, null, wdgdba).transform("<wd:write type='skin'></wd:write>");
- str += "<script type=\"text/javascript\" src=\"/wd/js/jquery.js\"></script>\r\n";
- str += "<script type=\"text/javascript\" src=\"/wd/js/wdDialogInit.js\"></script>\r\n";
- str += "<script type=\"text/javascript\" src=\"/wd/js/common.js\"></script>\r\n";
- str += "<script type=\"text/javascript\" src=\"/wd/display.js\"></script>\r\n";
- str += "<script type=\"text/javascript\" src=\"/wd/edit.js\"></script>\r\n";
- }
- */
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- if ("<head>".equalsIgnoreCase(str.trim())) {
- str += "\r\n"+ PageCompC.INTERPOLE_HEAD_BEGIN;
- */
- if ("<head>".equalsIgnoreCase(str.toString().trim())) {
- str.append("\r\n"+ PageCompC.INTERPOLE_HEAD_BEGIN);
- /* 改为新UI。Lin
- * "新UI,所有head引入的内容,都放到/page/clip/header.jsp文件中"
- /// * 用 PageCompC.PAGE_meta。Lin
- // str += "<meta http-equiv=\"pragma\" content=\"no-cache\">\n"
- // + "<meta http-equiv=\"cache-control\" content=\"no-cache\">\n"
- // + "<meta http-equiv=\"expires\" content=\"0\">\n";
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n"+ PageCompC.HTML_meta;
- /// *
- str.append("\r\n"+ PageCompC.HTML_meta);
- // 移动端分支 移动端标准样式 update by Rd 2016-03-29
- // if (isMobile()) {
- // str += "<LINK href=\"/wd/theme/standard/mobileStyle.css\" rel=\"stylesheet\" type=\"text/css\">\n";
- // } else {
- // style.css只有一个2017-08-07
- // 暂时写死 20150210
- /// * 去掉 getSetAppNameStr(),用 readJspCont(String jspPath, String defaultCont, String reg, String replace)。Lin
- // * 去掉 appName,直接用 PrjApp.prjName
- // str += getSetXmdmJspCode(appName);
- /// *
- /// * 去掉,不写应用名。Lin
- // str += PageU.readJspCont(SET_XMDM_JSP, SET_XMDM_SCRIPT, "#{XMDM}#", PrjApp.prjName);
- /// *
- /// * 用 PageCompC.。Lin
- // str += "<script>window.loginStatus='${empty sessionScope[\"wd.yh\"]?'0':'1'}'</script>\r\n";
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n"+ PageCompC.SCR_loginState;
- /// *
- str.append("\r\n"+ PageCompC.SCR_loginState);
- /// * 用 @ss。Lin
- // String strSkinString = "<wd:write type='skin' t='general'></wd:write>";
- /// *
- /// * 再改为 .ss,用 @ 导致 IDEA -- Tag start is not closed。Lin
- // String strSkinString = "<skin@ss file='/ss/main'/>";
- /// *
- String strSkinString = "<skin.ss file='/ss/main'/>";
- // if (CoreConstVars.TRANSFORM_COMMONWRITE_TAG) {
- /// * 去掉了 CommonWriteFactory() 结构函数。Lin
- // * 去掉 appName,直接用 PrjApp.prjName
- // * 去掉 CommonWriteFactory,归入 TagComper
- // * 用 TagComper.transform(str),SkinTagComper 没盖写过
- // str += new CommonWriteFactory(appName, null, null, wdgdba).getTransformer("skin").transform(strSkinString) + "\r\n";
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n"+ TagComper.compTag(strSkinString);
- /// *
- str.append("\r\n").append(TagComper.compTag(strSkinString));
- // } else {
- // str += strSkinString;
- // }
- // 跟页面样式有关的语句,请勿胡乱注释
- // str +=
- // "<LINK href=\"/wd/theme/standard/style.css\"
- // rel=\"stylesheet\" type=\"text/css\">\n";
- // }
- /// 不写死引入 JS、CSS,自动找到并引入 -- 以后再弄。Lin
- /// 添加帮助功能的css和js start ///
- // if (bjdm != null) {
- // str +=
- // "<link rel=\"stylesheet\" type=\"text/css\" href=\"/env/js/artDialog/skins/chrome_red.css\"/>\n";
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/jquery/jquery.js\"></script>";
- // // /wd/js/。Lin
- /// *
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/jquery/jquery.js\"></script>");
- // str +=
- // "<script type=\"text/javascript\" src=\"/wd/js/artDialog/artDialog.js\"></script>\r\n";
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/artdialog/artDialogUtil.js\"></script>";
- // // /wd/js/artDialog/。Lin
- /// *
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/artdialog/artDialogUtil.js\"></script>");
- // str +=
- // "<script type=\"text/javascript\" src=\"/env/js/clipboard/clipboard.min.js\"></script>\r\n";//
- // 剪切板js
- // }
- /// 添加帮助功能的css和js end ///
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/js/base.js\"></script>"
- // // /wd/。Lin
- // + "\r\n<script> if(!window.wd) var wd={}; if(!wd.display) wd.display={}; wd.display.wdDialogId=\""
- // + (pageExist? pageobj.name : 1) // pageobj.getId()。用 name,不用 id。Lin
- // + "\"; if(!wd.app) wd.app={}; wd.app.name='"
- // + prjApp.name // 去掉 appName,直接用 PrjApp.prjName。Lin // + PrjApp.。再,支持多线程。Lin
- // + "';"
- // // "\r\nif(!wd.topWindow.wd.display.wdDialogWindows)wd.topWindow.wd.display.wdDialogWindows
- // // = {};"
- // // +"wd.topWindow.wd.display.wdDialogWindows["+bjId+"]=window;"+
- // + "</script>";
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/js/masklayer.js\"></script>";
- // // /wd/js/。Lin
- /// *
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/js/base.js\"></script>")
- .append("\r\n<script> if(!window.wd) var wd={}; if(!wd.display) wd.display={}; wd.display.wdDialogId=\"")
- .append(pageExist? pageobj.name : 1)
- .append("\"; if(!wd.app) wd.app={}; wd.app.name='")
- .append(prjApp.name) // 去掉 appName,直接用 PrjApp.prjName。Lin // + PrjApp.。再,支持多线程。Lin
- .append("';</script>");
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/js/masklayer.js\"></script>");
- // str += "<script
- // type=\"text/javascript\">document.ready(function(){
- // window.top.clearToken();});</script>\r\n ";
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/js/wdDialogInit.js\"></script>";
- // // /wd/js/。Lin
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/js/common.js\"></script>";
- // // /wd/js/。Lin
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/js/display.js\"></script>";
- // // /wd/。Lin
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/js/edit.js\"></script>";
- // // /wd/。Lin
- /// *
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/js/wdDialogInit.js\"></script>");
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/js/common.js\"></script>");
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/js/display.js\"></script>");
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/js/edit.js\"></script>");
- // 伪滚动条
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/nicescroll/jquery.nicescroll.js\"></script>";
- // // /wd/js/nicescroll376/。Lin
- // str += "\r\n<script type=\"text/javascript\" src=\"/ss/nicescroll/jquery.nicescroll.iframehelper.min.js\"></script>";
- // // /wd/js/nicescroll376/。Lin
- /// *
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/nicescroll/jquery.nicescroll.js\"></script>");
- str.append("\r\n<script type=\"text/javascript\" src=\"/ss/nicescroll/jquery.nicescroll.iframehelper.min.js\"></script>");
- // System.out.println("...<script> var
- // wdDialogId="+bjId+"; </script>");
- for (String file : jsFileList) {
- if (StringUtils.isBlank(file)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- continue;
- String fileLower = file.toLowerCase();
- // System.out.println("file:"+file);
- if (fileLower.endsWith(".js"))
- /// * 用 PageCompC.。Lin
- // str += "<script type=\"text/javascript\" src=\"" + file + "\"></script>\r\n";
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n"+ String.format(PageCompC.HTML_js, file);
- /// *
- str.append("\r\n").append(String.format(PageCompC.HTML_js, file));
- else
- /// * 用 PageCompC.。Lin
- // str += "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file + "\">\r\n";
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // * List<String> 改为 List<StringBuilder>
- // str += "\r\n"+ String.format(PageCompC.HTML_css, file);
- /// *
- str.append("\r\n").append(String.format(PageCompC.HTML_css, file));
- }
- */ str.append("\r\n" + PageCompU.getIncludeTag(PageCompC.PAGE_CLIP_PATH_header));
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str += "\r\n"+ PageCompC.INTERPOLE_HEAD_END;
- */ str.append("\r\n" + PageCompC.INTERPOLE_HEAD_END);
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- if ("</body>".equalsIgnoreCase(str.trim())) {
- */ if ("</body>".equalsIgnoreCase(str.toString().trim())) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String script = ""; // 定义放在增加的 if {} 外面。Lin
- */ StringBuilder script = new StringBuilder(); // 定义放在增加的 if {} 外面。Lin
- /* 再改,IDEA:'tbodyFileList.size() > 0' can be replaced with '!tbodyFileList.isEmpty()'。Lin
- if (tbodyFileList.size() > 0) { // 增加判断,避免输出空的 <script> </script>。Lin
- */ if (!(tbodyFileList.isEmpty())) { // 增加判断,避免输出空的 <script> </script>。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script = "<script type=\"text/javascript\">\r\n";
- */ script.append("<script type=\"text/javascript\">\r\n");
- for (String tbodyStr : tbodyFileList) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += tbodyStr +"\r\n";
- */ script.append(tbodyStr).append("\r\n");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script+="</script>";
- */ script.append("</script>");
- }
- //script += "</script>\n\r" + "<%@include file=\"/wd/page/glbjRunJspCommonEnd.jsp\"%>\n\r";
- // script +=
- // "<script type=\"text/javascript\">(function(){var
- // _onunload=window.onunload;window.onunload =
- // function(){_onunload&&_onunload();window.top.clearToken('<wd:token
- // service='wd.removePageToken' dest='' param=''
- // />',{'tokenList':'<%=
- // pageContext.getAttribute(wd.core.common.CoreConstVars.WD_PAGE_TOKENLIST)%>'});};})()</script>\r\n";
- if(pageExist)
- /* 去掉 Tempcode。Lin
- if (wdFitHeight || wdDragHeight || pageobj.getTempcode().isEnvPage()) {
- */ if (wdFitHeight || wdDragHeight || pageobj.isEnv) {
- if (StringUtils.isNotBlank(script)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "\r\n"; // 增加。Lin
- */ script.append("\r\n"); // 增加。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "<script type=\"text/javascript\" src=\"/ss/js/wdFitHeight.js\"></script>\r\n";
- script += "<script type=\"text/javascript\">initWdFitHeight("
- + pageobj.fixHeight +")</script>\r\n";
- script += "<script type=\"text/javascript\">initWdFitHeightFunction=function(){initWdFitHeight("
- + pageobj.fixHeight +");};</script>";
- */
- script.append("<script type=\"text/javascript\" src=\"/ss/js/wdFitHeight.js\"></script>\r\n");
- script.append("<script type=\"text/javascript\">initWdFitHeight(")
- .append(pageobj.fixHeight).append(")</script>\r\n");
- script.append("<script type=\"text/javascript\">initWdFitHeightFunction=function(){initWdFitHeight(")
- .append(pageobj.fixHeight).append(");};</script>");
- }
- // if ("env".equals(ym.getDm())) {
- // script += "<script type=\"text/javascript\" src=\"/wd/js/EnvPublic.js\"></script>\r\n";
- // }
- if (wdDragHeight) {
- if (StringUtils.isNotBlank(script)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "\r\n"; // 增加。Lin
- */ script.append("\r\n"); // 增加。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "<script type=\"text/javascript\" src=\"/ss/js/wdDragHeight.js\"></script>\r\n";
- script += "<script type=\"text/javascript\">initWdDragHeight("
- + pageobj.fixHeight + ")</script>";
- */
- script.append("<script type=\"text/javascript\" src=\"/ss/js/wdDragHeight.js\"></script>\r\n");
- script.append("<script type=\"text/javascript\">initWdDragHeight(")
- .append(pageobj.fixHeight).append(")</script>");
- }
- if (wdDragWidth) {
- if (StringUtils.isNotBlank(script)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "\r\n"; // 增加。Lin
- */ script.append("\r\n"); // 增加。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "<script type=\"text/javascript\" src=\"/ss/js/wdDragWidth.js\"></script>\r\n";
- script += "<script type=\"text/javascript\">initWdDragWidth(null)</script>";
- */
- script.append("<script type=\"text/javascript\" src=\"/ss/js/wdDragWidth.js\"></script>\r\n");
- script.append("<script type=\"text/javascript\">initWdDragWidth(null)</script>");
- }
- /// 添加可配置二级选项卡js start ///
- //noinspection SuspiciousIndentAfterControlStatement
- if (pageExist)
- if (hasTab) {
- if (StringUtils.isNotBlank(script)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "\r\n"; // 增加。Lin
- */ script.append("\r\n"); // 增加。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "<script type='text/javascript'>wd.display.wdTabNo='${wdTabNo}';</script>";
- script += "<script type=\"text/javascript\" src=\"/ss/js/wdDrag.js\"></script>\r\n";
- script += "<script type=\"text/javascript\" src=\"/ss/js/configurableTab.js\"></script>\r\n";
- script += String.format("<script type=\"text/javascript\"> \nwd.configurableTab.init(%s,\"%s\");</script>",
- 1, pageobj.name); // 不用 id -- pageobj.getId()。Lin
- */
- script.append("<script type='text/javascript'>wd.display.wdTabNo='${"+ TabC.TAB_nextNo +"}';</script>");
- script.append("<script type=\"text/javascript\" src=\"/ss/js/wdDrag.js\"></script>\r\n");
- script.append("<script type=\"text/javascript\" src=\"/ss/js/configurableTab.js\"></script>\r\n");
- script.append(String.format("<script type=\"text/javascript\"> \r\n"+
- "wd.configurableTab.init(%s,\"%s\");</script>", 1, pageobj.name));
- }
- if (pageExist) {
- /* 用 PageCompC.。Lin
- script += "<wd:equal leftValue=\"${empty resizeComponent}\" rightValue=\"false\">\r\n";
- script += "<script>"
- + "{var iframe = wd.display.getFrameOfWindow();"
- + "if(iframe&&iframe.contentWindow == window)wd.display.resizeComponent(${resizeComponent.width}, ${resizeComponent.height}, ${empty resizeComponent.minHeight?'null':resizeComponent.minHeight}, ${empty resizeComponent.maxHeight?'null':resizeComponent.maxHeight});"
- + "}" + "</script>\r\n";
- script += "</wd:equal>\r\n";
- */
- if (StringUtils.isNotBlank(script)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += "\r\n"; // 增加。Lin
- */ script.append("\r\n"); // 增加。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- script += PageCompC.SCR_resizeWin;
- */ script.append(PageCompC.SCR_resizeWin);
- }
- // }else{
- // script +=
- // "<script type=\"text/javascript\">
- // \nwd.display.initTab();</script>\r\n";
- // }
- /// 添加帮助功能的js start ///
- // script += "<script type=\"text/javascript\">";
- // for (int i = 0; i < wdHelpExecutableJsStringList.size();
- // i++) {
- // script += wdHelpExecutableJsStringList.get(i);
- // }
- // script += "</script>\r\n";
- // if (StringUtil.notNull(bjdm))
- /* 去掉 appName,直接用 PrjApp.prjName。Lin
- * 用 @ss
- * 移到 PageCompU
- str = "\r\n" + transformCommonwrite("<common:write type=\"wdhelp\" />", appName, null, null, wdgdba) + "\r\n" + str;
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str = PageCompU.compTag("<help@ss/>") +"\r\n"+ str;
- */
- /* 再改为 .ss,用 @ 导致 IDEA -- Tag start is not closed。Lin
- str = new StringBuilder(PageCompU.compTag("<help@ss/>") +"\r\n"+ str);
- */ str = new StringBuilder(PageCompU.compTag("<help.ss/>") +"\r\n"+ str);
- if (StringUtils.isNotBlank(script)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str = script +"\r\n" + str;
- */ str = new StringBuilder(script).append("\r\n").append(str);
- /// 添加帮助功能的js end ///
- /// 添加字段初始化功能 start ///
- if(pageExist){//判断是否需要添加字段初始化的js
- /* 用 PageCompC.。Lin
- StringBuilder wdRecordJs = new StringBuilder();
- wdRecordJs.append("<script type='text/javascript'>var wdRecordValue='${wdRecordValue}';</script>\n");
- wdRecordJs.append("<script type='text/javascript' src='/wd/js/wdRecord/wdRecord.js'></script>");
- wdRecordJs.append("<script type=\"text/javascript\">");
- wdRecordJs.append("(function(){wdRecord('" + pageobj.name + "');})();"); // pageobj.getId()
- wdRecordJs.append("</script>\r\n");
- str = wdRecordJs.toString() + str;
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str = String.format(PageCompC.SCR_pval, pageobj.name) +"\r\n" + str;
- */ str = new StringBuilder(String.format(PageCompC.SCR_pval, pageobj.name)).append("\r\n").append(str);
- }
- /// 添加字段初始化功能 end ///
- String stript="";
- if(pageExist && !showMsgPopup){
- /* 用 PageCompC.。Lin
- * 增加 <script> </script>
- stript +=
- "try{\r\n"
- + "wd.display.showMsgPopup('${msg}');\r\n"
- +"}catch(err){\r\n"
- +"console.error(err);\r\n"
- +"}";
- */
- stript += PageCompC.SCR_popupMsg;
- }
-
- if(pageExist){
- /* 用 PageCompC.。Lin
- * 增加 <script> </script>
- stript +=
- "<wd:equal leftValue=\"${empty "+PageC.WIN_closeParm+"}\" rightValue=\"false\">"
- +"try{\r\n"
- + "wd.display.setCloseWindowParam('${"+PageC.WIN_closeParm+"}');\r\n"
- +"}catch(err){\r\n"
- +"console.error(err);\r\n"
- +"}"
- +"</wd:equal>";
- */
- if (StringUtils.isNotBlank(stript)) // 增加。去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- stript += "\r\n"; // 增加。Lin
- stript += String.format(PageCompC.SCR_wrCloseWinParm, PageC.WIN_closeParm, PageC.WIN_closeParm);
- }
-
- /* 去掉,已含 <script> </script>。Lin
- if(StrU.notNull(stript)){
- str+="<script type='text/javascript'>\r\n"
- +stript
- +"\r\n</script>\r\n";
-
- }
- */
- if (StringUtils.isNotBlank(stript)) // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str = str +"\r\n"+ stript;
- */ str.append("\r\n").append(stript);
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- if ("</html>".equalsIgnoreCase(str.trim())) {
- */ if ("</html>".equalsIgnoreCase(str.toString().trim()))
- /* 去掉 getClearTokenScript(),统一用 PageUtil.readJspCont()。Lin
- str += getClearTokenScript();
- */
- /* 再改用 PageCompC.SCR_clearToken。Lin
- str += PageU.readJspCont(CLEAR_TOKEN_JSP, CLEAR_TOKEN_SCRIPT, null, null); // null = 不替换
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- str += "\r\n"+ PageCompC.SCR_clearPageToken;
- */
- // str.append("\r\n"+ PageCompC.SCR_clearPageToken); 固定的页面尾片断,改为引入/page/clip/footer.jsp Ben(20251225)
- str.append("\r\n" + PageCompU.getIncludeTag(PageCompC.PAGE_CLIP_PATH_footer));
- String strStr = str.toString(); // 增加,不改原 String.replace(。Lin
- //noinspection SuspiciousIndentAfterControlStatement
- if (pageExist)
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * List<String> 改为 List<StringBuilder>
- if (str.contains("</form>")) {
- str = str.replace("</form>", "<input name='wdComponentID' type='hidden' value='"
- + pageobj.name +"'/></form>"); // pageobj.getId()
- }
- result.append(str +"\r\n");
- */
- if (strStr.contains("</form>"))
- strStr = strStr.replace("</form>", "<input name='wdComponentID' type='hidden' value='"
- + pageobj.name +"'/></form>"); // pageobj.getId()
- result.append(strStr).append("\r\n");
- // ps.println();// 输出到新文件
- }
-
- String sourceHtml = result.toString();
- /* 去掉 bjlbm,直接用 .cat 来判断。Lin
- * 去掉 cat 改回用 type 判断
- Long bjlbm=pageExist?Long.parseLong(pageobj.getBjlbm()):null;
- if (pageExist&&bjlbm >= 5000 && bjlbm <= 10000) {
- */
- /* 去掉 isHomep(PageB.type 和 isWebsite(PageB.type,增加 .isHomep 和 .isSitep -- 来自插件的 <pages homep="true"/sitep="true"。Lin
- if (pageExist && isHomep(pageobj.type, null)) { // null = DevType。Lin
- */ if (pageExist && pageobj.isHomep) { // null = DevType。Lin
- StringBuilder sb = new StringBuilder();
- int start = sourceHtml.indexOf(PageCompC.INTERPOLE_JSPTOP_BEGIN);
- int end = sourceHtml.indexOf(PageCompC.INTERPOLE_JSPTOP_END);
- if (start != -1 && end != -1)
- /* 再改,IDEA:Call to 'substring()' is redundant。Lin
- sb.append(sourceHtml.substring(start + PageCompC.INTERPOLE_JSPTOP_BEGIN.length(), end));
- */ sb.append(sourceHtml, start + PageCompC.INTERPOLE_JSPTOP_BEGIN.length(), end);
- start = sourceHtml.indexOf(PageCompC.INTERPOLE_HEAD_END);
- end = sourceHtml.indexOf("</head");
- if (start != -1 && end != -1)
- /* 再改,IDEA:Call to 'substring()' is redundant。Lin
- sb.append(sourceHtml.substring(start + PageCompC.INTERPOLE_HEAD_END.length(), end));
- */ sb.append(sourceHtml, start + PageCompC.INTERPOLE_HEAD_END.length(), end);
- start = sourceHtml.indexOf("<body");
- start = sourceHtml.indexOf("<", start + 5);
- end = sourceHtml.indexOf("</body");
- sb.append("\n");
- /* 再改,IDEA:Call to 'substring()' is redundant。Lin
- sb.append(sourceHtml.substring(start, end));
- */ sb.append(sourceHtml, start, end);
- /* 去掉 getClearTokenScript(),统一用 PageUtil.readJspCont()。Lin
- sb.append(getClearTokenScript());
- */
- /* 再改,用 PageCompC.SCR_clearToken。Lin
- sb.append(PageU.readJspCont(CLEAR_TOKEN_JSP, CLEAR_TOKEN_SCRIPT, null, null)); // null = 不替换
- */
- // sb.append("\r\n"+ PageCompC.SCR_clearPageToken +"\r\n"); 固定的页面尾片断,改为引入/page/clip/footer.jsp Ben(20251225)
- sb.append("\r\n" + PageCompU.getIncludeTag(PageCompC.PAGE_CLIP_PATH_footer));
- sourceHtml=sb.toString();
- } else {
- // 去除 辅助标签
- sourceHtml = sourceHtml.replace(PageCompC.INTERPOLE_JSPTOP_BEGIN +"\r\n", "");
- sourceHtml = sourceHtml.replace(PageCompC.INTERPOLE_JSPTOP_END +"\r\n", "");
- sourceHtml = sourceHtml.replace(PageCompC.INTERPOLE_HEAD_BEGIN +"\r\n", "");
- sourceHtml = sourceHtml.replace(PageCompC.INTERPOLE_HEAD_END +"\r\n", "");
- }
-
- Map<String, String> csc = new HashMap<>();
- /* 不支持多个应用。Lin
- * 去掉 ApplicationConfig(application.xml),归入 SsC
- * 去掉 appName,直接用 PrjApp.prjName
- WebApp app=WD.getApp(appName);
- csc.put("projectDesc", app.getApplicationConfig().getProjectDesc());
- csc.put("appName", appName);
- */
- csc.put("appName", prjApp.name); // , PrjApp.。再,支持多线程。Lin
- csc.put("projectDesc", prjApp.desc); // , PrjApp.。再,支持多线程。Lin
- sourceHtml = PageU.paseSymbol(csc, sourceHtml); // DesignOutSide.paseSymbol()
-
- /* 再改,IDEA:'new File(tgtFileName).getParentFile().exists()==false'
- * can be simplified to '!new File(tgtFileName).getParentFile().exists()'。Lin
- if(new File(tgtFileName).getParentFile().exists()==false)
- */ if (!(new File(tgtFileName).getParentFile().exists()))
- new File(tgtFileName).getParentFile().mkdirs();
- FileU.wrStr(tgtFileName, sourceHtml);
- } catch (Exception e) {
- /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- e.printStackTrace();
- */ log4j.error("PageComper.doCompPage( 异常", e);
- ThdLog.wrMsg(String.format(AppC.TITLE_errLine, "编译部件错误"), e.toString(), e.getCause()); // RlsLoger.。Lin
- throw e;
- } finally {
- if (in != null)
- in.close();
- }
- // return; // 去掉,不必要 -- 按 IDEA 规范。Lin
- }
-
- /// **
- // *
- // * script script补充项目代码
- // * @param srcStr
- // * @param appName
- // * @return
- /// *
- /* 去掉,不支持多个应用。Lin
- // 来自 FileTranslator.translateScriptSrc()。Lin
- // 去掉 appName,直接用 PrjApp.prjName
- // public static String translateScriptSrc(String srcStr,String appName) {
- private static String translateScriptSrc(String srcStr){
- String ss[] = StrWeb.findLabelName(srcStr, "script", "src");
- if (ss != null) {
- String src = ss[1];
- String srcV = ss[1];
- if (!src.startsWith("/")) {
- srcStr = srcStr.replace(srcV, "/"+ PrjApp.prjName +"/"+ srcV); // appName。Lin
- }
- }
-
- return srcStr;
- }
- */
- // 来自 FileTranslator.jspUpdate(String s, String[] array, List<String> jsFileList, Map<String, String> tldFileMap)。Lin
- // 合并 toLeadJsMap 和 toLeadTldMap 到 grpMapMap
- // 去掉 array,直接在 jspUpdate() 里定义
- // 再增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程。Lin
- private static void loadExtFileName(String s, List<String> jsFileList, Map<String, String> tldFileMap,
- PrjApp prjApp) {
- String[] array = { "wd", prjApp.name }; // "wd",appName。从 createNewFileWithUrl() 里移下来。Lin
- // , PrjApp.。再,支持多线程。Lin
- // 先用 "wd",不用 WebC.SS_name -- 改动太大。Lin
-
- String jspReg;
- // String tldReg = ""; // 去掉,改用 PageCompC.PAGE_tldReg。Lin
- for (String yym : array) {
- /* 用 PageCompC.PAGE_JsCssReg。Lin
- jspReg = "([\\W" + yym + "]\\.)([\\w*\\.]*)?(\\W)";
- */ jspReg = String.format(PageCompC.PAGE_jsCssReg, yym);
- // tldReg = "<(\\w+:)(\\w+\\s*?.*?)>"; // 去掉,改用 PageCompC.PAGE_tldReg。Lin
- List<Map<String, Object>> jspList = StrU.findMatch2(s, jspReg, 2);
- List<Map<String, Object>> tldList = StrU.findMatch2(s, PageCompC.PAGE_tldReg, 1); // tldReg。Lin
- // System.out.println("应用名:"+yym+"--:"+WD.getApp(yym));
- /* 去掉,不支持多个应用。Lin
- * WD 用 SsApp.grpMapSsMap,项目用 PrjApp.grpMapMap
- * 不区分 toLeadJsMap 和 toLeadTldMap,用 .grpMapMap
- WebApp app = WD.getApp(yym);
- if (app == null)
- continue;
- Map<String, List<String>> toLeadJsMap = app.getToLeadJsMap();
- Map<String, List<String>> toLeadTldMap = app.getToLeadTldMap();
- */
- Map<String, List<String>> grpMapMap;
- if (yym.equals("wd")) // "wd"
- // 先用 "wd",不用 WebC.SS_name -- 改动太大。Lin
- grpMapMap = PageCompC.grpMapSsMap; // SsApp.。Lin // = PrjApp.。移到 PageCompC 了。Lin
- else
- grpMapMap = prjApp.grpMapMap; // = PrjApp.。再,支持多线程。Lin
-
- Map<String, List<String>> map = new HashMap<>();
- List<String> jsList = new ArrayList<>();
- int index = 0;
- /* 再改,IDEA:'jspList.size() != 0' can be replaced with '!jspList.isEmpty()'。Lin
- if (jspList.size() != 0) {
- */ if (!(jspList.isEmpty())) {
- for (Map<String, Object> m : jspList) {
- String content = yym +"."+ m.get("content");
- jsList.add(content);
- /* 不支持多个应用。Lin
- * 不区分 toLeadJsMap 和 toLeadTldMap,用 SsApp.grpMapMap
- * 提到最外面,不用几个地方都赋值 set -- 只确定到 .grpMapMap
- Set<Entry<String, List<String>>> set = toLeadJsMap.entrySet();
- */
- Set<Entry<String, List<String>>> set = grpMapMap.entrySet();
- /* 再改,IDEA:'while' loop can be replaced with enhanced 'for'。Lin
- Iterator<Entry<String, List<String>>> it = set.iterator();
- while (it.hasNext()) {
- Entry<String, List<String>> entry = it.next();
- */ for (Entry<String, List<String>> entry : set) {
- String key = entry.getKey();
- if (key.endsWith(".*")) {
- String temp = key.replaceAll("\\.\\*", "");
- if (content.startsWith(temp)) {
- List<String> list = new ArrayList<>();
- int tmpe = key.split("\\.").length;
- /* 再改,IDEA:Can be replaced with 'Math.max()' call。Lin
- index = tmpe > index ? tmpe : index;
- */ index = Math.max(tmpe, index);
- if (null == map.get(tmpe + "")) {
- list.add(key);
- map.put(tmpe + "", list);
- } else {
- if (!map.get(tmpe + "").contains(key))
- map.get(tmpe + "").add(key);
- }
- }
- }
- }
- }
- }
- for (int i = 2; i <= index; i++) {
- if (map.get(i +"") != null) {
- for (String key : map.get(i +"")) {
- /* 不区分 toLeadJsMap 和 toLeadTldMap,用 SsApp.grpMapMap。Lin
- List<String> tempList = toLeadJsMap.get(key);
- */
- List<String> tempList = grpMapMap.get(key);
- for (String file : tempList) {
- if (!jsFileList.contains(file))
- jsFileList.add(file);
- }
- }
- }
- }
- /* 再改,IDEA:'jsList.size() != 0' can be replaced with '!jsList.isEmpty()'。Lin
- if (jsList.size() != 0) {
- */ if (!(jsList.isEmpty())) {
- for (String key : jsList) {
- /* 不区分 toLeadJsMap 和 toLeadTldMap,用 SsApp.grpMapMap。Lin
- List<String> tempList = toLeadJsMap.get(key);
- */
- List<String> tempList = grpMapMap.get(key);
- if (tempList != null) {
- for (String file : tempList) {
- if (!jsFileList.contains(file))
- jsFileList.add(file);
- }
- }
- }
- }
- /* 再改,IDEA:'jsList.size() != 0' can be replaced with '!jsList.isEmpty()'。Lin
- if (tldList.size() != 0) {
- */ if (!(tldList.isEmpty())) {
- for (Map<String, Object> m : tldList) {
- String content = (String) m.get("content");
- /* 不区分 toLeadJsMap 和 toLeadTldMap,用 SsApp.grpMapMap。Lin
- Set<Entry<String, List<String>>> set = toLeadTldMap.entrySet();
- */
- Set<Entry<String, List<String>>> set = grpMapMap.entrySet();
- /* 再改,IDEA:'while' loop can be replaced with enhanced 'for'。Lin
- Iterator<Entry<String, List<String>>> it = set.iterator();
- while (it.hasNext()) {
- Entry<String, List<String>> entry = it.next();
- */ for (Entry<String, List<String>> entry : set) {
- String key = entry.getKey();
- if (key.startsWith(content)) {
- /* 不区分 toLeadJsMap 和 toLeadTldMap,用 SsApp.grpMapMap。Lin
- List<String> tldArr = toLeadTldMap.get(key);
- */
- List<String> tldArr = grpMapMap.get(key);
- for (String file : tldArr) {
- tldFileMap.put(content.replaceAll(":", ""), file);
- }
- }
- }
- }
- }
- }
- }
- /**
- * 替换@goto
- *
- * @param srcStr;
- * @param resList;
- * @return String
- */
- // 来自 FileTranslator.gotoUpdate()。Lin
- // 去掉 appName、ymid、wzid、gdba
- // private static String gotoUpdate(String srcStr, List<Map<String, Object>> resList, String appName, String ymid, String wzid, GeneralDBAccess gdba) {
- private static String gotoUpdate(String srcStr, List<Map<String, Object>> resList) {
- List<String> list = new ArrayList<>();
- int i = 0; // i 没有被赋值???-- 永远等于 0。Lin
- int start = 0;
- /* 再改,IDEA:Variable 'end' initializer '-1' is redundant。Lin
- int end = -1;
- */ int end;
- for (Map<String, Object> m : resList) {
- end = Integer.parseInt(m.get("start").toString());
- String subStr = srcStr.substring(start, end);
- list.add(subStr);
- start = Integer.parseInt(m.get("end").toString());
- }
- end = srcStr.length();
- String subStr = srcStr.substring(start, end);
- list.add(subStr);
- /* 去掉,没用到。Lin
- int j = -1;
- */
-
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * String 改为 StringBuilder
- String newStr = list.get(0);// 最终输出到页面的字符串
- */ StringBuilder newStr = new StringBuilder(list.get(0));// 最终输出到页面的字符串
- for (Map<String, Object> m : resList) {
- // j++;
- String gotoStr = m.get("content").toString();
- try {
- // String rs = translateServiceStr(serviceStr,// 要翻译的@service字符串
- // appName, ymid, wzid, gdba, false);
- /* 去掉结构函数了。Lin
- * 去掉 appName、ymid、wzid 了
- * 入口参数的 false 为 runWithoutJSP,不用设置 runWithoutJSP -- 可以直接 new GotoTranslator()
- String rs = new GotoTranslator(appName, ymid, wzid, false).translate(gotoStr);
- */ String rs = new GotoTranslator().translate(gotoStr);
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * String> 改为 StringBuilder
- newStr += rs;
- */ newStr.append(rs);
- /* 再改,IDEA:'catch' branch identical to 'RuntimeException' branch。Lin
- } catch (RuntimeException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- */ } catch (Exception e) {
- /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- e.printStackTrace();
- */ log4j.error("PageComper.gotoUpdate() 异常", e);
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- * String> 改为 StringBuilder
- * i 没有被赋值???-- 永远等于 0。Lin
- newStr += list.get(i + 1);
- */ newStr.append(list.get(i +1));
- }
- ///// return newStr;
- return newStr.toString();
- }
- // 来自 FileTranslator.tbodyUpdate()。Lin
- private static void tbodyUpdate(List<String> tbodyFileList, String strUlr) throws Exception {
- strUlr = strUlr.replaceAll(">", "/>");
- Document document = DocumentHelper.parseText(strUlr);
- Element rootElement = document.getRootElement();
- String wdOddClass = rootElement.attributeValue("ssOddClazz"); // ("wdOddClass")。Lin
- String wdEvenClass = rootElement.attributeValue("ssEvenClazz"); // ("wdEvenClass")。Lin
- String wdHoverClass = rootElement.attributeValue("ssHovClazz"); // ("wdHoverClass")。Lin
- String id = rootElement.attributeValue("id");
- tbodyFileList.add("wd.display.initTrDisplay("
- + (id == null? "null" : ("\"")+ id +"\"") +","
- + (wdOddClass == null? "null" : ("\""+ wdOddClass +"\"")) +","
- + (wdEvenClass == null? "null" : ("\""+ wdEvenClass +"\"")) +","
- + (wdHoverClass == null? "null" : ("\""+ wdHoverClass +"\"")) +");");
- }
- /* 去掉,归入 xxxTagComper。Lin
- // 来自 FileTranslator.pageUpdate(String s, List<Map<String, Object>> pageList)。Lin
- private static String pageUpdate(String s, List<Map<String, Object>> pageList) {
- String newStr = "";
- int start = 0;
- int end = 0;
- String content = null;
- for (Map<String, Object> map : pageList) {
- content = map.get("content").toString();
- start = Integer.parseInt(map.get("start").toString());
- newStr += s.substring(end, start);
- end = Integer.parseInt(map.get("end").toString());
- if (content.matches("<page:write name=\"*.*?\" />")) {
- newStr += "<span style='color:red;font-weight:bold;'>" + StringEscapeUtils.escapeHtml3("<这里有个旧的分页标签,用wd:page>") + "</span>";
- } else if (content.matches("<wd:page name=\"*.*?\" />")) {
- String name = content.split("\"")[1];
- ///* 去掉,不支持多个应用。Lin
- ///* 去掉加载时加的 "/<应用名>/" 前缀了,含 "/wd/"。Lin
- /// String yym = name.split("/")[1];
- /// WebApp webApp = WD.getApp(yym);
- /// // System.out.println("WD.getApp(yym);:"
- /// // + WD.getApp(yym));
- /// // System.out.println(name + "--webApp.getJsCssRealPathMap():"
- /// // + webApp.getJsCssRealPathMap());
- /// String path = webApp.getJsCssRealPathMap().get(name);
- /// end。Lin
- String path = TagComper.readRealFileName(name);
-
- newStr += "<%@include file=\""+ path +"\"%>";
- } else {
- newStr += content;
- }
- }
-
- return newStr;
- }
- */
- /**
- *
- * 发布前: <iframe wdPlugin="ry_cx" /> 发布后: <iframe src="…" />
- *
- * @param srcStr;
- * @return String
- */
- // 来自 FileTranslator.transwdPluginsrc(String srcStr, String appName,
- // String ymid, String wzid, GeneralDBAccess gdba)。Lin
- // 去掉 appName、ymid、wzid、gdba
- public static String transwdPluginsrc(String srcStr) {
- /* 再去掉 -- 最终,删空了,可以直接用最后面的 return srcStr 了。Lin
- if (srcStr == null)
- return null;
- */
- // try { // 再去掉,IDEA -- Empty 'try' block。Lin
- /* 再改,IDEA:'\'' is unnecessarily escaped。Lin
- String reg_Aservice = "wdPlugin=[\'\"](.*?)[\'\"]";
- */
- /* 再去掉,没用到。Lin
- String reg_Aservice = "wdPlugin=['\"](.*?)['\"]";
- */
- // Pattern p = Pattern.compile(reg_Aservice); // 再去掉,没用到。Lin
- // Matcher m1=
- // p.matcher(" <iframe wdPlugin='ry_cx' /> height=\"100px\" ");
- // Matcher m1 = p.matcher(srcStr); // 再去掉,没用到。Lin
- /* 再去掉,按 IDEA 规范。Lin
- * Empty 'try' block > 'while' statement has empty body
- while (m1.find()) {
- // try {
- /// * 去掉,没用到。Lin
- // String attrV = m1.group();
- // String dest = m1.group(1);
- /// *
- // Long bjid = new BjDaoImpl().selectBjid(dest, appName, gdba, false);
- // if (bjid == null) {
- // System.out.println(attrV + " not foud dest");
- // } else {
- //// Bj bj = new Bj();
- //// bj.setBjid(bjid);
- // Map<String, String> json = DesignOutSide.beansToMap(bj);
- // String csfw = json.get("csfw");
- //
- // if (StringUtil.isNull(csfw)) {
- // csfw = "dest:" + bjid;
- // } else {// name:"ry_cx"
- // csfw += ",dest:" + bjid;
- // }
- // String src = new UrlTranslator(appName, ymid, wzid, false, gdba).translate("@service{" + csfw + "}@");
- //
- // srcStr = srcStr.replace(attrV, "src=\"" + src + "\"");
- //
- // }
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- }
- */
- /* 再去掉,IDEA -- Empty 'try' block。Lin
- } catch (Exception e) {
- e.printStackTrace();
- }
- */
- return srcStr;
- }
- /// **
- // * 翻译@service{service:xxxx,dest:cccccc,param:{vvv:1314}}
- // *
- // * @param srcStr
- // * @param appName
- // * @param ymid
- // * @param wzid
- // * @return
- /// *
- /* 去掉,用 TagComper.transform(str)。Lin
- // 来自 FileTranslator.transFormAtService(String srcStr, String appName, String ymid, String wzid, GeneralDBAccess gdba)。Lin
- // 去掉 ymid、wzid、gdba
- // 去掉 appName,直接用 PrjApp.prjName。Lin
- public static String transFormAtService(String srcStr) {
- if (srcStr == null) return null;
- ///* 改为 <serv@ss name= />。Lin
- /// String reg_Aservice = "@service\\{.*?\\}@";// 此正则中的“?”用于最小匹配
- /// end。Lin
- String reg_Aservice = "<[a-z]*@ss[^>]*?/>";
- List<Map<String, Object>> atServicelist = StrU.findMatch2(srcStr, reg_Aservice, 0);
- for (Map<String, Object> m : atServicelist) {
- String serviceStr = m.get("content").toString();
- try {
- ///* 去掉结构函数,runWithoutJSP 放到 new 之后赋值 -- false 的话,不用赋值(默认值为 false)。Lin
- ///* 去掉 appName,直接用 PrjApp.prjName。Lin
- /// String rs = new UrlTranslator(appName, ymid, wzid, false, gdba).translate(serviceStr);
- /// end。Lin
- ///* 再改,归入 xxxTagComper。Lin
- ///* 用 TagComper.transform() -- UrlServTranslator.translate() 移到 ServTagComper
- /// String rs = new UrlServTranslator().translate(serviceStr);
- /// end。Lin
- String rs = TagComper.transform(serviceStr);
- srcStr = srcStr.replace(serviceStr, rs);
- } catch (RuntimeException e) {
- e.printStackTrace();
- } catch (Exception e) {
- if (e.getMessage().contains("查找部件失败:")) {
- SsLog.print("发布异常:"+e.getMessage());
- // PmsUtilCache.addErrorlog("发布异常:"+e.getMessage()); // 先去掉,需要再弄。Lin
- } else {
- e.printStackTrace();
- }
- }
- }
- return srcStr;
- }
- */
-
- // 来自 pms-core:FileTranslator.(StringReader) addViewObjectTools(StringReader reader, String appName,
- // String dxm, PageObject pageobj, String ymid, String wzid, boolean isViewJsp,
- // boolean systemCreate11, GeneralDBAccess gdba)。Lin
- // Info、Input 页面才会调用
- // 去掉入口参数 appName,直接用 PrjApp.prjName
- // 去掉 isViewJsp,没有 ViewJsp 了
- // 去掉 dxm,有 pageobj 就够了
- // 去掉 wdgdba,需要时再获取数据库连接
- // 去掉 ymid、wzid
- // 再增加 prjApp(PrjApp) 入口参数 -- 增加支持多线程。Lin
- // 再去掉 systemCreate11(boolean),没用到 -- 按 IDEA 规范。Lin
- private static StringReader addViewObjectTools(StringReader reader, PageB pageobj, PrjApp prjApp) throws Exception {
- /* 改,去掉 ViewObjectUtil.findViewObjectByName(,直接用 SsApp.objMap.get(。Lin
- * 去掉 appName,直接用 PrjApp.
- ViewObject vo = ViewObjectUtil.findViewObjectByName(appName, dxm);
- */
- String dxm = pageobj.objName;
- ObjB vo = prjApp.objMap.get(pageobj.objName); // = PrjApp.。再,支持多线程。Lin
- if (vo == null
- // || StringUtil.isNull(vo.getObjClass())
- )
- return reader;
- // if (bjdm.contains(dxm + "_printInfo") || bjdm.equals(dxm +
- // "_baseInfo")
- // || bjdm.equals(dxm + "_input")
- // || bjdm.contains(dxm + "_input_")
- // || bjdm.contains(dxm + "_baseInfo_")) {
- // } else {
- // return reader;
- // }
- // boolean needValidation=pageobj.getTempcode().isInputPage();
- /* 去掉 TempCode 了 -- 移到 PageB 里。Lin
- boolean isInfo = pageobj.getTempcode().isInfoPage();
- */
- boolean isInfo = pageobj.isInfo;
-
- /* 去掉 TempCode 了,改用 PageB.name。Lin
- //baseinfo包上数据授权标签
- boolean isBaseInfo=pageobj.getTempcode().getName().contains("_baseInfo");
- boolean isminiBaseInfo=pageobj.getTempcode().getName().contains("_miniBaseInfo");
- boolean isminiInput=pageobj.getTempcode().getName().contains("_miniInput");
- */
- boolean isBaseInfo = pageobj.name.contains(PageC.PAGE_baseInfoSfx);
- boolean isminiBaseInfo = pageobj.name.contains(PageC.PAGE_miniInfoSfx);
- boolean isminiInput = pageobj.name.contains("_miniInput");
-
- String fieldNamePrefix="";
- String fieldNameValPrefix="";
- if(isminiInput||isminiBaseInfo){
-
- //miniInput miniBaseInfo
-
- // js变量不能带"。"
- fieldNameValPrefix = dxm +"${wdgroup}";
-
- fieldNamePrefix = fieldNameValPrefix +".";
- }
- /* 去掉 appName,不支持多个应用。Lin
- * webapp 改用 SsApp。Lin
- WebApp webapp = WD.getApp(appName);
- */
-
- // 已经处理过的字段,info部件不再处理
- List<String> filterNames=new ArrayList<>();
- // // 处理printInfo
- // if (bjdm.contains(dxm + "_printInfo")) {
- // isInfo = true;
- // systemCreate11 = false;
- // }
- //
- // if (isInfo && systemCreate11) {
- // Long inputid = new BjDaoImpl().selectBjid(
- // bjdm.replace("baseInfo", "input"), appName, gdba);
- // String inputxgwj = CoreConstVars.webRoot
- // + new BjDaoImpl().getXgwj(inputid, gdba);
- // if (new File(inputxgwj).isFile())
- // reader = new StringReader(FileUtils.readFileToString(new File(
- // inputxgwj), "utf-8"));
- // }
- // ######################################################################
- {
- // check and get baseInfo,input
- // main/object/_input/zgz_dev/fake_input.jsp
- // main/object/_baseInfo/zgz_dev/fake_input.jsp
- /* 再改,IDEA:'StringBuffer sb' may be declared as 'StringBuilder'。Lin
- StringBuffer sb = new StringBuffer();
- */ StringBuilder sb = new StringBuilder();
- BufferedReader in = new BufferedReader(reader);
- // String s = ""; // 移到下面用到的地方。按 IDEA 规范 -- Variable 's' initializer '""' is redundant 。Lin
- /* 去掉 WDGrowHigh 结构函数。Lin
- * 改用 TagComper 的 transform(String str),没有改写父类的
- WDGrowHigh growHeightTransformer = new WDGrowHigh(appName, wzid, ymid, gdba);
- */
- List<String[]> allInputTab = new LinkedList<>();
- Map<String, List<String[]>> onoffbutton_inputs = new HashMap<>();
- // Map<String, String[]> cascadingTag = new HashMap();
- // Map<String, CascadingSelectObject> cascadingObjects = webapp.getCascadingSelectObject();
- Set<ObjFieldB> captchaField = new HashSet<>();
- List<String[]> wdTabNoList=new ArrayList<>();
- String s; // 从上面移到这。Lin
- while ((s = in.readLine()) != null) {
- // input
- String[] inputTab = StrWeb.findLabelName(s, "input", null);
- if (inputTab != null) {
- String name = inputTab[1];
- Map<String, String> m = inputElementProperties_input(inputTab[0]);
- // String wdCascadingSelect = m.get("wdCascadingSelect");
- String wdRadio = m.get("ssRad"); // ("wdRadio")。Lin
- String wdCheckbox = m.get("wdCheckbox");
- String wdTabNo = m.get(ObjC.FIELD_no); // ("wdTabNo")。Lin
- if (StringUtils.isNumeric(wdTabNo)) // (StrU.isNum(wdTabNo))。Lin
- wdTabNoList.add(new String[]{name, wdTabNo});
- ObjFieldB f = vo.fieldMap.get(name);
- /* 去掉 ObjFieldB.captchaLength,改用 ObjFieldB.hasCaptcha。Lin
- if (f != null && f.getCaptchaLength() > 0) {
- */
- if (f != null && f.hasCaptcha) {
- captchaField.add(f);
- }
- if (StringUtils.isNotBlank(wdRadio) // StrU.notNull()。Lin
- || StringUtils.isNotBlank(wdCheckbox)) { // StrU.notNull()。Lin
- /* 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
- if (onoffbutton_inputs.get(name) == null)
- onoffbutton_inputs.put(name, new ArrayList<>());
- */ onoffbutton_inputs.computeIfAbsent(name, k -> new ArrayList<>());
- onoffbutton_inputs.get(name).add(inputTab);
- }
- // else if (StringUtil.notNull(wdCascadingSelect)) {
- // try {
- // // name:’ cxlbjl’, filter:{cslbdl:’0000’}
- // JsonObject json = new JsonParser().parse("{" + wdCascadingSelect + "}").getAsJsonObject();
- // String cascadingname = json.get("name").getAsString();
- // String cascadingfilter = json.get("filter") != null ? json.get("filter").toString() : null;
- // CascadingSelectObject mm = cascadingObjects.get(cascadingname);
- // if (mm != null) {
- // int si = mm.getInputs().getInputList().size() - 1;
- // String lastInputName = mm.getInputs().getInputList().get(si).getName();
- // String filterStr = StringUtil.notNull(cascadingfilter) ? ("filter=\"" + cascadingfilter + "\"") : "";
- // cascadingTag.put(lastInputName, new String[] { "<wd:cascadingSelect value=\"" + cascadingname + "\" " + filterStr + "/>",
- // "<wd:cascadingSelect value=\"" + cascadingname + "\" " + filterStr + "/>" });
- // }
- // } catch (Exception e) {
- // e.printStackTrace();
- // System.out.println("not a json string: " + wdCascadingSelect);
- // }
- //
- // // allInputTab.add(inputTab);
- //
- // }
- // else if (f == null) {
- // allInputTab.add(inputTab);
- // } else if (Field.TYPE_HTML.equals(f.getType())) {
- // allInputTab.add(inputTab);
- // } else if (Field.TYPE_PICTURE.equals(f.getType())) {
- // allInputTab.add(inputTab);
- // } else if (Field.TYPE_PHOTO.equals(f.getType())) {
- // allInputTab.add(inputTab);
- // } else if (Field.TYPE_TIME.equals(f.getType())
- // && f.isEnrolDate()) {
- // allInputTab.add(inputTab);
- // }else if(Field.TYPE_PASSWORD.equals(f.getType())){
- // allInputTab.add(inputTab);
- // }
- allInputTab.add(inputTab);
- }
- /* 再改,IDEA:String concatenation as argument to 'StringBuilder.append()' call。Lin
- sb.append(s + "\r\n");
- */ sb.append(s).append("\r\n");
- }
-
- /* 再改,IDEA:Can be replaced with 'Comparator.comparingInt'。Lin
- wdTabNoList.sort((a,b)->{
- return Integer.parseInt(a[1])-Integer.parseInt(b[1]);
- });
- */ wdTabNoList.sort(Comparator.comparingInt(a -> Integer.parseInt(a[1])));
- /* 再改,IDEA:'wdTabNoList.size()>0' can be replaced with '!wdTabNoList.isEmpty()'。Lin
- if(wdTabNoList.size()>0){
- */ if (!(wdTabNoList.isEmpty())) {
- sb.append("<script>window.wdTabNoList=[\"");
- List<String> wdTabNoList2= wdTabNoList.stream().map(a->a[0]).collect(Collectors.toList());
- sb.append(String.join("\",\"", wdTabNoList2));
- sb.append("\"];");
- sb.append("</script>\r\n");
- }
- String inputContent = sb.toString();
- String baseInfoContent = sb.toString();
- List<ObjFieldB> defaultValueField=new ArrayList<>();
- // BaseBean bean = (BaseBean) Class.forName(vo.getObjClass())
- // .newInstance();
- // String tableName = bean.getDbTableName().toLowerCase();
- // create new content
- for (String[] temp : allInputTab) {
- Map<String, String> inputproperties = inputElementProperties_input(temp[0]);
- String fieldname = temp[1];
- ObjFieldB f = vo.fieldMap.get(fieldname);
- /* 去掉 Field.defaultValue(含名和参数),改用 dictName + dictParm。Lin
- if(f!=null && StrUtil.notNull(f.getDefaultValue()) ){
- */
- if (f != null && StringUtils.isNotBlank(f.dictName)) {
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- defaultValueField.add(f);
- }
- /// 很奇怪的截取,"mswj"、"fjid"还有点道理???Lin
- // 应该是为了获得字段名 "sltwj"/"mswj"/"fjid" 里的 <ulImg.ss name="slt"/<editor.ss name="ms"/<cms.ss name=" -- 原约定了隐藏字段 <上传名>wj
- String sname = (fieldname.length() > 2) ? fieldname.substring(0, fieldname.length() -2) : fieldname;
- ///
- String snameVal = fieldNameValPrefix + sname;
- sname = fieldNamePrefix + sname;
- String widthStr = getAttributeStr(inputproperties, "width");
- String heightStr = getAttributeStr(inputproperties, "height");
- String classStr = getAttributeStr(inputproperties, "class");
- String styleStr = getAttributeStr(inputproperties, "style");
- boolean wdReadonly = "true".equals(inputproperties.get("wdReadonly"));
- // if (StringUtil.notNull(inputproperties.get("type")) && !"text".equals(inputproperties.get("type")))
- // continue;
- // if (cascadingTag.get(fieldname) != null) {
- // inputContent = inputContent.replace(temp[0], temp[0] + "\r\n" + cascadingTag.get(fieldname)[0]);
- // baseInfoContent = baseInfoContent.replace(temp[0], temp[0] + "\r\n" + cascadingTag.get(fieldname)[1]);
- // } else
- if (SearchC.FIELD_ssKeywordName.equalsIgnoreCase(fieldname)) { // ("wdKeyword".。Lin
- /* 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
- if (inputproperties.get("value") == null)
- inputproperties.put("value", "<txt@ss val='${"+ fieldname +"}'/>"); // <wd:write value=。Lin
- */
- inputproperties.computeIfAbsent("value", k -> "<txt.ss val='${" + fieldname + "}'/>"); // <wd:write value=。Lin
- String valueStr = inputproperties.get("value");
- /// 增加,转为新标准。Lin
- String buttonStr = getAttributeStr(inputproperties, "button");
- if (StringUtils.isNotBlank(buttonStr))
- buttonStr = buttonStr.replace("button=", "btn=");
- ///
- // <div id="ms" width="100%"
- // height="100px"><wd:write value='${ry.ms}'/></div>
- // <wd:write type="growHeight" name="ms" mode="edit"
- // maxHeight="300px"/>
- String c = "";
- c += "<div id=\"" + fieldname + "\" " + getAttributeStr(inputproperties, "placeholder") + " " + getAttributeStr(inputproperties, "width") + " "
- + getAttributeStr(inputproperties, "height") + ">" + valueStr + "</div>\r\n";
- /* 用 TagComper.transform(str),growHeightTransformer 没盖写过。Lin
- c += growHeightTransformer.transform("<wd:write multiLine=\"false\" type=\"growHeight\" "
- */
- c += TagComper.compTag("<growh.ss multiline=\"false\" "
- + getAttributeStr(inputproperties, "name") + " "
- /* 改,转为新标准。Lin
- + getAttributeStr(inputproperties, "button") + " "
- */ + buttonStr + " "
- + getAttributeStr(inputproperties, "maxHeight") + " mode=\"edit\" />\r\n");
- String d = "";
- d += "<div id=\""+ fieldname +"\" "+ getAttributeStr(inputproperties, "placeholder") +" "+
- getAttributeStr(inputproperties, "width") +" "+
- getAttributeStr(inputproperties, "height") +">"+
- getAttributeStr(inputproperties, "value") +"</div>\r\n";
- /* 用 TagComper.transform(str),growHeightTransformer 没盖写过。Lin
- d += growHeightTransformer.transform("<wd:write multiLine=\"false\" type=\"growHeight\" "
- */
- d += TagComper.compTag("<growh.ss multiline=\"false\" "+
- getAttributeStr(inputproperties, "name") +" "+
- /* 改,转为新标准。Lin
- getAttributeStr(inputproperties, "button") + " "+
- */ buttonStr +" "+
- getAttributeStr(inputproperties, "maxHeight") +" mode=\"play\" />\r\n");
- inputContent = inputContent.replace(temp[0], c);
- baseInfoContent = baseInfoContent.replace(temp[0], d);
- filterNames.add(fieldname);
- /* 再改为 IDEA 规范。Lin
- * 'if' statement has empty body
- * 'continue' is unnecessary as the last statement in a loop > 'if' statement has empty body
- } else if (f == null) {
- }else if (StringUtils.isNotBlank(inputproperties.get("type")) // StrU.notNull()。Lin
- && !"text".equals(inputproperties.get("type"))) {
- // if("hidden".equals(inputproperties.get("type"))){
- // String value="${##tableName.##fileName}";
- // if(inputproperties.get("value")!=null)
- // value=inputproperties.get("value");
- // String c = "";
- // c += "<input name=\"##fieldNamePrefix##fileName\" type=\"hidden\" value=\""+value+"\">\r\n";
- // c = c.replaceAll("##fileName", f.getName()).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix",Matcher.quoteReplacement(fieldNamePrefix)).replaceAll("##fieldNameValPrefix",Matcher.quoteReplacement(fieldNameValPrefix));
- // inputContent = inputContent.replace(temp[0], c);
- // baseInfoContent = baseInfoContent.replace(temp[0], "");
- // }
- continue; // 再去掉,按 IDEA 规范 -- 'continue' is unnecessary as the last statement in a loop。Lin
- /// * String 改为 int。Lin
- // } else if (f.type.equals(ObjC.FIELD_htmlType)) { // Field.TYPE_HTML。Lin
- /// *
- } else if (f.type == ObjC.FIELD_htmlType) {
- */
- } else if (f != null &&
- (StringUtils.isBlank(inputproperties.get("type"))
- || "text".equals(inputproperties.get("type")))) {
- /// 改为新UI,增加。Lin
- /**
- * 新UI发布程序:
- * 富文本:
- * 原程序是录入页和baseInfo发布,都写在下面这个分支
- *
- */
- ///
- if (f.type == ObjC.FIELD_htmlType) {
- // <div id='msEdit' width="167px" height=”100px”/>
- // <input type="hidden" name="mswj" value="${xxxx} "/>
- // <common:write type="UEditor" name="ms" button=“’加粗’,
- // {name:’附件’,key:’fjid’,value:'附件ID的值'}”
- // mode=”${用EL表达式输出edit(录入)或者change(变动)}”
- // value='{"template":"wz"}' />
- // if ("hidden".equals(inputproperties.get("type")))
- // continue;
- /// 改为新UI,增加。Lin
- //录入页,用新UI
- if(pageobj.isInp) {
- if (inputproperties.get("value") == null){//这里必需用下面的办法获取value
- inputproperties.put("value","${"+dxm+"."+f.name+"}");
- }
- String richTextInputContent = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_html, //组件类弄
- inputproperties,//组件属性
- vo,
- fieldname
- );
- inputContent = inputContent.replace(temp[0], richTextInputContent);
- filterNames.add(fieldname);
- } else if (isBaseInfo) {
- ///
- /* 再改,内容 表增加 对象名、对象ID 字段 -- 对象的附件 -- 还有审核时的附件,在 TagComper。Lin
- String c = "<div id=\""+ sname +"Edit\" "+ widthStr +" "+ heightStr +" "+ classStr +"></div>\r\n";
- */ String c = "<div id=\""+ sname +"Edit\""+
- " data-ss-nr-obj-name=\"${ssObjName}\" data-ss-nr-obj-id=\"${ssObjId}\""+
- " "+ widthStr +" "+ heightStr +" "+ classStr +"></div>\r\n";
- c += "<input type=\"hidden\" name=\""+ fieldname +"\" value=\"${"+ dxm +"."+ fieldname +"}\"/>\r\n";
- /* 改。Lin
- c += "<wd:write type=\"UEditor\" name=\"" + sname + "\" "
- + (StringUtil.isNull(inputproperties.get("wdButton")) ?
- "" : ("button=\"" + inputproperties.get("wdButton") + "\""))
- + " mode=\"${dataType=='change'?'change':'edit'}\""
- + " value='{\"template\":\"" + vo.getName() + "\"}' />\r\n";
- */ c += "<editor.ss name=\""+ sname + "\" "+
- ((StringUtils.isBlank(inputproperties.get("ssBtn"))) ?
- "" : ("btn=\""+ inputproperties.get("ssBtn") +"\"")) +
- " mode=\"${dataType=='"+ ObjC.CHILD_chgType +"'?'"+ ObjC.CHILD_chgType +"':'edit'}\""+
- " val='{\"template\":\""+ vo.name +"\"}'/>\r\n";
- // c+="<script>wd.edit.addClearTextButton(\""+fieldname+"\");</script>\r\n";
- // <div name=' msPlay' width="167px" height=”100px”/>
- // <input type="hidden" name="mswj" value="${xxxx} ">
- // <common:write type="html" name="ms" button=“’加粗’, {name:
- // ’附件’,value:'附件ID的值' }” mode=”play”
- // value='{"template":"wz"}'
- // />
- String d = "<div id=\""+ sname +"Play\" "+ widthStr +" "+ heightStr +" "+ classStr +"></div>\r\n";
- d += "<input type=\"hidden\" name=\""+ fieldname +"\" value=\"${"+ dxm +"."+ fieldname +"}\"/>\r\n";
- // d+="<script>\r\n";
- // d+="wd.display.initGrowHeightHtml('"+sname+"Play',300,'"+inputproperties.get("wdButton")+"');\r\n";
- // d+="</script>\r\n";
- /* 改。Lin
- d += "<wd:write type=\"UEditor\" name=\"" +sname + "\" "
- + (StringUtil.isNull(inputproperties.get("wdButton")) ?
- "" : ("button=\"" + inputproperties.get("wdButton") + "\""))
- + " mode=\"play\" value='{\"template\":\"" + vo.getName() + "\"}' />\r\n";
- */ d += "<editor.ss name=\""+ sname +"\" "+
- ((StringUtils.isBlank(inputproperties.get("ssBtn")))?
- "" : ("btn=\""+ inputproperties.get("ssBtn") +"\"")) +
- " mode=\"play\""+
- " val='{\"template\":\""+ vo.name +"\"}'/>\r\n";
- inputContent = inputContent.replace(temp[0], wdReadonly ? d : c);
- if (isBaseInfo)
- /* 改。Lin
- d="<wd:permission name=\""+fieldname+"\">\r\n"+d+"\r\n</wd:permission>";
- */ d = "<auth.ss field=\""+ fieldname +"\">\r\n"+ d +"\r\n</auth.ss>";
- baseInfoContent = baseInfoContent.replace(temp[0], d);
- filterNames.add(fieldname);
- } // 改为新UI,增加。Lin
- /// 改为新UI,增加。Lin
- /**
- * 新UI:
- * 图片部件,如:<field name="zjzwj" desc="证件照" type="img" width="100" height="140"/>
- *
- * 旧UI的图片部件发布程序,是baseInfo和录入页,都是调用下面的程序的
- */
- ///
- /* String 改为 int。Lin
- } else if (f.type.equals(ObjC.FIELD_photoType)) { // Field.TYPE_PHOTO。Lin
- */
- /* 再改,先改 FIELD_photoType("photo") 为 FIELD_imgType("img"),原 FIELD_imgType("img") 暂时改为 FIELD_img1Type("img1")。Lin
- * "picture" 用到再弄 -- 只有 wz.object.xml 用到,"标题图片文件"、"滚动图片文件":type="picture" width= height=
- } else if (f.type == ObjC.FIELD_photoType) { // 考虑去掉 photo,共用 img???Lin
- */ } else if (f.type == ObjC.FIELD_imgType) { // "photo"。Lin
- /// 改为新UI,增加。Lin
- //录入页,用新UI
- if(pageobj.isInp) {
- if (inputproperties.get("value") == null){//这里必需用下面的办法获取value
- inputproperties.put("value","${"+dxm+"."+f.name+"}");
- }
- String imgInputContent = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_img, //组件类弄
- inputproperties,//组件属性
- vo,
- fieldname
- );
- inputContent = inputContent.replace(temp[0], imgInputContent);
- filterNames.add(fieldname);
- }
- else if (isBaseInfo) {//查看页先用回老UI的
- ///
- // <input name="zjzwj" placeholder=" default-photo.png "
- // class="photo" style="float: left;" />
- // <div class="photo" style="float: left;" id="zjzEdit">
- // <wd:equal leftValue="${empty ry.zjzwj}"
- // rightValue="false">
- // <img
- // src="@service{name:'getData',param:{path:'${ry.zjzwj}'}}@"
- // onerror_="this.src='${sessionScope['wd.yh'].pflj}image/default-photo.png'"
- // id="zjzimg" />
- // </wd:equal>
- // <wd:equal leftValue="${empty ry.zjzwj}"
- // rightValue="true">
- // <img
- // src="${sessionScope['wd.yh'].pflj}image/default-photo.png"
- // id="zjzimg" />
- // </wd:equal>
- // </div>
- // <input name="zjzwj" type="hidden" value="${ry.zjzwj}">
- // <wd:write name="zjz" type="upload" value=""
- // callback="updateZjzimg"></wd:write>
- // <script type="text/javascript">
- // function updateZjzimg() {
- // $("#zjzImg").attr('src',
- // "@service{name:'getData'}@&path="+encodeURIComponent($("input[name='zjzwj']").val()));
- // }
- // </script>
- // String fileType = " fileType='\"JPG\",\"JPEG\",\"PNG\",\"BPM\",\"GIF\"' ";
- // String c = "<div " + classStr + " " + styleStr + " id=\"" + sname + "Edit\">\r\n";
- // c += "<wd:equal leftValue=\"${empty ##tableName.##fileName}\" rightValue=\"false\">\r\n";
- // c += "<img src=\"@service{name:'getData',param:{path:'${##tableName.##fileName}'}}@\" onerror_=\"this.src='${sessionScope['wd.yh'].pflj}image/"
- // + inputproperties.get("placeholder") + "'\" id=\"" + snameVal + "Img\" />\r\n";
- // c += "</wd:equal>\r\n";
- // c += "<wd:equal leftValue=\"${empty ##tableName.##fileName}\" rightValue=\"true\">\r\n";
- // c += "<img src=\"${sessionScope['wd.yh'].pflj}image/" + inputproperties.get("placeholder") + "\" id=\"" + snameVal + "Img\" />\r\n";
- // c += "</wd:equal>\r\n";
- // c += "</div>\r\n";
- // c += "<script type=\"text/javascript\">\r\n";
- // c += " function update" + snameVal + "img() {\r\n";
- // c += " $(\"#" + snameVal + "Img\").attr('src', \"@service{name:'getData'}@&path=\"+encodeURIComponent($(\"input[name='##fieldNamePrefix##fileName']\").val()));\r\n";
- // c += " }\r\n";
- // c += "</script>\r\n";
- // c += "<input name=\"##fieldNamePrefix##fileName\" type=\"hidden\" value=\"${##tableName.##fileName}\">\r\n";
- // c += "<wd:write name=\"" + sname + "\" type=\"upload\" " + fileType + " value=\"\" callback=\"update" + snameVal + "img\" width=\"" + f.getWidth()
- // + "\" height=\"" + f.getHeight() + "\"></wd:write>\r\n";
- String value = "${##tableName.##fileName}";
- if (inputproperties.get("value") != null)
- value = inputproperties.get("value");
- String c = "<div "+ classStr +" "+ styleStr +" id=\""+ sname +"Edit\">\r\n";
- c += "<img defaultSrc=\"${sessionScope['ssUser'].skinDir}image/"
- + inputproperties.get("placeholder") +"\" id=\""+ sname +"Img\" />\r\n";
- c += "</div>\r\n";
- c += "<input name=\"##fieldNamePrefix##fileName\" type=\"hidden\" value=\""+ value +"\">\r\n";
- /* 改。Lin
- c += "<wd:write name=\"" + sname + "\" type=\"editphoto\" "
- + " width=\"" + f.getWidth()+"\" height=\"" + f.getHeight() + "\"></wd:write>\r\n";
- */ c += "<ulImg.ss name=\""+ sname +"\" width=\""+ f.width +"\" height=\""+ f.height +"\"/>\r\n";
- // c+="<input value=\"xxxx\" type=\"button\" onclick='@service{dest:\"img_crop\",show:\"wdDialog\",param:{}}@'></input>";
- // <div class="photo" style="float: left;">
- // <wd:equal leftValue="${empty ry.zjzwj}"
- // rightValue="false">
- // <img
- // src="@service{name:'getData',param:{path:'${ry.zjzwj}'}}@"
- // id="zjzimg"
- // onerror_="this.src='${sessionScope['wd.yh'].pflj}image/default-photo.png'"
- // />
- // </wd:equal>
- // <wd:equal leftValue="${empty ry.zjzwj}"
- // rightValue="true">
- // <img
- // src="${sessionScope['wd.yh'].pflj}image/default-photo.png"
- // id="zjzimg"
- // onerror_="this.src='${sessionScope['wd.yh'].pflj}image/default-photo.png'"
- // />
- // </wd:equal>
- // </div>
- String d = "<div id=\"##fieldNameValPrefix##fileNameDiv\" " + classStr + " " + styleStr + ">";
- /* 改。Lin
- d += "<wd:equal leftValue=\"${empty ##tableName.##fileName}\" rightValue=\"false\">";
- */ d += "<equal.ss val=\"${empty ##tableName.##fileName}\" val2=\"false\">";
- /* 改。Lin
- d += "<img src=\"@service{name:'getData',param:{path:'${##tableName.##fileName}'}}@\" id=\"" + snameVal
- + "img\" onerror_=\"this.src='${sessionScope['wd.yh'].pflj}image/" + inputproperties.get("placeholder") + "'\" />";
- */
- /* 再改,增加 type="img",分开处理图片的 上传、下载 -- sltwj 字段 -- <ulImg.ss、dlByHttp。Lin
- * 上传,只保存相对文件名 -- D:/pms/data/img/xxx/yyy 里的 xxx/yyy
- * 下载,使用 AppB.imgBaseDir,不使用 AppB.appRoot
- d += "<img src=\"<serv.ss name='dlByHttp' parm='{path:"${##tableName.##fileName}"}'/>\""
- + " id=\""+ snameVal
- + "img\" onerror_=\"this.src='${sessionScope['wd.yh'].skinDir}image/"
- + inputproperties.get("placeholder") +"'\" />";
- */ d += "<img src=\"<serv.ss name='dlByHttp' parm='{type:"img",path:"${##tableName.##fileName}"}'/>\""
- + " id=\""+ snameVal
- + "img\" onerror_=\"this.src='${sessionScope['ssUser'].skinDir}image/"
- + inputproperties.get("placeholder") +"'\" />";
- /* 改。Lin
- d += "</wd:equal>";
- d += "<wd:equal leftValue=\"${empty ##tableName.##fileName}\" rightValue=\"true\">";
- */
- d += "</equal.ss>";
- d += "<equal.ss val=\"${empty ##tableName.##fileName}\" val2=\"true\">";
- d += "<img src=\"${sessionScope['ssUser'].skinDir}image/"+ inputproperties.get("placeholder")
- + "\" id=\""+ snameVal
- + "img\" onerror_=\"this.src='${sessionScope['ssUser'].skinDir}image/"
- + inputproperties.get("placeholder") +"'\" />";
- /* 改。Lin
- d += "</wd:equal>";
- */ d += "</equal.ss>";
- d += "</div>";
- d += "<script type=\"text/javascript\">\r\n";
- d += "$(\"###fieldNameValPrefix##fileNameDiv\").click(function(){\r\n";
- /* 改。Lin
- d += "var url =\"@service{name:'getData',param:{path:'${##tableName.##fileName}'}}@\";\r\n";
- */
- /* 再改,增加 type="img",分开处理图片的 上传、下载 -- sltwj 字段 -- <ulImg.ss、dlByHttp。Lin
- * 上传,只保存相对文件名 -- D:/pms/data/img/xxx/yyy 里的 xxx/yyy
- * 下载,使用 AppB.imgBaseDir,不使用 AppB.appRoot
- d += "var url =\"<serv.ss name='dlByHttp' parm='{path:"${##tableName.##fileName}"}'/>\";\r\n";
- */ d += "var url =\"<serv.ss name='dlByHttp' parm='{type:"img",path:"${##tableName.##fileName}"}'/>\";\r\n";
- d += "var errorPhoto='${sessionScope['ssUser'].skinDir}image/"
- + inputproperties.get("placeholder") + "'; \r\n";
- d += "wd.display.previewPicture(url,errorPhoto);\r\n";
- d += " })\r\n";
- d += "</script>\r\n";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm)
- .replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix))
- .replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
- c = c.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm)
- .replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix))
- .replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
- /// 改为新UI,增加。Lin
- //原来录入页的html代码
- ///
- inputContent = inputContent.replace(temp[0], wdReadonly ? d : c);
- if (isBaseInfo)
- /* 改。Lin
- d="<wd:permission name=\""+fieldname+"\">\r\n"+d+"\r\n</wd:permission>";
- */ d = "<auth.ss field=\""+ fieldname +"\">\r\n"+ d +"\r\n</auth.ss>";
- /// 改为新UI,增加。Lin
- //原来查看页的html代码
- ///
- baseInfoContent = baseInfoContent.replace(temp[0], d);
- filterNames.add(fieldname);
- } // 改为新UI,增加。Lin
- /* String 改为 int。Lin
- } else if (f.type.equals(ObjC.FIELD_imgType)) { // Field.TYPE_PICTURE。Lin
- */
- /* 再改,先改 FIELD_photoType("photo") 为 FIELD_imgType("img"),原 FIELD_imgType("img") 暂时改为 FIELD_img1Type("img1")。Lin
- * "picture" 用到再弄 -- 只有 wz.object.xml 用到,"标题图片文件"、"滚动图片文件":type="picture" width= height=
- } else if (f.type == ObjC.FIELD_imgType) {
- */ } else if (f.type == ObjC.FIELD_img1Type) { // "picture"。Lin
- // <span id="zjzwjmc"></span>
- // <input name="zjzwj" type="hidden" value="${ry.zjzwj}">
- // <input class="content-button" id="zjzEdit" type="button"
- // value="上传"/>
- // <script type="text/javascript" charset="utf-8"
- // src="/wd/js/jquery.form.min.js"></script>
- // <script type="text/javascript" charset="utf-8"
- // src="/wd/js/upload.js"></script>
- // <script>var
- // wd=wd||{};wd.uploadFile=wd.uploadFile||{}</script><script>$(document).ready(function(){$("#zjzEdit").uploadFile({validation:'null',width:98,height:98,size:null,name:'zjz',callback:updatezjzwjimg});})</script>
- //
- // <script type="text/javascript">
- // function updatezjzwjimg() {
- // $("#zjzwjmc").empty();
- // var arr = $("input[name='zjzwj']").val().split("/");
- // $("#zjzwjmc").append(arr.length>0?arr[arr.length-1]:"");
- // }
- // $("#zjzwjmc").parent().click(function(){
- // var path=$("input[name='zjzwj']").val();
- // var url
- // ="<wd:token service='zgz.getData' dest='' param='' test='' />&path="+encodeURIComponent(path);
- // var
- // errorPhoto='${sessionScope['wd.yh'].pflj}image/default-personalPhoto.png';
- // wd.display.previewPicture(url,errorPhoto);
- // });
- // updatezjzwjimg();
- // </script>
- /* 改。Lin
- String fileType = " fileType='\"JPG\",\"JPEG\",\"PNG\",\"BPM\",\"GIF\"' ";
- */
- /* 再改,改了 upload.js,去掉 ""。Lin
- String fileType = " type='\"JPG\",\"JPEG\",\"PNG\",\"BPM\",\"GIF\"' ";
- */ String fileType = " type='jpg,jpeg,png,bpm,gif' ";
- String c = "<span id=\"##fieldNamePrefix##fileNamemc\"></span>\r\n"
- + "<script type=\"text/javascript\">\r\n"
- + "function update" + sname + "img() {\r\n"
- + "$(\"###fieldNamePrefix##fileNamemc\").empty();\r\n"
- + "var arr = $(\"input[name='##fieldNamePrefix##fileName']\").val().split(\"/\");\r\n"
- + "$(\"###fieldNamePrefix##fileNamemc\").append(arr.length>0?arr[arr.length-1]:\"\");\r\n"
- + "}\r\n"
- + "$(\"###fileNamemc\").parent().click(function(){\r\n"
- + "var path=$(\"input[name='##fieldNamePrefix##fileName']\").val();\r\n"
- /* 改。Lin
- * 先不改 type="img",用到再弄 -- 见上面的 ObjC.FIELD_img1Type("photo")
- + "var url =\"@service{name:'getData'}@&path=\"+encodeURIComponent(path);\r\n"
- */ + "var url =\"<serv.ss name='dlByHttp'/>&path=\"+encodeURIComponent(path);\r\n"
- + "var errorPhoto='${sessionScope['ssUser'].skinDir}image/"
- + inputproperties.get("placeholder") + "';\r\n"
- + "wd.display.previewPicture(url,errorPhoto);\r\n"
- + "});\r\n"
- + "update" + sname + "img();\r\n"
- + "</script>\r\n"
- + "<input name=\"##fieldNamePrefix##fileName\" type=\"hidden\" value=\"${##tableName.##fileName}\">\r\n"
- + "<input class=\"content-button\" id=\"" + sname + "Edit\""
- + " type=\"button\" value=\"上传\"/>\r\n"
- /* 改。Lin
- + "<wd:write name=\""+ sname +"\" type=\"upload\" "
- */ + "<ul.ss name=\"" + sname + "\" "
- + fileType
- /* 改。Lin
- + " value=\"\" callback=\"update"+ sname
- */ + " run=\"update" + sname
- + "img\" width=\"" + f.width
- + "\" height=\"" + f.height
- /* 改。Lin
- + "\"></wd:write>\r\n";
- */ + "\"/>\r\n";
- String d = "<div id=\"##fieldNameValPrefix##fileNameDiv\" " + classStr + " " + styleStr + ">";
- /* 改。Lin
- * 先不改 type="img",用到再弄 -- 见上面的 ObjC.FIELD_img1Type("photo")
- d += "<wd:equal leftValue=\"${empty ##tableName.##fileName}\" rightValue=\"false\">";
- d += "<img src=\"@service{name:'getData',param:{path:'${##tableName.##fileName}'}}@\" id=\"" + snameVal
- + "img\" onerror_=\"this.src='${sessionScope['wd.yh'].pflj}image/" + inputproperties.get("placeholder") + "'\" />";
- d += "</wd:equal>";
- d += "<wd:equal leftValue=\"${empty ##tableName.##fileName}\" rightValue=\"true\">";
- */
- d += "<equal.ss val=\"${empty ##tableName.##fileName}\" val2=\"false\">";
- d += "<img src=\"<serv.ss name='dlByHttp' parm='{path:"${##tableName.##fileName}"}'/>\""
- + " id=\"" + snameVal
- + "img\" onerror_=\"this.src='${sessionScope['ssUser'].skinDir}image/" + inputproperties.get("placeholder") + "'\" />";
- d += "</equal.ss>";
- d += "<equal.ss val=\"${empty ##tableName.##fileName}\" val2=\"true\">";
- d += "<img src=\"${sessionScope['ssUser'].skinDir}image/" + inputproperties.get("placeholder") + "\" id=\"" + snameVal
- + "img\" onerror_=\"this.src='${sessionScope['ssUser'].skinDir}image/" + inputproperties.get("placeholder") + "'\" />";
- /* 改。Lin
- d += "</wd:equal>";
- */ d += "</equal.ss>";
- d += "</div>";
- d += "<script type=\"text/javascript\">\r\n";
- d += "$(\"###fieldNameValPrefix##fileNameDiv\").click(function(){\r\n";
- /* 改。Lin
- * 先不改 type="img",用到再弄 -- 见上面的 ObjC.FIELD_img1Type("photo")
- d += "var url =\"@service{name:'getData',param:{path:'${##tableName.##fileName}'}}@\";\r\n";
- */ d += "var url =\"<serv.ss name='dlByHttp' parm='{path:"${##tableName.##fileName}"}'/>\";\r\n";
- d += "var errorPhoto='${sessionScope['ssUser'].skinDir}image/" + inputproperties.get("placeholder") + "'; \r\n";
- d += "wd.display.previewPicture(url,errorPhoto);\r\n";
- d += " })\r\n";
- d += "</script>\r\n";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix)).replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
- c = c.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix)).replaceAll("##fieldNameValPrefix", Matcher.quoteReplacement(fieldNameValPrefix));
- inputContent = inputContent.replace(temp[0], wdReadonly ? d : c);
- if (isBaseInfo)
- /* 改。Lin
- d="<wd:permission name=\""+fieldname+"\">\r\n"+d+"\r\n</wd:permission>";
- */ d = "<auth.ss field=\""+ fieldname +"\">\r\n"+ d +"\r\n</auth.ss>";
- baseInfoContent = baseInfoContent.replace(temp[0], d);
- filterNames.add(fieldname);
- /* String 改为 int。Lin
- } else if (f.type.equals(ObjC.FIELD_timeType) && f.isDate39) { // Field.TYPE_TIME。春季/秋季入学。Lin
- */
- /* 再改,FIELD_date39Type 再改为转为 FIELD_dateType 了。Lin
- } else if (f.type == ObjC.FIELD_timeType && f.isDate39) {
- */ } else if (f.type == ObjC.FIELD_dateType && f.isDate39) {
- // 入学年度
- // <td><input type="hidden" name="csrq" value="${ry.csrq}"
- // />
- // <input type="text" name="csrq_year"
- // onClick="wd.edit.datePicker({dateFmt:'yyyy'});"/>
- // <input name="csrq_month" type="button" value="春季"
- // wdValue="3"/>
- // <input name="csrq_month" type="button" value="秋季"
- // wdValue="9"/>
- // <script>(function(){wd.edit.onoffInit('radio','csrq_month','',false,null,null,null,'edit');})();</script>
- // <script>
- // (function(){
- // if(!document.querySelector("[name=csrq_year]").value){
- // document.querySelector("[name=csrq_year]").value=new
- // Date().getUTCFullYear();
- // }
- // var
- // hiddenEle=document.querySelector("[name=csrq][type=hidden]");
- // var year=new Date().getUTCFullYear();
- // var month=new Date().getMonth()+1;
- // if(hiddenEle.value){
- // year=parseInt( hiddenEle.value.split("-")[0]);
- // month=parseInt( hiddenEle.value.split("-")[1]);
- // }
- // document.querySelector("[name=csrq_year]").value=year;
- // function rebuildingValue(){
- // var
- // hiddenvalue=document.querySelector("[name=csrq_year]").value+"-"+document.querySelector("[name=csrq_month][type=hidden]").value
- // console.log(hiddenvalue);
- // document.querySelector("[name=csrq][type=hidden]").value=hiddenvalue;
- // }
- // $("[name=csrq_month][type=button]").on("click",rebuildingValue)
- // $("[name=csrq_year][type=text]").on("click",function(){
- // wd.edit.datePicker({dateFmt:'yyyy',ychanged:rebuildingValue});
- // });
- // $("[name=csrq_month][type=button][wdValue="+(month<7?3:9)+"]").trigger("click");
- // })()
- // </script></td>
- /* 再改,IDEA:Can be replaced with single 'Map.putIfAbsent' method call。Lin
- if (inputproperties.get("value") == null)
- inputproperties.put("value", "${empty ##tableName.##fileName ?0:##tableName.##fileName}");
- */ inputproperties.putIfAbsent("value", "${empty ##tableName.##fileName ?0:##tableName.##fileName}");
- String d = "<input type=\"hidden\" name=\"##fieldNamePrefix##fileName\" "
- + getAttributeStr(inputproperties, "value")
- + " " + getAttributeStr(inputproperties, "placeholder")
- + " />\r\n";
- // d += "<input type=\"text\" name=\"##fileName_year\" style=\"width:30px;\" />\r\n";
- // d += "<input name=\"##fileName_month\" type=\"button\" value=\"春季\" wdValue=\"3\"/>\r\n";
- // d += "<input name=\"##fileName_month\" type=\"button\" value=\"秋季\" wdValue=\"9\"/>\r\n";
- // d += "<wd:write type=\"radio\" name=\"##fileName_month\" nullable=\"false\" mode=\"##edit\" value=\"\"/>\r\n";
- // d += "<script>";
- // d += "(function(){\r\n";
- // // d +=
- // // "if(!document.querySelector(\"[name=##fileName_year]\").value){\r\n";
- // // d +=
- // // " document.querySelector(\"[name=##fileName_year]\").value=new Date().getUTCFullYear();\r\n";
- // // d += "}\r\n";
- // d += " var hiddenEle=document.querySelector(\"[name=##fileName][type=hidden]\")\r\n";
- // d += " var year,month;\r\n";
- // d += " if(\"0\"==hiddenEle.value){\r\n";
- // d += " year=new Date().getUTCFullYear();\r\n";
- // d += " month=new Date().getMonth()+1;\r\n";
- // d += " }else if(hiddenEle.value&&hiddenEle.value.split(\"-\").length>0){\r\n";
- // d += " year=parseInt( hiddenEle.value.split(\"-\")[0]);\r\n";
- // d += " month=parseInt( hiddenEle.value.split(\"-\")[1]);\r\n";
- // d += " }\r\n";
- // d += " if(year&&month){\r\n";
- // d += " document.querySelector(\"[name=##fileName_year]\").value=year;\r\n";
- // d += " $(\"[name=##fileName_month][type=button][wdValue=\"+(month<7?3:9)+\"]\").trigger(\"click\");\r\n";
- // d += " }\r\n";
- // d += " \r\n";
- //
- // d += " function ##fileNameRebuildingValue(){\r\n";
- // d += " var yy=document.querySelector(\"[name=##fileName_year]\").value;\r\n";
- // d += " var mm=document.querySelector(\"[name=##fileName_month][type=hidden]\").value;\r\n";
- // d += " var hiddenvalue=\"\";\r\n";
- // d += " if(yy&&mm){hiddenvalue=yy+\"-0\"+mm};\r\n";
- // d += " console.log(hiddenvalue);\r\n";
- // d += " document.querySelector(\"[name=##fileName][type=hidden]\").value=hiddenvalue;\r\n";
- // d += " } \r\n";
- // d += " ##fileNameRebuildingValue();\r\n";
- // d += " $(\"[name=##fileName_month][type=button]\").on(\"click\",##fileNameRebuildingValue)\r\n";
- // d += " $(\"[name=##fileName_year][type=text]\").on(\"click\",function(){\r\n";
- // d += " wd.edit.datePicker({dateFmt:'yyyy',onpicked:##fileNameRebuildingValue,oncleared:##fileNameRebuildingValue});\r\n";
- // d += " });\r\n";
- // d += "})()\r\n";
- // d += "</script>"
- /* 改。Lin
- d+="<wd:write type=\"enrolDate\" name=\"##fieldNamePrefix##fileName\" mode=\"edit\"/>\r\n";
- */ d += "<date39.ss name=\"##fieldNamePrefix##fileName\" mode=\"edit\"/>\r\n";
- // <td wdCombine="true"><input type="hidden" name="csrq"
- // value="${ry.csrq}"/>
- // <script>(function(){
- // var
- // hiddenEle=document.querySelector("[name=csrq][type=hidden]")
- // if(!hiddenEle.value)return;
- // year=parseInt( hiddenEle.value.split("-")[0]);
- // month=parseInt( hiddenEle.value.split("-")[1]);
- // $(hiddenEle).before('<span>'+year+'('+(month<7?'春季':'秋季')+')</span>');
- // })()
- // </script></td>
- String c = "";
- c += "<input type=\"hidden\" name=\"##fieldNamePrefix##fileName\" "
- + getAttributeStr(inputproperties, "value")
- + " " + getAttributeStr(inputproperties, "placeholder")
- + " />\r\n";
- // c += "<script>(function(){\r\n";
- // c += "var hiddenEle=document.querySelector(\"[name=##fileName][type=hidden]\")\r\n";
- // c += " if(!hiddenEle.value)return;\r\n";
- // c += " year=parseInt( hiddenEle.value.split(\"-\")[0]);\r\n";
- // c += " month=parseInt( hiddenEle.value.split(\"-\")[1]);\r\n";
- // c += " $(hiddenEle).before('<span>'+year+'('+(month<7?'春季':'秋季')+')</span>');\r\n";
- // c += "})()\r\n";
- // c += "</script>\r\n"
- /* 改。Lin
- c+="<wd:write type=\"enrolDate\" name=\"##fieldNamePrefix##fileName\" mode=\"play\"/>\r\n";
- */ c += "<date39.ss name=\"##fieldNamePrefix##fileName\" mode=\"play\"/>\r\n";
- // wdEdit=
- // String g = "";
- // g += "<input type=\"hidden\" name=\"##fileName\" "
- // + (inputproperties.get("value") == null ? "value=\"${##tableName.##fileName}\"" : getAttributeStr(inputproperties, "value")) + "/>\r\n";
- // g += "<script>(function(){\r\n";
- // g += "var hiddenEle=document.querySelector(\"[name=##fileName][type=hidden]\")\r\n";
- // g += " if(!hiddenEle.value)return;\r\n";
- // g += " year=parseInt( hiddenEle.value.split(\"-\")[0]);\r\n";
- // g += " month=parseInt( hiddenEle.value.split(\"-\")[1]);\r\n";
- // g += " $(hiddenEle).before('<span>'+year+'('+(month<7?'春季':'秋季')+')</span>');\r\n";
- // g += "})()\r\n";
- // g += "</script>\r\n";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- c = c.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- // g = g.replaceAll("##fileName", f.getName()).replaceAll("##tableName", dxm);
- /* 再改,IDEA:'f.isWdEdit == false' can be simplified to '!f.isWdEdit'。Lin
- String xxx = ((wdReadonly || f.isWdEdit == false) ? c : d);
- */ String xxx = ((wdReadonly || !(f.isWdEdit)) ? c : d);
- inputContent = inputContent.replace(temp[0], xxx.replace("##edit", "edit"));
- // if(isBaseInfo){
- // d="<wd:permission name=\""+fieldname+"\">\r\n"+d+"\r\n</wd:permission>";
- // }
- /* 改。Lin
- c="<wd:permission name=\""+fieldname+"\">\r\n"+c.replace("##edit", "play")+"\r\n</wd:permission>";
- */ c = "<auth.ss field=\"" + fieldname + "\">\r\n"
- + c.replace("##edit", "play") + "\r\n</auth.ss>";
- // System.out.println(c);
- baseInfoContent = baseInfoContent.replace(temp[0], c);
- // today
- filterNames.add(fieldname);
- /* String 改为 int。Lin
- } else if (f.type.equals(ObjC.FIELD_pwdType)) { // Field.TYPE_PASSWORD。Lin
- */ } else if (f.type == ObjC.FIELD_pwdType) {
- /* 此段程序有错,对 inputContent,用的是 =,导致页面前、后的字段都被去掉了 -- 只剩 "密码" 这个字段。Lin
- inputContent = "<input type=\"password\" name=\"" + f.name + "\" "
- + (inputproperties.get("value") == null ? "value=\"${##tableName.##fileName}\"" : getAttributeStr(inputproperties, "value")) + "/>";
- inputContent = inputContent.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm);
- */
- String d = "<input type=\"password\" name=\"" + f.name + "\" "
- + ((inputproperties.get("value") == null) ?
- "value=\"${##tableName.##fileName}\""
- : getAttributeStr(inputproperties, "value"))
- + "/>";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm);
- inputContent = inputContent.replace(temp[0], d);
- baseInfoContent = baseInfoContent.replace(temp[0], "");
- filterNames.add(fieldname);
- /* 再改,不能用 == 去比较 ObjFieldB。Lin
- * 改用 .name,准备去掉 ObjB.idField(ObjFieldB) -- 去掉时再跟着改
- } else if (f == vo.idField && (StringUtils.isBlank(f.cbName))) {
- */
- /* 再改,去掉 .idField(ObjFieldB),直接用新加的 .idName(String)。Lin
- } else if (f.name.equals(vo.idField.name) && (StringUtils.isBlank(f.cbName))) {
- */ } else if (f.name.equals(vo.idName) && (StringUtils.isBlank(f.cbName))) {
- // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- /* 再改为 -- 页面有 value= 时,不替换 value。Lin
- String d = "<input type=\"hidden\" name=\"##fieldNamePrefix##fileName\" value=\"${##tableName.##fileName}\" />";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- */
- String d;
- String valueStr = inputproperties.get("value");
- if (StringUtils.isBlank(valueStr)) {
- d = "<input type=\"hidden\" name=\"##fieldNamePrefix##fileName\" value=\"${##tableName.##fileName}\" />";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- } else {
- d = "<input type=\"hidden\" name=\"##fieldNamePrefix##fileName\" value=\""+ valueStr +"\" />";
- d = d.replaceAll("##fileName", f.name).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- }
- inputContent = inputContent.replace(temp[0], d);
- baseInfoContent = baseInfoContent.replace(temp[0], "");
- filterNames.add(fieldname);
- /* String 改为 int。Lin
- }else if(f.type.equals(ObjC.FIELD_cmsType)){ // Field.TYPE_CMS。Lin
- */ } else if (f.type == ObjC.FIELD_cmsType) {
- if (StringUtils.isBlank(widthStr)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- widthStr = " width=\"100%\" ";
- if (StringUtils.isBlank(widthStr)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- heightStr = " height=\"100%\" ";
- String d = "<input type=\"hidden\" name=\"##fileName\" value=\"${##tableName.##fileName}\" />\r\n";
- d += "<div name='" + sname + "Edit' " + widthStr + " " + heightStr + "></div>\r\n";
- /* 改。Lin
- d+="<wd:write type=\"CMS\" name=\""+sname+"\" jlztm=\"${##tableName.jlztm}\"/>";
- */ d += "<cms.ss name=\"" + sname + "\" rowStat=\"${##tableName.jlztm}\"/>";
- String dd = "<input type=\"hidden\" name=\"##fileName\" value=\"${##tableName.##fileName}\" />\r\n";
- dd += "<div name='" + sname + "Play' " + widthStr + " " + heightStr + "></div>\r\n";
- /* 改。Lin
- dd+="<wd:write type=\"CMS\" name=\""+sname+"\" jlztm=\"${##tableName.jlztm}\"/>";
- */ dd += "<cms.ss name=\"" + sname + "\" rowStat=\"${##tableName.jlztm}\"/>";
- d = d.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- dd = dd.replaceAll("##fileName", f.name).replaceAll("##tableName", dxm).replaceAll("##fieldNamePrefix", Matcher.quoteReplacement(fieldNamePrefix));
- inputContent = inputContent.replace(temp[0], wdReadonly ? dd : d);
- baseInfoContent = baseInfoContent.replace(temp[0], dd);
- filterNames.add(fieldname);
- // } else { // 再去掉,空 else 程序块 -- 按 IDEA 规范。Lin
- }
- } // if (f != null)。去掉 if (f == null) 空程序块 -- 按 IDEA 规范。Lin
- }
- {
- for (Entry<String, List<String[]>> entry : onoffbutton_inputs.entrySet()) { // onoffbutton_inputs 不含 <input name="sfpm" ssRun= />。Lin
- List<String[]> inputs = entry.getValue();
- boolean isRadio = false;
- boolean nullable = true;
- /* 去掉,没用到。Lin
- boolean checked = false;
- */
- String elValue = "${"+ dxm +"."+ entry.getKey() +"}";
- String wdCallback = null;
- for (int i = 0; i < inputs.size(); i ++) {
- String[] temp = inputs.get(i);
- Map<String, String> m = inputElementProperties_input(temp[0]);
- String wdRadioStr = m.get("ssRad"); // ("wdRadio")。Lin
- if (StringUtils.isBlank(wdRadioStr)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- wdRadioStr = m.get("wdCheckbox");
- if (StringUtils.isNotBlank(m.get("ssRun"))) // ("wdCallback")))。Lin
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- wdCallback = m.get("ssRun"); // ("wdCallback")。Lin
- /* 不加左、右的 "{"、"}"。Lin
- * 待确认源头在哪 -- 在源头加 -- 页面 <input ssRad="{val:1,checked:true}"
- JsonElement btnObj = JsonParser.parseString("{"+ wdRadioStr +"}");
- */ JsonElement btnObj = JsonParser.parseString(wdRadioStr);
- String value = m.get("value"); // 这里的不能改为 "val",是 <input value=。Lin
- String wdValueStr = btnObj.getAsJsonObject().get("val") != null? // ("value")。Lin
- /* 再改,IDEA:'\'' is unnecessarily escaped。Lin
- btnObj.getAsJsonObject().get("value").toString().replaceAll("[\"\']", "")
- */
- /* 再改,在页面表述时去掉 ''/"" 了 -- ssRad="val:1,checked:true"。Lin
- * 再,仍保留 .replaceAll( -- 容错
- btnObj.getAsJsonObject().get("value").toString().replaceAll("[\"']", "")
- */ btnObj.getAsJsonObject().get("val").getAsString().replaceAll("[\"']", "")
- : null;
- if (i == 0) {
- isRadio = StringUtils.isNotBlank(m.get("ssRad")); // ("wdRadio"))。Lin
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- String nullableStr = btnObj.getAsJsonObject().get("null") != null? // ("nullable") !=。Lin
- btnObj.getAsJsonObject().get("null").getAsString() // ("nullable").。Lin
- : null;
- if (StringUtils.isNotBlank(nullableStr))
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- nullable = "true".equals(nullableStr);
- /* 去掉,checked 没用到。Lin
- * 因为 checked 没用到,checkedStr 也没用到
- String checkedStr = btnObj.getAsJsonObject().get("checked") != null?
- btnObj.getAsJsonObject().get("checked").getAsString().toString()
- : null;
- if (StrUtil.notNull(checkedStr))
- checked = "true".equals(checkedStr);
- */
- }
- String inputStr = "<input type=\"button\" name=\""+ fieldNamePrefix+ m.get("name")
- +"\" value=\""+ value
- +"\" ssVal=\""+ wdValueStr +"\"/>\r\n"; // +"\" wdValue=\""+。Lin
- if (i == inputs.size() -1) {
- /* 改。Lin
- * 再改,<onoff.ss radio= 改为 rad=
- inputStr += "<wd:write type=\"" + (isRadio? "radio" : "checkbox")
- + "\" name=\""+ fieldNamePrefix + m.get("name") +"\" "
- + ((StringUtils.isNotBlank(wdCallback))? ("callback=\""+ wdCallback +"\"") : "")
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- + " value=\""+ elValue
- + "\" nullable=\""+ (nullable? "true" : "false")
- + "\" mode=\"##edit\" />\r\n";
- */ inputStr += "<onoff.ss rad=\""+ (isRadio? "true" : "false")
- + "\" name=\""+ fieldNamePrefix + m.get("name") +"\" "
- + ((StringUtils.isNotBlank(wdCallback))? ("run=\""+ wdCallback +"\"") : "")
- + " val=\""+ elValue
- + "\" null=\""+ (nullable? "true" : "false")
- + "\" mode=\"##edit\" />\r\n";
- if (isBaseInfo) {
- /* 改。Lin
- inputStr+="\r\n</wd:permission>";
- */ inputStr += "\r\n</auth.ss>";
- }
- }
-
- if (i == 0 && isBaseInfo) {
- /* 改。Lin
- inputStr="<wd:permission name=\""+m.get("name")+"\">\r\n"+inputStr;
- */ inputStr = "<auth.ss field=\""+ m.get("name") +"\">\r\n"+ inputStr;
- }
- inputContent = inputContent.replace(temp[0], inputStr.replace("##edit", "edit"));
- baseInfoContent = baseInfoContent.replace(temp[0], inputStr.replace("##edit", "play"));
- }
- }
- }
- {// 自动添加校验标签
- /* 改。Lin
- String[] validations = findLabelName(baseInfoContent, "wd:validation", "name");
- */
- /* 再改。Lin
- * "." 需要被转义 -- StrWeb.findLabelName( 里,嵌到正则表达式里了
- String[] validations = StrWeb.findLabelName(baseInfoContent, "wd:validation", "name");
- */ String[] validations = StrWeb.findLabelName(baseInfoContent, "ichk\\.ss", "name");
-
- if (validations != null)
- baseInfoContent = baseInfoContent.replace(validations[0], "");
- // validations = findLabelName(inputContent, "wd:validation", "name"); // 去掉,没用到。Lin
- // 改为无论是否校验配置文件存在,都发布校验自定义标签到页面
- // Map<String, ValidationInfo> vmap = webapp
- // .getNameKeyValidationMap();
- // if (validations==null&&vmap != null&&
- // vmap.get(pageobj.getTempcode().getName()) != null) {
- /* 去掉 Tempcode。Lin
- String t = "\r\n" + "<wd:validation name=\"" + pageobj.getTempcode().getName() + "\" />\r\n";
- */
- /* 再改。Lin
- String t = "\r\n"+ "<wd:validation name=\"" + pageobj.name +"\" />\r\n";
- */ String t = "\r\n"+ "<ichk.ss name=\""+ pageobj.name +"\" />\r\n";
- /* 再改为 IDEA 规范。Lin
- * Redundant character escape '\\<' in RegExp
- * Redundant character escape '\\/' in RegExp
- * Redundant character escape '\\>' in RegExp
- String reg = "\\<\\/(body|BODY)\\s*?\\>";
- */ String reg = "</(body|BODY)\\s*?>";
- Pattern pattern = Pattern.compile(reg);
- Matcher matcher = pattern.matcher(inputContent);
- if (matcher.find()) {// 追加到body
- inputContent = inputContent.replaceFirst(reg, Matcher.quoteReplacement(t + matcher.group()));
- } else {
- inputContent += t;
- }
- // }
- }
- // request设置一个标记,之后的的服务,标记为强制校验
- /* 再改,IDEA:'captchaField.size() > 0' can be replaced with '!captchaField.isEmpty()'。Lin
- if (!isInfo && captchaField.size() > 0) {
- */ if (!isInfo && !(captchaField.isEmpty())) {
- /* 去掉 Tempcode。Lin
- if (pageobj.getTempcode().getName().contains("_input")
- && pageobj.getTempcode().getName().endsWith("_public")) {
- */ if ((pageobj.name).contains(PageC.PAGE_inpSfx)
- && (pageobj.name).endsWith(PageC.PAGE_pubEnd)) { // 先保留,没有存在 "_public" 结尾的 JSP 文件。Lin
- inputContent = "\r\n<% request.setAttribute(\""+ ss.WebC.REQ_captcha +"\",\""+ captchaField.size() +"\"); %>\r\n"
- + inputContent;
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String t = "";
- t += "<script>\r\n";
- */ StringBuilder t = new StringBuilder("<script>\r\n");
- for (ObjFieldB ff : captchaField) {
- /* 去掉 Field.captchaLength,改为 .hasCaptcha。Lin
- * 验证码位数,统一由 SsConst.CAPTCHA_NUM 控制
- t += "wd.display.inputCaptcha(\"" + ff.getName() + "\",\"" + ff.getCaptchaLength() + "\");\r\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- t += "wd.display.inputCaptcha(\""+ ff.name +"\",\""+ SsC.CAPTCHA_pcLen + "\");\r\n";
- */ t.append("wd.display.inputCaptcha(\"").append(ff.name).append("\",\"")
- .append(SsC.CAPTCHA_pcLen).append("\");\r\n");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- t += "</script>\r\n";
- */ t.append("</script>\r\n");
- /* 再改为 IDEA 规范。Lin
- * Redundant character escape '\\<' in RegExp
- * Redundant character escape '\\/' in RegExp
- * Redundant character escape '\\>' in RegExp
- String reg = "\\<\\/(body|BODY)\\s*?\\>";
- */ String reg = "</(body|BODY)\\s*?>";
- Pattern pattern = Pattern.compile(reg);
- Matcher matcher = pattern.matcher(inputContent);
- if (matcher.find()) {// 追加到body
- inputContent = inputContent.replaceFirst(reg, Matcher.quoteReplacement(t + matcher.group()));
- } else {
- inputContent += t;
- }
- }
- }
-
- // { // 再去掉,没必要。Lin
- /* 再改,IDEA:'defaultValueField.size()>0' can be replaced with '!defaultValueField.isEmpty()'。Lin
- if(!isBaseInfo && !isInfo && defaultValueField.size()>0){
- */ if(!isBaseInfo && !isInfo && !(defaultValueField.isEmpty())){
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String t = "";
- t += "<script>\r\n";
- t+="$(function(){\r\n";
- */ StringBuilder t = new StringBuilder("<script>\r\n$(function(){\r\n");
- for (ObjFieldB ff : defaultValueField) {
- /* 去掉 Field.defaultValue(含名和参数),改用 dictName + dictParm。Lin
- * 仍然拼回 "字典名[参数]" 串
- t += "wd.display.inputDefaultValue('" + ff.getName() + "','" + ff.getDefaultValue() + "');\r\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- t += "wd.display.inputDefaultValue('"+ ff.name +"','"+ ff.dictName
- /// * 再,.dictParmMap 改为 .dictParmStr -- 页面要拼回 "xq[rxnd]"。Lin
- // + "["+ StringUtils.join((ff.dictParmMap).values().toArray(), ',') +"]"
- // 去掉 StrU.join(),直接用 StringUtils.join()
- /// *
- + "["+ ff.dictParmStr +"]"
- + "');\r\n";
- */ t.append("wd.display.inputDefaultValue('").append(ff.name).append("','").append(ff.dictName)
- .append("[").append(ff.dictParmStr).append("]');\r\n");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- t+= "})\r\n";
- t += "</script>\r\n";
- */ t.append("})\r\n</script>\r\n");
- inputContent += t;
- }
- // } // 再去掉,没必要。Lin
-
- // { // 再去掉,没意义。Lin
- if(!inputContent.toLowerCase().contains("</body>")&&!inputContent.toLowerCase().contains("</html>"))
- inputContent += PageCompC.ADD_REMOVE_TOKEN_SCRIPT;
- // } // 再去掉,没意义。Lin
- /* 去掉 appName,直接用 PrjApp.prjName。Lin
- * 移到 PageCompU
- reader = new StringReader(transformCommonwrite(isInfo ? baseInfoContent : inputContent, appName, ymid, wzid, gdba));
- */
- reader = new StringReader(PageCompU.compTag(isInfo? baseInfoContent : inputContent));
- }
- // #######################################################################
- // 添加objectpicker下拉
- BufferedReader in = new BufferedReader(reader);
- StringBuffer sb = new StringBuffer();
- // String s = ""; // 再去掉,移到下面用到的地方。IDEA -- Variable 's' initializer '""' is redundant。Lin
- /* 去掉,改用 TagComper.transform(str),没改盖过。Lin
- ObjPickerTagComper obectPickerTransformer = new ObjPickerTagComper();
- TxtTagComper textTransformer = new TxtTagComper();
- GrowhTagComper growHeightTransformer = new GrowhTagComper();
- OnoffTagComper onoffbuttonTransform = new OnoffTagComper();
- OptTagComper wdoptionTransform = new OptTagComper();
- */
- /// 改为新UI,增加。Lin
- boolean ccpIsNewUI = true;//如果为真,切换级联菜单是新UI
- ///
- try {
- List<String[]> allInputTab = new LinkedList<>();
- Map<String, List<String[]>> allonoffbutton = new HashMap<>();
- List<String[]> allObjectPicker = new LinkedList<>();
- // 所有页面级联
- // List<String[]> allcascadingTagExist = new LinkedList();//
- List<String[]> allcascadingSelect_input = new LinkedList<>();//
- List<String> allcascadingInputNames = new LinkedList<>();//
- List<String> notHandleCascadingInputNames = new LinkedList<>();//
- Map<String, CcpB> allcascadingInputNamesObject = new HashMap<>();//
- /// 增加,保存 prfx -- 支持共用 ccp 定义。Lin
- Map<String, String> cascadingPrfx = new HashMap<>();
- ///
- Map<String, String> namesValue = new HashMap<>();//
- // Map<String, String> cascadingTagNew = new HashMap();//级联标签
- Map<String, Map<String, String>> cascadingTagNewAttribute = new HashMap<>();//级联标签属性
- String s; // 再,从上面移到这。Lin
- while ((s = in.readLine()) != null) {
- // input
- String[] inputTab = StrWeb.findLabelName(s, "input", null);
-
- // objectpicker
- /* 去掉 TagTransformerAdapter.prefix,统一用 PageConst.HTML_TAG_PREFIX。Lin
- String[] existObjectPicker = findLabelName(s,
- obectPickerTransformer.prefix +":"+ obectPickerTransformer.getTagType(), null);
- */
- /* 改。Lin
- * "." 需要被转义 -- StrWeb.findLabelName( 里,嵌到正则表达式里了
- String[] existObjectPicker = StrWeb.findLabelName(s, "cw:op", null);
- */ String[] existObjectPicker = StrWeb.findLabelName(s, "objp\\.ss", null);
- // cascading
- /* 改。Lin
- * "." 需要被转义 -- StrWeb.findLabelName( 里,嵌到正则表达式里了
- String[] existcascadingSelect = StrWeb.findLabelName(s, "wd:cascadingSelect", "name");
- */ String[] existcascadingSelect = StrWeb.findLabelName(s, "ccp\\.ss", "name");
- if (inputTab != null){
- allInputTab.add(inputTab);
- Map<String, String> m = inputElementProperties_input(inputTab[0]);
- if (StringUtils.isNotBlank(m.get("value"))) // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- namesValue.put(inputTab[1], m.get("value"));
- boolean wdReadonly="true".equals(m.get("wdReadonly"));
- String wdCascadingSelect = m.get("ssCcp"); // ("wdCascadingSelect")。Lin
- if (StringUtils.isNotBlank(wdCascadingSelect)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- try {
- // name:’ cxlbjl’, filter:{cslbdl:’0000’}
- /* 不加左、右的 "{"、"}"。Lin
- * 待确认源头在哪 -- 在源头加
- JsonObject json = JsonParser.parseString("{"+ wdCascadingSelect +"}").getAsJsonObject();
- */
- /* 再改,<input ssCcp= 增加支持多个 Ccp,支持简写。Lin
- * 简写: "dw_nj"/"dw_nj,dw_bzr"
- * 单个 Json: '{name:"dq",prfx:"hk"}'/"{name:'yw_dx@pwj',filter:'{pxmid:"${pxmid}"}'}"
- * 多个 Json: "['xxx','yyy']"/'[{},{}]'
- JsonObject json = JsonParser.parseString(wdCascadingSelect).getAsJsonObject();
- */
- ///// Start。Lin
- JsonArray ccpJa = new JsonArray();
- if (wdCascadingSelect.matches(".*\\[.*].*")) { // 增加支持多个 Ccp。Lin
- JsonArray ja = JsonParser.parseString(wdCascadingSelect).getAsJsonArray();
- for (JsonElement je : ja) {
- if (je.isJsonPrimitive()) { // "['xxx','yyy']"。Lin
- JsonObject jo = new JsonObject();
- jo.addProperty("name", je.getAsString());
- ccpJa.add(jo);
- } else { // '[{},{}]'。Lin
- ccpJa.add(je);
- }
- }
- } else if (wdCascadingSelect.matches(".*\\{.*\\}.*")) { // 单个 Json。Lin
- JsonObject jo = JsonParser.parseString(wdCascadingSelect).getAsJsonObject();
- ccpJa.add(jo);
- } else { // 简写 "dw_nj"/"dw_nj,dw_bzr"。Lin
- String[] list = wdCascadingSelect.split(",");
- for (String f : list) {
- JsonObject jo = new JsonObject();
- jo.addProperty("name", f.trim());
- ccpJa.add(jo);
- }
- }
- for (JsonElement je : ccpJa) {
- JsonObject json = je.getAsJsonObject();
- ///// End。Lin
- String cascadingname = json.get("name").getAsString();
- /* .toString() 改为 .getAsString(),不然会多出左、右的 ""。如 ""xxx""。Lin
- String cascadingfilter = json.has("filter")? json.get("filter").toString() : null;
- */
- /* 改为新UI。Lin
- * 再改回,大叶 写的 if-else 分支没有不同
- * String cascadingfilter = null;
- * if(ccpIsNewUI) {
- * cascadingfilter = json.has("filter") ? json.get("filter").toString() : null;
- * }else{
- * cascadingfilter = json.has("filter") ? json.get("filter").getAsString() : null;
- * }
- */
- /* 再改,.getAsString( 只有 filter 值为一个字符串才适用,但现在规范后 filter 值是一个 json 对象而不是字符串。Ben(20251208)
- String cascadingfilter = json.has("filter")? json.get("filter").getAsString() : null;
- */ String cascadingfilter = json.has("filter")? json.get("filter").toString() : null;
- /// 增加,支持共用 ccp 定义。如 负责部门 > 负责人员、联系部门 > 联系人员,共用 部门 > 人员。Lin
- String prfx = json.has("prfx")? json.get("prfx").getAsString() : "";
- ///
- /* 去掉 appName,直接用 PrjApp.。Lin
- CascadingSelectObject mm = webapp.getCascadingSelectObject().get(cascadingname);
- */ CcpB mm = prjApp.ccpMap.get(cascadingname); // = PrjApp.。再,支持对象名。Lin
- if (mm != null) { // (mm != null)。Lin
- /* 再,不用 Clone -- 浅克隆没用,深克隆麻烦。Lin
- /// 增加,支持共用 ccp 定义。Lin
- CcpB mm = mmOri.clone();
- mm.combField.name = prfx + mm.combField.name;
- for(CcpFieldB input : mm.combField.fieldList){
- input.name = prfx + input.name;
- }
- ///
- */
- /* <inputs > 支持多个了。Lin
- * 增加了可以直接写单个 Field, <field />(<sglField />) -- 可以没有 <combField >
- if(StringUtil.notNull(mm.getInputs().getName())){
- allcascadingInputNames.add(mm.getInputs().getName());
- allcascadingInputNamesObject.put(mm.getInputs().getName(), mm);
- }
- for(Input input: mm.getInputs().getInputList()){
- allcascadingInputNames.add(input.getName());
- allcascadingInputNamesObject.put(input.getName(), mm);
- }
- */
- /* 暂时只支持有且只有一个 <combField >。Lin
- * 暂时不支持单个Field <field />
- for(CascaderCombFieldB inputs : mm.combFieldMap.values()){
- allcascadingInputNames.add(inputs.name);
- allcascadingInputNamesObject.put(inputs.name, mm);
- for(CascaderFieldB input : inputs.fieldMap.values()){
- allcascadingInputNames.add(input.name);
- allcascadingInputNamesObject.put(input.name, mm);
- }
- }
- for(CascaderSglFieldB sglField : mm.sglFieldMap.values()){ // 单个 Field。Lin
- allcascadingInputNames.add(sglField.name);
- allcascadingInputNamesObject.put(sglField.name, mm);
- }
- */
- /* 再, 增加支持共用 ccp 定义。Lin
- if (StringUtils.isNotBlank(mm.combField.name)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- allcascadingInputNames.add(mm.combField.name);
- allcascadingInputNamesObject.put(mm.combField.name, mm);
- }
- for(CcpFieldB input: mm.combField.fieldList){
- allcascadingInputNames.add(input.name);
- allcascadingInputNamesObject.put(input.name, mm);
- }
- */
- if (StringUtils.isNotBlank(mm.combField.name)) {
- allcascadingInputNames.add(prfx + mm.combField.name);
- allcascadingInputNamesObject.put(prfx + mm.combField.name, mm);
- cascadingPrfx.put(prfx + mm.combField.name, prfx);
- }
- for (CcpFieldB input : mm.combField.fieldList) {
- allcascadingInputNames.add(prfx + input.name);
- allcascadingInputNamesObject.put(prfx + input.name, mm);
- cascadingPrfx.put(prfx +input.name, prfx);
- }
- // int si = mm.getInputs().getInputList().size() - 1;
- // String lastInputName = mm.getInputs().getInputList().get(si).getName();
- // String filterStr = StringUtil.notNull(cascadingfilter) ? ("filter=\"" + cascadingfilter + "\"") : "";
- Map<String, String> map = new HashMap<>();
- map.put("name", cascadingname); // 这里不用加 prfx -- 增加支持共用 ccp 定义。Lin
- if (cascadingfilter != null)
- map.put("filter", cascadingfilter);
- map.put("mode", (wdReadonly||isInfo)?"play":"edit");
- /// 保存 prfx,增加 <ss:ccp prfx= 属性 -- 增加支持共用 ccp 定义。Lin
- map.put("prfx", prfx);
- ///
- /* 再增加,支持共用 ccp 定义。Lin
- cascadingTagNewAttribute.put(cascadingname, map);
- */ cascadingTagNewAttribute.put(prfx + cascadingname, map);
- // cascadingTagNew.put(lastInputName,cascadingname);
- }
- /// 再增加,<input ssCcp= 增加支持多个 Ccp,支持简写。Lin
- } // for (JsonElement je : ccpJa) {
- ///
- } catch (Exception e) {
- /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- e.printStackTrace();
- */ log4j.error("PageComper.addViewObjectTools( 异常", e);
- SsLog.print("ssCcp= 不是 Json:"+ wdCascadingSelect);
- }
- // allInputTab.add(inputTab);
- }
- }
- if (existObjectPicker != null)
- allObjectPicker.add(existObjectPicker);
- if (existcascadingSelect != null) {
- // allcascadingTagExist.add(existcascadingSelect);
- /* 去掉 appName,直接用 PrjApp.。Lin
- CascadingSelectObject mm =webapp.getCascadingSelectObject().get(existcascadingSelect[1]);
- */ CcpB mm = prjApp.ccpMap.get(existcascadingSelect[1]); // = PrjApp.。再,支持多线程。Lin
- if (mm != null) {
- ///// 下面需要扩展支持共用 ccp 定义 -- 增加 <ccp@ss prfx=???Lin
- // 用到再弄
- /////
- /* <inputs > 支持多个了。Lin
- * 增加了可以直接写单个 Field, <field />(<sglField />) -- 可以没有 <combField >
- if(StringUtil.notNull(mm.getInputs().getName())){
- notHandleCascadingInputNames.add(mm.getInputs().getName());
- allcascadingInputNames.add(mm.getInputs().getName());
- allcascadingInputNamesObject.put(mm.getInputs().getName(), mm);
- }
- for(Input input: mm.getInputs().getInputList()){
- notHandleCascadingInputNames.add(input.getName());
- allcascadingInputNames.add(input.getName());
- allcascadingInputNamesObject.put(input.getName(), mm);
- }
- */
- /* 暂时只支持有且只有一个 <combField >。Lin
- * 暂时不支持单个Field <field />
- for(CascaderCombFieldB inputs : mm.combFieldMap.values()){
- notHandleCascadingInputNames.add(inputs.name);
- allcascadingInputNames.add(inputs.name);
- allcascadingInputNamesObject.put(inputs.name, mm);
- for(CascaderFieldB input : inputs.fieldMap.values()){
- notHandleCascadingInputNames.add(input.name);
- allcascadingInputNames.add(input.name);
- allcascadingInputNamesObject.put(input.name, mm);
- }
- }
- for(CascaderSglFieldB sglField : mm.sglFieldMap.values()){ // 单个 Field。Lin
- notHandleCascadingInputNames.add(sglField.name);
- allcascadingInputNames.add(sglField.name);
- allcascadingInputNamesObject.put(sglField.name, mm);
- }
- */
- if (StringUtils.isNotBlank(mm.combField.name)) {
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- notHandleCascadingInputNames.add(mm.combField.name);
- allcascadingInputNames.add(mm.combField.name);
- allcascadingInputNamesObject.put(mm.combField.name, mm);
- }
- for(CcpFieldB input: mm.combField.fieldList){
- notHandleCascadingInputNames.add(input.name);
- allcascadingInputNames.add(input.name);
- allcascadingInputNamesObject.put(input.name, mm);
- }
- }
- }
- /* 再改,IDEA:String concatenation as argument to 'StringBuffer.append()' call。Lin
- sb.append(s + "\r\n");
- */ sb.append(s).append("\r\n");
- }
-
- List<String[]> removeList = new LinkedList<>();
- Set<String> repeatName = new HashSet<>();
- Set<String> repeatName_ = new HashSet<>();
- for (String[] temp : allInputTab) {
- String name = temp[1];
-
- boolean isRemove = false;
- if (repeatName_.contains(name)) {
- repeatName.add(name);
- }
- repeatName_.add(name);
- for (String[] temp1 : allObjectPicker) {
- if (temp1[1].equals(name) || (temp1[1] + "id").equals(name) || (temp1[1] + "m").equals(name)) {
- isRemove = true;
- break;
- }
- // input=true隐藏字段可能会加id,m
- }
- //noinspection SuspiciousIndentAfterControlStatement
- if(!isRemove)
- try {
- // for (String[] temp1 : allcascadingTagExist) {
- // if (temp1[1].equals(name)) {
- // isRemove = true;
- // break;
- // }
- //
- // CascadingSelectObject m =webapp.getCascadingSelectObject().get(temp1[1]);
- // if (m != null && m.getPrimaryNam().contains(name)) {
- // isRemove = true;
- // break;
- // }
- // }
- if(allcascadingInputNames.contains(name))
- isRemove = true;
-
- if (isRemove)
- allcascadingSelect_input.add(temp);
- } catch (Exception e) {
- /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- e.printStackTrace();
- */ log4j.error("PageComper.addViewObjectTools( 异常", e);
- }
- // xxx_1,xxx2为onoffbutton,放到指定集合
- // <input name="sfpm_1"/>、<input name="sfpm_0"/>。Lin
- /* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
- if (name.matches(".*?\\_[0-9yesno]+$")) {
- */ if (name.matches(".*?_[0-9yesno]+$")) {
- // String fName = name.split("\\_")[0];
- /* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
- String fName = name.replaceAll("\\_[0-9yesno]+$", "");
- */ String fName = name.replaceAll("_[0-9yesno]+$", "");
- /* 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
- if (allonoffbutton.get(fName) == null)
- allonoffbutton.put(fName, new LinkedList<>());
- */ allonoffbutton.computeIfAbsent(fName, k -> new LinkedList<>());
- allonoffbutton.get(fName).add(temp);
- isRemove = true;
- }
- /// 增加,支持 <input name="sfpm"/> -- 像普通字段一样写。Lin
- else {
- ObjFieldB field = vo.fieldMap.get(name);
- if (field != null && field.type == ObjC.FIELD_boolType) {
- /* 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
- if (allonoffbutton.get(name) == null)
- allonoffbutton.put(name, new LinkedList<>());
- */ allonoffbutton.computeIfAbsent(name, k -> new LinkedList<>());
- allonoffbutton.get(name).add(temp);
- isRemove = true;
- }
- }
- ///
- if (isRemove)
- removeList.add(temp);
- }
- for (String[] temp : allInputTab) {
- if (repeatName.contains(temp[1]))
- removeList.add(temp);
- }
- for (String[] temp1 : removeList) {
- allInputTab.remove(temp1);
- }
- // String tabProgram = ""; // 再去掉,移到下面用到的地方。Lin
- // 判断是否查看部件
- if (isInfo) { //???看 allInputTab、allcascadingSelect_input
- /* 再去掉,按 IDEA 规范 -- Variable is already assigned to this value。Lin
- isInfo = true;
- */
- /* 没有 WD 了,与应用放到一起。Lin
- * 去掉 appName,直接用 PrjApp.
- String foldA = WD.webRoot() + "/main/sheji/object/baseInfo/init.jsp";
- String foldB = WD.webRoot() + "/main/sheji/object/baseInfo/" + appName + "/source.jsp";
- */
- /* 再,不复制,直接用 init.jsp。Lin
- String foldA = AppB.webRoot +"main/sheji/object/baseInfo/init.jsp";
- String foldB = AppB.webRoot +"main/sheji/object/baseInfo/"+ PrjApp.prjName +"/source.jsp";
- if (new File(foldA).exists()) {
- if (new File(foldB).exists() == false) {
- new File(foldB).getParentFile().mkdirs();
- FileU.copyFile(foldA, foldB);
- }
- StringBuffer newsb = new StringBuffer();
- String sourceContent = FileU.rdStr(foldB);
- */
- /* 改为新UI。Lin
- * 与 新UI 的 header.jsp 放在一起
- String foldA = AppB.webRoot +"pms/clip/baseInfo.jsp"; // = AppB.appRoot +。仅出现在 PMS 项目里。Lin
- */ String foldA = AppB.webRoot +"page/clip/baseInfo.jsp"; // = AppB.appRoot +。仅出现在 PMS 项目里。Lin
- if (new File(foldA).exists()) {
- StringBuffer newsb = new StringBuffer();
- String sourceContent = FileU.rdStr(foldA);
- /* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
- Pattern p = Pattern.compile("#include\\_baseInfo");
- */ Pattern p = Pattern.compile("#include_baseInfo");
- Matcher m = p.matcher(sourceContent);
- while (m.find()) {
- m.appendReplacement(newsb, Matcher.quoteReplacement(sb.toString()));
- }
- m.appendTail(newsb);
- sb = newsb;
- }
- // input部件
- }
- // else if (bjdm.toLowerCase().matches(vo.getName() + "_.*input")) {
- //
- // } else {
- // // return new StringReader(sb.toString());
- // }
- String content = sb.toString();
- /* 再改为 IDEA 规范。Lin
- * Variable 'tabProgram' initializer '""' is redundant
- * String concatenation '+=' in loop
- String tabProgram = ""; // 再,从上面移到这。Lin
- */ StringBuilder tabProgram; // 再,从上面移到这。Lin
- // BaseBean bean = (BaseBean) Class.forName(vo.getObjClass())
- // .newInstance();
- // 处理单个input类型 wd:translate, objectpicker
- for (String[] temp : allInputTab) {
- String name = temp[1];
- ObjFieldB field = vo.fieldMap.get(name);
- if (field == null)
- continue;
- String value = "${"+ dxm +"."+ field.name +"}";
- Map<String, String> wdWriteproperties = inputElementProperties_WdWrite(temp[0]);
- Map<String, String> inputproperties = inputElementProperties_input(temp[0]);
- boolean wdReadonly="true".equals(inputproperties.get("wdReadonly")); // 用到再弄???Lin
- if (inputproperties.get("ssBtn") != null) { // ("wdButton")
- inputproperties.put("button", inputproperties.get("ssBtn")); // ("wdButton"))。Lin
- }
- // 忽略input type=button/hidden
- // if("button".equals(inputproperties.get("type")))continue;
- if (StringUtils.isNotBlank(inputproperties.get("type"))
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- && !"text".equals(inputproperties.get("type"))) {
- if (filterNames.contains(name))
- continue;
- if (Arrays.asList(ObjC.FIELD_cmsType, ObjC.FIELD_htmlType).contains(field.type))
- // Field.TYPE_CMS, Field.TYPE_HTML。Lin
- continue;
- /* 改。Lin
- if (!"hidden".equals(inputproperties.get("type")))
- continue;
- */
- if ("hidden".equals(inputproperties.get("type"))) {
- //加上对隐藏字段新UI的发布处理 Ben(20260413)
- //录入页,用新UI
- if(pageobj.isInp) {
- String oneLine = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_hiden, //组件类弄
- inputproperties,//组件属性
- vo,
- field.getName()
- );
- content = content.replace(temp[0], oneLine);
- }
- continue;
- }
- /* 下面代码,是对象配置中type="picture"的隐藏字段,替换一下,作发布准备的
- 但是现在对象配置只用"photo",已经取消"picture",所以下面对##这些变量replace一下这个代码已经没用
- 所以注释掉 Ben(20260413)
- if (inputproperties.get("value")!=null)
- value=inputproperties.get("value");
- String c = "";
- c += "<input "+getAttributeStr(inputproperties, "id")+
- " name=\"##fieldNamePrefix##fileName\" type=\"hidden\" value=\""+value+"\">\r\n";
- c = c.replaceAll("##fileName", field.name)
- .replaceAll("##tableName", dxm)
- .replaceAll("##fieldNamePrefix",Matcher.quoteReplacement(fieldNamePrefix))
- .replaceAll("##fieldNameValPrefix",Matcher.quoteReplacement(fieldNameValPrefix));
- content =content.replace(temp[0],(wdReadonly||isInfo)?"": c);
- */
- continue;
- }
-
- if (wdWriteproperties.get("format") == null &&
- /* String 改为 int。Lin
- field.type.equals(ObjC.FIELD_timeType)) { // Field.TYPE_TIME。Lin
- */
- /* 再改,保留 FIELD_dateType 了 -- 不转为 FIELD_timeType 了。Lin
- field.type == ObjC.FIELD_timeType) {
- */ (field.type == ObjC.FIELD_dateType || field.type == ObjC.FIELD_timeType)) {
- wdWriteproperties.put("miniDate", "false");
- /* 改,去掉 Display(<field display= >) 了,用 <field format= >。Lin
- wdWriteproperties.put("format", field.getDisplay().getFormat());
- */ wdWriteproperties.put("format", field.fmt);
- }
- if (wdReadonly || isInfo) {// 查看部件
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram = "\r\n<%--自动生成:"+ dxm +"."+ name +"--%>";
- */ tabProgram = new StringBuilder("\r\n<%--自动生成:"+ dxm +"."+ name +"--%>");
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String writeStr = "";
- */ StringBuilder writeStr = new StringBuilder();
- // if(inputproperties.get("size")!=null)wdWriteproperties.put("length",
- // inputproperties.get("size"));
- /* 再改,IDEA:Can be replaced with single 'Map.putIfAbsent' method call。Lin
- if (wdWriteproperties.get("value") == null)
- wdWriteproperties.put("value", value);
- */ wdWriteproperties.putIfAbsent("value", value);
- //
- // if (false && inputproperties.get("width") != null) {
- // inputproperties.put("style",
- // "width:" + inputproperties.get("width"));
- // inputproperties.remove("width");
- // }
- // 翻译codebook
- /* 去掉 _view.jsp 了。Lin
- if (isViewJsp) {
- // if(inputproperties.get("size")!=null){
- // tabProgram+=TextTag.trimText(demoText,
- // Integer.parseInt(inputproperties.get("size")));
- // }else{
- if (inputproperties.get("style") != null || inputproperties.get("width") != null)
- writeStr += getDemoText();
- // }
- } else */
- /* String 改为 int。Lin
- if (field.type.equals(ObjC.FIELD_boolType)) { // "boolean" = Field.TYPE_BOOLEAN。Lin
- */ if (field.type == ObjC.FIELD_boolType) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- writeStr += TagComper.compTag(
- // wdoptionTransform.transform(str) 移到 transform(tagAtrMap) 后,
- // 就可以用 TagComper.transform(str) 了。Lin
- /// * 改。Lin
- // "<wd:write type=\"option\" object=\""+ vo.name
- // + "\" field=\""+ field.name
- // + "\" value=\""+ value +"\" />");
- /// *
- "<opt@ss obj=\""+ vo.name +"\" field=\""+ field.name +"\" val=\""+ value +"\" />");
- */ writeStr.append(TagComper.compTag(
- "<opt.ss obj=\""+ vo.name +"\" field=\""+ field.name +"\" val=\""+ value +"\" />"));
- } else if (StringUtils.isNotBlank(field.cbName)) {
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- // String
- // lengthStr=inputproperties.get("size")!=null?("length=\""+inputproperties.get("size")+"\""):("");
- // String lengthStr = ""; // 去掉,没用到。Lin
- /* 改。Lin
- writeStr += "<wd:translate name=\""
- + Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
- + "\" value=\""+ wdWriteproperties.get("value")
- + "\" filter=\""+ (inputproperties.get("wdFilter") != null? inputproperties.get("wdFilter") : "")
- + "\"/>";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- writeStr += "<ss:cbTrans cb=\""
- + Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
- + "\" val=\""+ wdWriteproperties.get("value")
- + "\" filter=\""+ (inputproperties.get("wdFilter") != null? inputproperties.get("wdFilter") : "")
- + "\"/>"; // 不用编译 <cbTrans@ss -- 直接写编译后的。Lin
- */ writeStr.append("<ss:cbTrans cb=\"")
- .append(Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName))
- .append("\" val=\"").append(wdWriteproperties.get("value"))
- .append("\" filter=\"")
- .append(inputproperties.get("ssFilter") != null ? inputproperties.get("ssFilter") : "")
- .append("\"/>"); // 不用编译 <cbTrans@ss -- 直接写编译后的。Lin
- } else {// wdwrite
- /* 增加把 "value" 转为 <txt@ss 的 "val","format" 转为 "fmt"。Lin
- * wdWriteproperties 仍为 "value" --
- * IDEA -- String concatenation '+=' in loop
- writeStr += "<wd:write ";
- for (Map.Entry<String, String> entry : wdWriteproperties.entrySet()) {
- writeStr += entry.getKey() + "=\"" + entry.getValue() + "\" ";
- }
- */
- writeStr.append("<txt.ss ");
- String key;
- for (Entry<String, String> entry : wdWriteproperties.entrySet()) {
- key = entry.getKey();
- if ("value".equals(key)) // 增加,转为新标准。Lin
- key = "val";
- else if ("format".equals(key)) // 增加,转为新标准。Lin
- key = "fmt";
- /* 再改用 '',避免与字符串里的 "" 冲突。Lin
- writeStr += (key +"=\""+ entry.getValue() +"\" ");
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- writeStr += (key +"='"+ entry.getValue() +"' ");
- */ writeStr.append(key).append("='").append(entry.getValue()).append("' ");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- writeStr += "/>";
- writeStr = TagComper.compTag(writeStr);
- // textTransformer.transform(str) 移到 transform(tagAtrMap) 后,
- // 就可以用 TagComper.transform(str) 了。Lin
- */
- writeStr.append("/>");
- writeStr = new StringBuilder(TagComper.compTag(writeStr.toString()));
- }
- String styleStr = getAttributeStr(inputproperties, "style");
- String widthStr = getAttributeStr(inputproperties, "width");
- String heightStr = getAttributeStr(inputproperties, "height");
- /* 去掉,没用到。Lin
- String nameStr = getAttributeStr(inputproperties, "name");
- */
-
- String buttonStr = getAttributeStr(inputproperties, "button");
- if (StringUtils.isNotBlank(buttonStr)) // 增加,转为新标准。Lin
- buttonStr = buttonStr.replace("button=", "btn=");
- String maxHeightStr = getAttributeStr(inputproperties, "maxHeight");
- /* 去掉,Dead code。Lin
- if (true || field.type.equals(ObjC.FIELD_txtType)) { // field.TYPE_TEXT。Lin
- */
- // 默认值
- // <div id="ms" width="100%" height="100px"><wd:write
- // value='${ry.ms}'/></div>
- // <wd:write type="growHeight" name="ms" mode="edit"
- // maxHeight="300px"/>
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += "<div id=\""+ fieldNamePrefix + inputproperties.get("name")
- + "\" "+ styleStr +" "+ widthStr +" "+ heightStr +">"+ writeStr +"</div>";
- tabProgram += TagComper.compTag(
- // 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
- /// * 改。Lin
- // "<wd:write type=\"growHeight\" multiLine=\""+ field.isMultiline
- ///*
- "<growh@ss multiline=\""+ field.isMultiline
- + "\" name=\""+ fieldNamePrefix + name
- + "\"" + " mode=\"play\" "+ buttonStr +" "+ maxHeightStr +" />");
- */
- tabProgram.append("<div id=\"").append(fieldNamePrefix).append(inputproperties.get("name"))
- .append("\" ").append(styleStr).append(" ").append(widthStr).append(" ")
- .append(heightStr).append(">").append(writeStr).append("</div>");
- tabProgram.append(TagComper.compTag(
- "<growh.ss multiline=\""+ field.isMultiline
- + "\" name=\""+ fieldNamePrefix + name
- + "\" mode=\"play\" "+ buttonStr +" "+ maxHeightStr +" />"));
- /* 去掉,Dead code。Lin
- } else {
- tabProgram += "<div class=\"text-div\" "+ styleStr +" "+ widthStr
- + " title=\""+ writeStr +"\">"+ writeStr +"</div>";
- }
- */
-
- if (isBaseInfo)
- /* 改。Lin
- tabProgram = "<wd:permission name=\""+ name +"\">\r\n"
- + tabProgram +"\r\n</wd:permission>";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram = "<ss:auth field=\""+ name +"\">\r\n"
- + tabProgram +"\r\n</ss:auth>"; // 不用编译 <auth@ss -- 直接写编译后的。Lin
- */ tabProgram = new StringBuilder("<ss:auth field=\""+ name +"\">\r\n"
- + tabProgram +"\r\n</ss:auth>"); // 不用编译 <auth@ss -- 直接写编译后的。Lin
- /* 再去掉,移到 if-else 后 -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
- content = content.replace(temp[0], tabProgram);
- */
- } else {// 其他当作录入部件
- // boolean isCascadingInput = allcascadingSelect_input.contains(temp);
- // if (isCascadingInput && !isViewJsp)
- // inputproperties.put("type", "hidden");
- if (inputproperties.get("width") != null) {
- String style_ = inputproperties.get("style");
- style_ = style_ == null ? "" : style_;
- style_ += "width:" + inputproperties.get("width") + ";";
- inputproperties.put("style", style_);
- }
- // inputproperties.remove("width");
- if (StringUtils.isNotBlank(field.cbName)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 再改,IDEA:Can be replaced with single 'Map.putIfAbsent' method call。Lin
- if (inputproperties.get("value") == null)
- inputproperties.put("value", value);
- */ inputproperties.putIfAbsent("value", value);
- /* 改为新UI。Lin
- * "新UI发布程序:"
- * "下拉菜单 objPicker 录入页发布:"
- * "旧UI的发布程序,只是用来参考,已经没用了"
- String hiddenElement = "<input name=\""+ fieldNamePrefix + name
- + "\" type=\"hidden\" value=\""+ inputproperties.get("value")
- + "\" "+ getAttributeStr(inputproperties, "onchange") +" />";
- inputproperties.remove("value");
- inputproperties.remove("onchange");
- inputproperties.put("name", fieldNamePrefix+name + "Name");
- inputproperties.put("type", "text");
- /// * 没有 _view.jsp 了。Lin
- // if (isViewJsp) {
- // inputproperties.put("value", getDemoText());
- // }
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // String inputElement = "<input ";
- /// *
- StringBuilder inputElement = new StringBuilder("<input ");
- inputproperties.remove("width");
- for (Entry<String, String> entry : inputproperties.entrySet()) {
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // inputElement += entry.getKey() + "=\"" + entry.getValue() + "\" ";
- /// *
- inputElement.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\" ");
- }
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // inputElement += "/>";
- /// *
- inputElement.append("/>");
- String inputValue = inputproperties.get("wdInput") == null?
- inputproperties.get("input") : inputproperties.get("wdInput");
- if (StringUtils.isBlank(inputValue)) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- inputValue = ((field.inpable)? "true" : "false");
- // objectpicker
- ///// * 改。Lin
- // tabProgram = "<wd:write type=\"objectPicker\" name=\""+ fieldNamePrefix + name
- // + "\" input=\""+ inputValue
- // + "\" codebook=\""+ Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
- // + "\" object=\""+ Optional.ofNullable(field.objName).orElse("")
- // + "\" "+ (field.addable? ("add=\"true\"") : "")
- // + " filter=\""+ (inputproperties.get("wdFilter") != null? inputproperties.get("wdFilter") : "")
- ///// *
- ///// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // tabProgram = "<objp@ss name=\""+ fieldNamePrefix + name
- // + "\" inp=\""+ inputValue
- // + "\" cb=\""+ Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
- // + "\" obj=\""+ Optional.ofNullable(field.objName).orElse("")
- // + "\" "+ (field.addable? ("add=\"true\"") : "")
- // + " filter=\""+ (inputproperties.get("wdFilter") != null? inputproperties.get("wdFilter") : "")
- /// * 去掉 Field.filter(String),用 filterList。Lin
- // * 拼回 "zyid,rxnd"
- // + "\"" +(field.getFilter()!=null?(" filterField=\""+ field.getFilter() +"\"") : "")
- /// *
- /// * 再去掉 .filterList,用回 .filterStr -- 页面用到,不改页面、JS 先。Lin
- // + "\"" +((field.filterList.size() > 0)?
- // (" filterField=\""+ StringUtils.join((field.filterList).toArray(), ',') +"\"")
- // // 去掉 StrU.join(),直接用 StringUtils.join()。Lin
- // : "")
- /// *
- // + "\"" +((field.filterStr != null)?(" filterField=\""+ field.filterStr +"\"") : "")
- // + "/>";
- ///// *
- ///// * 再改,增加 field.inpCbName 和 field.cbParmStr。Lin
- // * 需要判断 页面的 wdCodebook 和 配置文件的 field.inpCbName 和 field.cbName -- wdCodebook > .inpCbName > .cbName
- // * 需要判断 页面的 ssFilter 和 配置文件的 field.cbParmStr -- ssFilter > .cbParm=
- // * 太复杂,不好阅读
- // tabProgram = new StringBuilder("<objp.ss name=\""+ fieldNamePrefix + name +
- // "\" inp=\""+ inputValue +"\""+
- // " cb=\""+ Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName) +"\""+
- // " obj=\""+ Optional.ofNullable(field.objName).orElse("") +"\""+
- // (field.addable ? (" add=\"true\"") : "") +
- // " filter=\""+ ((inputproperties.get("wdFilter") != null)? inputproperties.get("wdFilter") : "") +"\""+
- // ((field.filterStr != null)? (" filterField=\""+ field.filterStr +"\"") : "") +
- // "/>");
- ///// *
- ///// * 再改,分开 <field obj= 为 impObj= 和 addObj=,同时去掉 <field add="true" -- 归入 addObj=。Lin
- // tabProgram = new StringBuilder();
- // tabProgram.append("<objp.ss name=\"").append(fieldNamePrefix).append(name).append("\"")
- // .append(" inp=\"").append(inputValue).append("\"");
- // if (inputproperties.get("wdCodebook") != null)
- // tabProgram.append(" cb=\"").append(inputproperties.get("wdCodebook")).append("\"");
- // else if (field.inpCbName != null)
- // tabProgram.append(" cb=\"").append(field.inpCbName).append("\"");
- // else if (field.cbName != null)
- // tabProgram.append(" cb=\"").append(field.cbName).append("\"");
- // if (field.objName != null)
- // tabProgram.append(" obj=\"").append(field.objName).append("\"");
- // if (field.addable)
- // tabProgram.append(" add=\"true\"");
- // if (inputproperties.get("ssFilter") != null) // ("wdFilter")。Lin
- // tabProgram.append(" filter=\"").append(inputproperties.get("ssFilter")).append("\""); // ("wdFilter")).。Lin
- // else if (field.cbParmStr != null) // <field cbParm=,里层的引号,要用 "。Lin
- // tabProgram.append(" filter='").append(field.cbParmStr).append("'");
- // if (field.filterFieldStr != null)
- // tabProgram.append(" filterField=\"").append(field.filterFieldStr).append("\"");
- // tabProgram.append("/>");
- ///// *
- tabProgram = new StringBuilder();
- tabProgram.append("<objp.ss name=\"").append(fieldNamePrefix).append(name).append("\"")
- .append(" inp=\"").append(inputValue).append("\"");
- if (inputproperties.get("wdCodebook") != null)
- tabProgram.append(" cb=\"").append(inputproperties.get("wdCodebook")).append("\"");
- else if (field.inpCbName != null)
- tabProgram.append(" cb=\"").append(field.inpCbName).append("\"");
- else if (field.cbName != null)
- tabProgram.append(" cb=\"").append(field.cbName).append("\"");
- if (field.addObjName != null) { // (field.objName !=。分开 <field obj= 为 impObj= 和 addObj=,同时去掉 <field add="true"。Lin
- tabProgram.append(" obj=\"").append(field.addObjName).append("\""); // (field.objName).。Lin
- // if (field.addable) // 去掉,<field add="true" 归入 addObj=。Lin
- tabProgram.append(" add=\"true\"");
- }
- if (inputproperties.get("ssFilter") != null) // ("wdFilter")。Lin
- tabProgram.append(" filter=\"").append(inputproperties.get("ssFilter")).append("\""); // ("wdFilter")).。Lin
- else if (field.cbParmStr != null) // <field cbParm=,里层的引号,要用 "。Lin
- tabProgram.append(" filter='").append(field.cbParmStr).append("'");
- if (field.filterFieldStr != null)
- tabProgram.append(" filterField=\"").append(field.filterFieldStr).append("\"");
- tabProgram.append("/>");
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // *??? 另,考虑把 <ss:objp 的处理程序 ObjpTag 上移到这 -- 搞明白 miniInfo、Tips 内容 再定???
- // * 把下面 TagComper.compTag( 的 <ss:objp name='dwlbm' inp='false' cb='dwlb'/> 直接改为 wd.edit.objectPicker.createObjectPicker(
- // tabProgram = "<%--自动生成:"
- // + dxm +"."+ name +"@"
- // + Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
- // + "--%>"
- // + hiddenElement +"\r\n"
- // + inputElement + "\r\n"
- // + TagComper.compTag(tabProgram);
- // // obectPickerTransformer.transform(str) 移到 transform(tagAtrMap) 后,
- // // 就可以用 TagComper.transform(str) 了。Lin
- /// *
- tabProgram = new StringBuilder("<%--自动生成:"
- + dxm +"."+ name +"@"
- + Optional.ofNullable(inputproperties.get("wdCodebook")).orElse(field.cbName)
- + "--%>"
- + hiddenElement +"\r\n"
- + inputElement +"\r\n"
- + TagComper.compTag(tabProgram.toString()));
- */
- String objPickerInputContent = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_objp, //组件类弄
- inputproperties,//组件属性
- vo,
- field.getName()
- );
- tabProgram = new StringBuilder(objPickerInputContent);
- /* 再去掉,移到 if-else 后 -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
- content = content.replace(temp[0], tabProgram);
- */
- } else { // 下面,不含 <input name="sfpm" ssRun= /> -- 被移到 allonoffbutton 里了。Lin
- // 生成录入框
- // 这里的 <input ssRun= 是 Date、Time 字段里的。Lin
- String wdCallback = inputproperties.get("ssRun"); // ("wdCallback")。Lin
- if (wdCallback != null)
- inputproperties.remove("ssRun"); // ("wdCallback")。Lin
- // 页面设置的value是否带有标签
- boolean valueWithTag = false;
- // ////value
- if (wdWriteproperties.get("value") == null) { // "value"。Lin
- // value="<wd:write />"
- wdWriteproperties.put("value", value); // "value",。Lin
- /* 增加把 "value" 转为 txt@ss 的 "val","format" 转为 "fmt"。Lin
- * wdWriteproperties 仍为 "value" -- 有空再改。Lin
- tabProgram = "<wd:write ";
- for (Map.Entry<String, String> entry : wdWriteproperties.entrySet()) {
- tabProgram += entry.getKey() + "='" + entry.getValue() + "' ";
- }
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram = "<txt@ss ";
- */ tabProgram = new StringBuilder("<txt.ss ");
- String key;
- for (Entry<String, String> entry : wdWriteproperties.entrySet()) {
- key = entry.getKey(); // 增加。Lin
- if ("value".equals(key)) // 增加,转为新标准。Lin
- key = "val";
- else if ("format".equals(key)) // 增加,转为新标准。Lin
- key = "fmt";
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += (key +"='"+ entry.getValue() +"' ");
- */ tabProgram.append(key).append("='").append(entry.getValue()).append("' ");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += "/>";
- tabProgram = TagComper.compTag(tabProgram);
- // textTransformer.transform(str) 移到 transform(tagAtrMap) 后,
- // 就可以用 TagComper.transform(str) 了。Lin
- */
- tabProgram.append("/>");
- tabProgram = new StringBuilder(TagComper.compTag(tabProgram.toString()));
- } else {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram = wdWriteproperties.get("value"); // "value"。Lin
- valueWithTag = tabProgram.contains("<");
- */
- tabProgram = new StringBuilder(wdWriteproperties.get("value")); // "value"。Lin
- valueWithTag = tabProgram.toString().contains("<");
- }
- /* 没有 _view.jsp 了。Lin
- if (isViewJsp) {
- tabProgram = getDemoText();
- }
- */
- // SsLog.print(name +"-"+ field.type); // 去掉,干扰。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- inputproperties.put("value", tabProgram);
- */
- /* 再改,没区分查看和录入,现在改为下面:Ben(20260512)
- inputproperties.put("value", tabProgram.toString());
- */
- if(isInfo) {//是查看页才使用<ss:txt val='${zy.mc}'/>这个标签,因为这个标签会特殊字符转义 Ben(20260512)
- inputproperties.put("value", tabProgram.toString());
- }else{
- /// **
- // * Ben(20260512)
- // * 是录入页直接使用EL表达式如:${zy.mc},不用<ss:txt转义
- // * 实际页面是用JS的反引号(模板字符串),如`${zy.ms}`输出,屏蔽笑柄注入,类似下面这样
- // *ss.dom.formElemConfig.ms={val:`${zy.ms}`,type:window.ss.dom.TYPE.INPUT};
- /// *
- inputproperties.put("value", wdWriteproperties.get("value"));
- }
- inputproperties.put("name",fieldNamePrefix+name);
- /* maxLength 改为 Integer。Lin
- if (StringUtil.notNull(field.getMaxLength()) && inputproperties.get("maxLength") == null)
- inputproperties.put("maxLength", field.getMaxLength());
- */
- if (field.maxLen != null && inputproperties.get("maxLength") == null)
- inputproperties.put("maxLength", field.maxLen.toString());
- /* 再改,IDEA:Can be replaced with single 'Map.putIfAbsent' method call。Lin
- if (inputproperties.get("type") == null)
- inputproperties.put("type", "text");
- */ inputproperties.putIfAbsent("type", "text");
- /* 再去掉,按 IDEA 规范 -- The value '"\r\n<%--自动生成:"+ dxm +"."+ name +"--%>"' assigned to 'tabProgram' is never used。Lin
- tabProgram = "\r\n<%--自动生成:"+ dxm +"."+ name +"--%>";
- */
- /* 再去掉,与上面两行是一样的。Lin
- if (inputproperties.get("type") == null)
- inputproperties.put("type", "text");
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram = "\r\n<%--自动生成:"+ dxm +"."+ name +"--%>";
- */ tabProgram = new StringBuilder("\r\n<%--自动生成:"+ dxm +"."+ name +"--%>");
- // Boolean clearbutton=false;
- /* String 改为 int。Lin
- if (field.type.equals(ObjC.FIELD_timeType)) { // field.TYPE_TIME。Lin
- */
- /* 再改,保留 FIELD_dateType 了 -- 不转为 FIELD_timeType 了。Lin
- if (field.type == ObjC.FIELD_timeType) {
- */ if (field.type == ObjC.FIELD_dateType || field.type == ObjC.FIELD_timeType) {
- /* 改为新UI。Lin
- inputproperties.remove("width");
- String onpickedStr = (StringUtils.isNotBlank(wdCallback))?
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- (",onpicked:function(){"+wdCallback+"();}") : "";
-
- /// * 去掉 Display,用 .format。Lin
- // inputproperties.put("onClick", "wd.edit.datePicker({dateFmt:'" + field.getDisplay().getFormat() + "'"+onpickedStr+"});");
- /// *
- inputproperties.put("onClick", "wd.edit.datePicker({dateFmt:'"+ field.fmt +"'"+ onpickedStr +"});");
- inputproperties.put("autocomplete", "off");
- ///// * 再改,IDEA:Can be replaced with single 'Map.computeIfAbsent' method call。Lin
- // if (inputproperties.get("placeholder") == null)
- /// * 去掉 Display,用 .format。Lin
- // inputproperties.put("placeholder", field.getDisplay().getFormat());
- /// *
- // inputproperties.put("placeholder", field.fmt);
- ///// *
- inputproperties.computeIfAbsent("placeholder", k -> field.fmt);
- */
- /**
- * 新UI:
- * 日期,时间选择
- */
- if(pageobj.isInp) {
- String type = PageCompC.FORM_PLUGIN_JS_TYPE_time;
- if (field.type == ObjC.FIELD_dateType) //只要有日期的,类似年朋日时分这样的,也必需在obj.xml配置为日期格式
- type = PageCompC.FORM_PLUGIN_JS_TYPE_date;
- String code = PageCompU.getInputCode(type, //组件类弄
- inputproperties,//组件属性
- vo, name);
- tabProgram.append(code);
- }
- }
- /* String 改为 int。Lin
- if (field.type.equals(ObjC.FIELD_txtType) // field.TYPE_TEXT。Lin
- || field.type.equals(ObjC.FIELD_numType)) { // field.TYPE_NUMBER。Lin
- */
- /* 再改,把 if 改为 else if,不然日期录入的 input 也会跑下面的 else 中多生成出一个文本框在页面。Ben(20251208)
- if (field.type == ObjC.FIELD_txtType || field.type == ObjC.FIELD_numType) {
- */ else if (field.type == ObjC.FIELD_txtType || field.type == ObjC.FIELD_numType) {
- // 默认值
- /* 改为新UI。Lin
- String heightStr = getAttributeStr(inputproperties, "height");
- String widthStr = getAttributeStr(inputproperties, "width");
- String maxHeightStr = getAttributeStr(inputproperties, "maxHeight");
- String buttonStr = getAttributeStr(inputproperties, "button");
- if (StringUtils.isNotBlank(buttonStr)) // 增加,转为新标准。Lin
- buttonStr = buttonStr.replace("button=", "btn=");
- String nameStr = getAttributeStr(inputproperties, "name");
- // <div id="ms" width="100%"
- // height="100px"><wd:write value='${ry.ms}'/></div>
- // <wd:write type="growHeight" name="ms" mode="edit"
- // maxHeight="300px"/>
- ///// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // tabProgram += "<div id=\""+ inputproperties.get("name") +"\" "
- // + getAttributeStr(inputproperties, "placeholder") +" "
- // + widthStr +" "+ heightStr +">"
- // + inputproperties.get("value") + "</div>";
- // tabProgram += TagComper.compTag(
- // // 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
- /// * 改。Lin
- // "<wd:write type=\"growHeight\" multiLine=\""+ field.isMultiline +"\" "
- // + nameStr +" "+ buttonStr +" "+ maxHeightStr +" mode=\"edit\" />");
- /// *
- // "<growh@ss multiline=\""+ field.isMultiline +"\" "
- // + nameStr +" "+ buttonStr +" "+ maxHeightStr +" mode=\"edit\" />");
- ///// *
- tabProgram.append("<div id=\"").append(inputproperties.get("name")).append("\" ")
- .append(getAttributeStr(inputproperties, "placeholder")).append(" ")
- .append(widthStr).append(" ").append(heightStr).append(">")
- .append(inputproperties.get("value")).append("</div>");
- tabProgram.append(TagComper.compTag(
- "<growh.ss multiline=\""+ field.isMultiline +"\" "
- + nameStr +" "+ buttonStr +" "+ maxHeightStr +" mode=\"edit\" />"));
- */
- /**
- * 新UI:
- * 普通文本录入
- */
- if(pageobj.isInp) {
- String code = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_input, //组件类弄
- inputproperties,//组件属性
- vo, name);
- tabProgram.append(code);
- }
- } else if (valueWithTag) {// value写带有标签:input标签不处理
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += temp[0];
- */ tabProgram.append(temp[0]);
- } else { // 在下面,增加生成 是否 字段的 <onoff.ss???Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += "<input ";
- */ tabProgram.append("<input ");
- for (Entry<String, String> entry : inputproperties.entrySet()) {
- // System.out.println(entry.getKey()+"="+entry.getValue());
- /* 再改,IDEA:'\'' is unnecessarily escaped。Lin
- String quota = entry.getValue().contains("\"")? "\'" : "\"";
- */ String quota = entry.getValue().contains("\"")? "'" : "\"";
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += entry.getKey() +"="+ quota + entry.getValue() + quota +" ";
- */ tabProgram.append(entry.getKey()).append("=").append(quota)
- .append(entry.getValue()).append(quota).append(" ");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += " />";
- */ tabProgram.append(" />");
- }
-
- // clearbutton=true;
- if ("true".equals(inputproperties.get("clear")))
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- tabProgram += "<script>wd.edit.addClearTextButton(\""+ field.name +"\");</script>";
- */ tabProgram.append("<script>wd.edit.addClearTextButton(\"").append(field.name).append("\");</script>");
- /* 再去掉,移到 if-else 后 -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
- content = content.replace(temp[0], tabProgram);
- */
- }
- }
- /// 再,把 if 和 else 的公共部分移到这(if-else 后) -- 按 IDEA 规范 -- Common part can be extracted from 'if'。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- content = content.replace(temp[0], tabProgram);
- */ content = content.replace(temp[0], tabProgram.toString());
- ///
- }
- // 处理 :onoffbutton
- // <input name="sfjy" type="button" value="否" wdValue="0" />
- // <input name="sfjy" type="button" value="是" wdValue="1" />
- // <%--默认选项第一个--%>
- // <wd:write type="radio" name="sfjy" value="${pxjl.sfjy}"
- // onClass="content-onButton" offClass="content-offButton"
- // nullable="false" />
- for (Entry<String, List<String[]>> entry : allonoffbutton.entrySet()) {
- String name = entry.getKey();
- ObjFieldB field = vo.fieldMap.get(name);
- if (field == null)
- continue;
-
- /* String 改为 int。Lin
- if (!(field.type.equals(ObjC.FIELD_boolType))) // Field.TYPE_BOOLEAN。Lin
- */ if (field.type != ObjC.FIELD_boolType)
- continue;
- /* 改,增加支持 <input name="sfpm"/> -- 只写一行。Lin
- if (entry.getValue().size() != 2)
- */ if (entry.getValue().size() != 1 && entry.getValue().size() != 2)
- continue;
- String value = "${"+ dxm +"."+ field.name +"}";
- String c = "";
- for (int i = 0; i < entry.getValue().size(); i++) {
- String[] temp = entry.getValue().get(i);
- ///// 增加,支持 <input name="sfpm"/> -- 像普通字段一样写。Lin
- /// 再增加,支持 <input name="sfpm" ssRun= />。Lin
- String ssRun = StrWeb.findAtrVal(temp[0], "ssRun", 1);
- ///
- if (!(temp[1].contains("_"))) {
- // <auth@ss field=。Lin
- if (isBaseInfo)
- c +="<ss:auth field=\""+name+"\">\r\n"; // 不用编译 <auth@ss -- 直接写编译后的。Lin
- /* 改为新UI。Lin
- // "是" 按钮。Lin
- String vvvv = field.optMap.get(1);
- c += "<input name=\""+ fieldNamePrefix + name +
- "\" type=\"button\" value=\""+ vvvv +
- /// * 再改,规范 wdValue= 命名。Lin
- // "\" wdValue=\""+ 1 +"\" />\r\n";
- /// *
- "\" ssVal=\""+ AppC.IF_true +"\"/>\r\n";
- // "否" 按钮。Lin
- vvvv = field.optMap.get(0);
- c += "<input name=\""+ fieldNamePrefix + name +
- "\" type=\"button\" value=\""+ vvvv +
- /// * 再改,规范 wdValue= 命名。Lin
- // "\" wdValue=\""+ 0 +"\" />\r\n";
- /// *
- "\" ssVal=\""+ AppC.IF_false +"\"/>\r\n";
- String tabStr = "<onoff.ss rad=\"true\" name=\"" + fieldNamePrefix + name + // 再改,<onoff.ss radio= 改为 rad=。Lin
- "\" val=\"" + value + "\" null=\""+ field.nullable +"\""+
- /// 再增加,支持 <input name="sfpm" ssRun= />。Lin
- ((StringUtils.isNotBlank(ssRun))? (" run=\""+ ssRun +"\"") : "") +
- ///
- " mode=\"" + (isInfo ? "play" : "edit") + "\"/>";
- tabStr = TagComper.compTag(tabStr);
- // 用 TagComper.transform(),onoffbuttonTransform 没盖写过。Lin
- c += tabStr;
- */
- Map<String, String> inputproperties = new HashMap<>();
- inputproperties.put("value",value);
- //20251024新加 getInputCode方法的param参数
- Map<String,Object> param = new HashMap<>();
- param.put("isInfo",isInfo);
- /* 改,查看页和录入页分开处理 Ben(20260413)。Lin
- String code = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_onoffbtn, //组件类弄
- inputproperties,//组件属性
- vo,
- fieldNamePrefix + name, //input的name属性
- param
- );
- */
- String code = null;
- //查看页和录入页分开处理 Ben(20260413)
- if(isInfo){
- code = "<script>\n" +
- "{\n" +
- " let v = '" +
- value +
- "'; \n" +
- " if (v === '1') {\n" +
- " document.write('是');\n" +
- " } else if (v === '0') {\n" +
- " document.write('否');\n" +
- " } else {\n" +
- " document.write('-');\n" +
- " }\n" +
- "}\n" +
- "</script>";
- }else{
- code = PageCompU.getInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_onoffbtn, //组件类弄
- inputproperties,//组件属性
- vo,
- fieldNamePrefix + name, //input的name属性
- param
- );
- }
- c += code;
- // </auth@ss>。Lin
- if (isBaseInfo)
- c+="\r\n</ss:auth>"; // 不用编译 <auth@ss -- 直接写编译后的。Lin
- // 替换 <input name="sfpm"/>。Lin
- content = content.replace(temp[0], c);
- continue; // 没有后续处理了。Lin
- }
- /////
- // String wdValue = temp[1].split("\\_")[1];
-
- /* 再改,IDEA:Redundant character escape '\\_' in RegExp。Lin
- String[] vv = temp[1].split("\\_");
- */ String[] vv = temp[1].split("_");
- String wdValue = vv[vv.length -1];
-
- if ("yes".equalsIgnoreCase(wdValue))
- wdValue = "1";
- if ("no".equalsIgnoreCase(wdValue))
- wdValue = "0";
- String vvvv = field.optMap.get(Integer.valueOf(wdValue));
- c += "<input name=\""+ fieldNamePrefix + name +
- "\" type=\"button\" value=\""+ vvvv +
- "\" ssVal=\""+ wdValue +"\" />\r\n"; // "\" wdValue=\""+。Lin
- if (entry.getValue().size() - 1 > i) {
- String newContent="";
- if (isBaseInfo && i == 0){
- /* 改。Lin
- newContent="<wd:permission name=\""+name+"\">\r\n";
- */ newContent="<auth.ss field=\""+name+"\">\r\n";
- }
- content = content.replace(temp[0], newContent);
- } else {
- /* null="true" 改为 field.nullable。Lin
- * 尾端不能是 "/>\r\n",只能是 "/>" -- TagComper.transform() 会判别尾端是 ">" 还是 "/>"
- * 再改,<onoff.ss radio= 改为 rad=
- String tabStr = "<wd:write type=\"radio\" name=\"" +fieldNamePrefix+ name
- + "\" value=\"" + value + "\" nullable=\"true\""
- +" mode=\"" + (isInfo ? "play" : "edit") + "\"/>\r\n";
- */ String tabStr = "<onoff.ss rad=\"true\" name=\"" +fieldNamePrefix+ name
- + "\" val=\"" + value + "\" null=\""+ field.nullable +"\""
- +" mode=\"" + (isInfo ? "play" : "edit") + "\"/>";
- tabStr = TagComper.compTag(tabStr);
- // 用 TagComper.transform(),onoffbuttonTransform 没盖写过。Lin
- c += tabStr;
- if(isBaseInfo){
- if(entry.getValue().size() - 1==i){
- /* 改。Lin
- c+="\r\n</wd:permission>";
- */ c+="\r\n</auth.ss>";
- }
- }
-
- content = content.replace(temp[0], c);
- }
- }
- }
- // Map<String, String[]> name_inputs = new HashMap();
- //
- // for (String[] temp : allcascadingSelect_input) {
- // String name = temp[1];
- // name_inputs.put(name, temp);
- //
- // }
- //
- // for (String[] temp : allcascadingTagExist) {
- // // String name = temp[1];
- // CascadingSelectObject m = WD.getApp(appName).getCascadingSelectObject().get(temp[1]);
- // if (m == null)
- // continue;
- // String growHeigthScript = "";
- //
- // for (int i = 0; i < m.getInputs().getInputList().size(); i++) {
- // String inputName = m.getInputs().getInputList().get(i).getName();
- // String[] temp1 = name_inputs.get(inputName);
- // if (temp1 == null)
- // continue;
- // Map<String, String> inputproperties = inputElementProperties_input(temp1[0]);
- //
- // String heightStr = getAttributeStr(inputproperties, "height");
- // String widthStr = getAttributeStr(inputproperties, "width");
- // String maxHeightStr = getAttributeStr(inputproperties, "maxHeight");
- // String buttonStr = getAttributeStr(inputproperties, "button");
- //
- // String playDiv = "<div id=\"" + inputName + "Play\" name=\"" + inputName + "Play\" " + widthStr + " " + heightStr + "></div>";
- // content = content.replace(temp1[0], temp1[0] + "\r\n" + playDiv);
- //
- //// growHeigthScript += growHeightTransformer.transform("<wd:write type=\"growHeight\" name=\"" + inputName + "Play\" mode=\"play\" " + buttonStr + " "
- //// + maxHeightStr + "/>");
- //
- // }
- //
- // }
- /// 改为新UI,增加。Lin
- Map<String,List<CcpB>> inp2CcpMap = new HashMap<>();//新UI专用:key是input的name,value是input对应的级联配置
- //初始化inp2CcpMap
- //下面的inpName本身就是带前缀的
- for (String inpName : allcascadingInputNamesObject.keySet()) {
- CcpB ccpB = allcascadingInputNamesObject.get(inpName);
- String prfx = cascadingPrfx.get(inpName);
- if(ccpB.combField!=null&&StringUtils.isNotBlank(ccpB.combField.rule)){
- //如果是有编码规则的隐藏字段
- if((prfx + ccpB.combField.name).equals(inpName)){
- List<CcpB> list = inp2CcpMap.get(inpName);
- if(list==null){
- list = new ArrayList<>();
- inp2CcpMap.put(inpName,list);
- }
- list.add(ccpB);
- continue;
- }
- }
- /* 再去掉,共用 CcpB.combField.fieldList(List<CcpFieldB>) 里的 CcpFieldB.name。Lin
- for (Integer index : ccpB.fieldNameMap.keySet()) {
- String fieldNameWithoutPrfx = ccpB.fieldNameMap.get(index);
- */
- for (CcpFieldB field : ccpB.combField.fieldList) {
- String fieldNameWithoutPrfx = field.name;
- String fullFieldName = prfx+fieldNameWithoutPrfx;
- if(fullFieldName.equals(inpName)){
- /* 再去掉,共用 CcpB.combField.fieldList(List<CcpFieldB>) 里的 CcpFieldB.name。Lin
- for (Integer j : ccpB.fieldNameMap.keySet()) {
- String fieldNameWithoutPrfx2 = ccpB.fieldNameMap.get(j);
- */
- for (CcpFieldB f : ccpB.combField.fieldList) {
- String fieldNameWithoutPrfx2 = f.name;
- String fullFieldName2 = prfx+fieldNameWithoutPrfx2;
- List<CcpB> list = inp2CcpMap.get(fullFieldName2);
- if(list==null||list.size()==0){
- list = new ArrayList<>();
- inp2CcpMap.put(fullFieldName2,list);
- }
- boolean allReadyHave = false;
- for (CcpB b : list) {
- if(b.name.equals(ccpB.name)){
- allReadyHave = true;
- break;
- }
- }
- if(!allReadyHave)
- list.add(ccpB);
- }
- continue;
- }
- }
- }
- ///
- // System.out.println(cascadingTagNewAttribute.keySet());
- //
- // System.out.println(notHandleCascadingInputNames);
- /// 改为新UI,增加。Lin
- //所有级联菜单的代码,在下面这循环生成
- ///
- for (String[] temp : allcascadingSelect_input) {
- Map<String, String> inputproperties = inputElementProperties_input(temp[0]);
- boolean wdReadonly = "true".equals(inputproperties.get("wdReadonly"));
- String inputName = temp[1]; // name(String) 改为 inputName -- 与 lastInputName 对应。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String thisContent=temp[0];
- */ StringBuilder thisContent= new StringBuilder(temp[0]); // <input name="bzrid" width="170px"/>。Lin
- CcpB ccp = allcascadingInputNamesObject.get(inputName); // m(CcpB) 改为 ccp。Lin
- /// 增加,获取 prfx -- 支持共用 ccp 定义。Lin
- String prfx = cascadingPrfx.get(inputName);
- ///
- boolean haveRules = StringUtils.isNotBlank(ccp.combField.rule); //带掩码
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 增加支持共用 ccp 定义。Lin
- boolean isinputs = (m.combField.name != null && m.combField.name.equals(name));
- */ boolean isinputs = (ccp.combField.name != null && (prfx + ccp.combField.name).equals(inputName));
- // if(isinputs)continue;
-
- // SsLog.print("name:"+ name +"---"+ m.name); // 去掉,干扰。Lin
- if(notHandleCascadingInputNames.contains(inputName))
- continue;
- /* 增加支持共用 ccp 定义。Lin
- if(cascadingTagNewAttribute.get(m.name)==null)
- */ if(cascadingTagNewAttribute.get(prfx + ccp.name) == null)
- continue;
-
- /* 改用 .lastFieldName。Lin
- * List<Input> 改为 Map<String, CascaderFieldB>
- int si = m.getInputs().getInputList().size() - 1;
- String lastInputName = m.getInputs().getInputList().get(si).getName();
- */
- /* 再增加,支持共用 ccp 定义。Lin
- String lastInputName = m.combField.lastFieldName;
- */ String lastInputName = prfx + ccp.combField.lastFieldName;
- /// 改为新UI,增加。Lin
- //新UI:生成初始化级联菜单的script
- //旧UI:生成级联自定义标签
- if(ccpIsNewUI){
- StringBuilder scriptSb = new StringBuilder();
- if(pageobj.isInp){//是发布录入页
- String script = null;
- if (lastInputName.equals(inputName)) { // 在最后的 <input 后面加 <ss:ccp mode="edit" name="dw_bzr" val="${bj.dwid},${bj.bzrid}"/>。Lin
- String componentType = null;
- if (haveRules) {//有编码规则的级联菜单
- componentType = PageCompC.FORM_PLUGIN_JS_TYPE_ccpsingle;
- }else {
- componentType = PageCompC.FORM_PLUGIN_JS_TYPE_ccpmutiple;
- }
- //返回初始化级联菜单录入组件的JS
- script = PageCompU.getInitInputCcpComponentJs(componentType, //组件类弄
- ccp,//级联菜单配置
- prfx, //级联配置中的前缀
- dxm, //对象名
- null
- );
- thisContent.append(script);
- }
- } else if (pageobj.isInfo) {//是发布baseInfo页
- ///
- /* 改为新UI。Lin
- * 去掉,抽取到 doCcpByInfo(,在下面共用。Lin
- * m(CcpB) 改为 ccp,name(String) 改为 inputName
- if (lastInputName.equals(inputName)) { // 在最后的 <input 后面加 <ss:ccp mode="edit" name="dw_bzr" val="${bj.dwid},${bj.bzrid}"/>。Lin
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // String v="";
- /// *
- StringBuilder v = new StringBuilder();
- if (haveRules) {
- /// * 改。Lin
- // * 支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'
- // * IDEA 规范 -- String concatenation '+=' in loop
- // if(namesValue.get(m.combField.name) != null){
- // v=namesValue.get(m.combField.name);
- // }else if(vo.fieldMap.get(m.combField.name) != null){
- // v = "${"+ dxm +"."+ m.combField.name +"},";
- // }
- /// *
- if (namesValue.get(prfx + ccp.combField.name) != null) {
- v = new StringBuilder(namesValue.get(prfx + ccp.combField.name));
- } else if (vo.fieldMap.get(prfx + ccp.combField.name) != null) {
- v = new StringBuilder("${"+ dxm +"."+ prfx + ccp.combField.name +"},");
- }
- } else {
- /// * List<Input> 改为 Map<String, CascaderFieldB>。Lin
- // for(int i=0;i<m.getInputs().getInputList().size();i++){
- // String n=m.getInputs().getInputList().get(i).getName();
- /// *
- /// * 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- // for (CcpFieldB input : ccp.combField.fieldList) {
- // String n = input.name;
- /// *
- for (CcpFieldB input : ccp.combField.fieldList) {
- String n = prfx + input.name;
- if (namesValue.get(n) != null) {
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // v+=namesValue.get(n)+",";
- /// *
- v.append(namesValue.get(n)).append(",");
- } else if (vo.fieldMap.get(n) != null) {
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // v+="${"+dxm+"."+n+"},";
- /// *
- v.append("${").append(dxm).append(".").append(n).append("},");
- } else {
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // v+=",";
- /// *
- v.append(",");
- }
- }
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // v=v.substring(0, v.length() -1);
- /// *
- v = new StringBuilder(v.substring(0, v.length() -1));
- }
-
- /// * 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- // cascadingTagNewAttribute.get(m.name).put("value",v);
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // cascadingTagNewAttribute.get(prfx + m.name).put("value",v);
- /// *
- cascadingTagNewAttribute.get(prfx + ccp.name).put("value", v.toString());
- /// * 改。Lin
- // thisContent+="\r\n<wd:cascadingSelect ";
- /// *
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // *??? 另,考虑把 <ss:ccp 的处理程序 CcpTag 上移到这 -- 搞明白 miniInfo、Tips 内容 再定???
- // * 把下面 .append( 的 <ss:ccp mode="edit" prfx="sz" name="dq" val="${dw.szdqm}"/> 直接改为 wd.edit.objectPicker.createObjectPicker(
- // thisContent+="\r\n<ss:ccp"; // 不能用 <ccp@ss,没有编译。Lin
- /// *
- thisContent.append("\r\n<ss:ccp"); // 不能用 <ccp@ss,没有编译。Lin
- /// * 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- // for(String key : cascadingTagNewAttribute.get(m.name).keySet()){
- /// *
- for (String key : cascadingTagNewAttribute.get(prfx + ccp.name).keySet()) {
- /// * 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- // if(cascadingTagNewAttribute.get(m.name).get(key)==null)
- /// *
- if (cascadingTagNewAttribute.get(prfx + ccp.name).get(key) == null)
- continue;
- /// * 改,使用新标准的 val=。Lin
- // thisContent += " "+ getAttributeStr(cascadingTagNewAttribute.get(m.name), key);
- /// *
- /// * 再改。Lin
- // * 支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'
- // * IDEA 规范 -- String concatenation '+=' in loop
- // String str = getAttributeStr(cascadingTagNewAttribute.get(m.name), key);
- // if ("value".equals(key))
- // str = str.replace("value=", "val=");
- // thisContent += " "+ str;
- /// *
- String str = getAttributeStr(cascadingTagNewAttribute.get(prfx + ccp.name), key);
- if ("value".equals(key))
- str = str.replace("value=", "val=");
- thisContent.append(" ").append(str);
- }
- /// * 再改,IDEA:String concatenation '+=' in loop。Lin
- // thisContent+="/>";
- /// *
- thisContent.append("/>");
- }
- */ doCcpByInfo(inputName, lastInputName, ccp, haveRules, prfx,
- namesValue, cascadingTagNewAttribute, vo, dxm, thisContent);
- /// 改为新UI,增加。Lin
- }
- } else {
- /* 改为新UI。Lin
- * 去掉,共用上面抽取出来的 doCcpByInfo(。Lin
- * m(CcpB) 改为 ccp,name(String) 改为 inputName
- if (lastInputName.equals(inputName)) { // 在最后的 <input 后面加 <ss:ccp mode="edit" name="dw_bzr" val="${bj.dwid},${bj.bzrid}"/>。Lin
- StringBuilder v = new StringBuilder();
- if (haveRules) {//有编码规则的级联菜单
- if (namesValue.get(prfx + ccp.combField.name) != null) {
- v = new StringBuilder(namesValue.get(prfx + ccp.combField.name));
- } else if (vo.fieldMap.get(prfx + ccp.combField.name) != null) {
- v = new StringBuilder("${"+ dxm +"."+ prfx + ccp.combField.name +"},");
- }
- } else {//没编码规则的级联菜单
- for (CcpFieldB input : ccp.combField.fieldList) {
- String n = prfx + input.name;
- if (namesValue.get(n) != null) {
- v.append(namesValue.get(n)).append(",");
- } else if (vo.fieldMap.get(n) != null) {
- v.append("${").append(dxm).append(".").append(n).append("},");
- } else {
- v.append(",");
- }
- }
- v = new StringBuilder(v.substring(0, v.length() -1));
- }
- cascadingTagNewAttribute.get(prfx + ccp.name).put("value", v.toString());
- thisContent.append("\r\n<ss:ccp"); // 不能用 <ccp@ss,没有编译。Lin
- for (String key : cascadingTagNewAttribute.get(prfx + ccp.name).keySet()) {
- if (cascadingTagNewAttribute.get(prfx + ccp.name).get(key) == null)
- continue;
- String str = getAttributeStr(cascadingTagNewAttribute.get(prfx + ccp.name), key);
- if ("value".equals(key))
- str = str.replace("value=", "val=");
- thisContent.append(" ").append(str);
- }
- thisContent.append("/>");
- }
- */ doCcpByInfo(inputName, lastInputName, ccp, haveRules, prfx,
- namesValue, cascadingTagNewAttribute, vo, dxm, thisContent);
- }
- ///
- ObjFieldB field = vo.fieldMap.get(inputName);
- /// 改为新UI,增加。Lin
- // m(CcpB) 改为 ccp,name(String) 改为 inputName
- if (ccpIsNewUI) {
- if (isInfo || wdReadonly) {//替换baseInfo页的级联菜单代码
- if (!haveRules) {
- String v=Optional.ofNullable(inputproperties.get("value")).orElse("${"+ dxm +"."+ inputName +"}");
- String writeStr="";
- String codebook111=Optional.ofNullable(
- inputproperties.get("wdCodebook")).orElse((field != null)? field.cbName : null);
- if (StringUtils.isNotBlank(codebook111)) {
- writeStr += "<ss:cbTrans cb=\"" +codebook111
- + "\" val=\""+ v +"\" "
- + " filter=\""+ (inputproperties.get("ssFilter") != null? inputproperties.get("ssFilter") : "") + "\"/>";
- } else {
- writeStr="-object未定义codebook-";
- SsLog.log("XXXXXXXX -object未定义codebook-");
- }
- writeStr = "<div id=\""+ inputproperties.get("name") + "\" "
- +" "+ getAttributeStr(inputproperties, "style")
- + getAttributeStr(inputproperties, "width")
- + " " + getAttributeStr(inputproperties, "height") +">"
- + writeStr +"</div>";
- writeStr += TagComper.compTag(
- "<growh.ss name=\""+ inputName
- + "\" mode=\"play\" "+" "+ getAttributeStr(inputproperties, "maxHeight") +" />");
- if (isBaseInfo && (field != null)) {
- writeStr="<ss:auth field=\""+ field.name +"\">\r\n"
- + writeStr +"\r\n</ss:auth>";
- }
- thisContent = new StringBuilder(thisContent.toString().replace(temp[0], writeStr));
- }
- } else if(pageobj.isInp) {//新UI 替换录入页的级联菜单代码
- List<CcpB> ccpList = inp2CcpMap.get(inputName);
- if (ccpList != null) {
- String html = null;
- //如果是带编码规则的级联菜单
- if (haveRules) {
- boolean isCombField = (prfx + ccp.combField.name).equals(inputName);
- //返回初始化录入级联组件的JS
- html = PageCompU.getCcpInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_ccpsingle, //组件类弄
- inputproperties,//组件属性
- vo,
- inputName, //input的name属性
- isCombField, //是隐藏字段
- ccpList, //级联菜单配置
- prfx, //级联菜单前缀
- cascadingTagNewAttribute //级联菜单filter放在这
- );
- } else {
- //返回初始化录入级联组件的JS
- html = PageCompU.getCcpInputCode(PageCompC.FORM_PLUGIN_JS_TYPE_ccpmutiple, //组件类弄
- inputproperties,//组件属性
- vo,
- inputName, //input的name属性
- false, //是隐藏字段
- ccpList, //级联菜单配置
- prfx, //级联菜单前缀
- cascadingTagNewAttribute //级联菜单filter放在这
- );
- }
- thisContent = new StringBuilder(thisContent.toString().replace(temp[0], html));
- }
- }
- if (isBaseInfo && haveRules) {
- if (lastInputName.equals(inputName)) {
- thisContent.append("\r\n</ss:auth>\r\n"); // 不用编译 <auth@ss -- 直接写编译后的。Lin
- }
- }
- if (isinputs) {
- if (isBaseInfo && haveRules) {
- content = content.replace(temp[0],
- "<ss:auth field=\""+inputName+"\">\r\n"+ temp[0]); // 不用编译 <auth@ss -- 直接写编译后的。Lin
- } else {
- content = content.replace(temp[0], thisContent.toString());
- }
- } else {
- content = content.replace(temp[0], thisContent.toString());
- }
- } else {//老UI
- ///
- if (isInfo || wdReadonly) {
- /* 再改,IDEA:'if' statement has empty body。Lin
- if(haveRules){
- // thisContent =thisContent.replace(temp[0],"\r\n<div id=\"" + name + "Play\" name=\"" + name + "Play\" " +getAttributeStr(inputproperties, "width") + " " + getAttributeStr(inputproperties, "height") + "></div>");
- }else{
- */ if (!haveRules) {
- String v=Optional.ofNullable(inputproperties.get("value")).orElse("${"+ dxm +"."+ inputName +"}");
- String writeStr="";
- String codebook111=Optional.ofNullable(
- inputproperties.get("wdCodebook")).orElse((field != null)? field.cbName : null);
- if (StringUtils.isNotBlank(codebook111)) {
- // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- /* 改。Lin
- * 不用编译 <cbTrans@ss -- 直接写编译后的。Lin
- writeStr += "<wd:translate name=\"" +codebook111
- + "\" value=\""+ v +"\" "
- + " filter=\""+ (inputproperties.get("wdFilter") != null? inputproperties.get("wdFilter") : "") + "\"/>";
- */ writeStr += "<ss:cbTrans cb=\"" +codebook111
- + "\" val=\""+ v +"\" "
- + " filter=\""+ (inputproperties.get("ssFilter") != null? inputproperties.get("ssFilter") : "") + "\"/>";
- } else {
- writeStr="-object未定义codebook-";
- SsLog.log("XXXXXXXX -object未定义codebook-");
- }
- writeStr = "<div id=\""+ inputproperties.get("name") + "\" "
- +" "+ getAttributeStr(inputproperties, "style")
- + getAttributeStr(inputproperties, "width")
- + " " + getAttributeStr(inputproperties, "height") +">"
- + writeStr +"</div>";
- writeStr += TagComper.compTag(
- // 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
- /* 改。Lin
- "<wd:write type=\"growHeight\" name=\""+ name
- + "\" mode=\"play\" "+" "+ getAttributeStr(inputproperties, "maxHeight") +" />");
- */ "<growh.ss name=\""+ inputName
- + "\" mode=\"play\" "+" "+ getAttributeStr(inputproperties, "maxHeight") +" />");
- if (isBaseInfo && (field != null)) {
- /* 改。Lin
- * 不用编译 <auth@ss -- 直接写编译后的。Lin
- writeStr="<wd:permission name=\""+ field.name +"\">\r\n"
- + writeStr +"\r\n</wd:permission>";
- */ writeStr="<ss:auth field=\""+ field.name +"\">\r\n"
- + writeStr +"\r\n</ss:auth>";
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- thisContent =thisContent.replace(temp[0],writeStr);
- */ thisContent = new StringBuilder(thisContent.toString().replace(temp[0], writeStr));
- }
- } else {
- String v = "";
- if (namesValue.get(inputName) != null) {
- v += namesValue.get(inputName);
- } else if (vo.fieldMap.get(inputName) != null) {
- v += "${"+ dxm +"."+ inputName +"}";
- }
- inputproperties.put("value", v);
- /* 0,增加 />。Lin
- String hiddenElement = "<input name=\"" + name + "\" type=\"hidden\" "
- + getAttributeStr(inputproperties, "value") + " ";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String hiddenElement = "<input name=\""+ name +"\" type=\"hidden\" "
- + getAttributeStr(inputproperties, "value") +" />";
- */ StringBuilder hiddenElement = new StringBuilder("<input name=\""+ inputName +"\" type=\"hidden\" "
- + getAttributeStr(inputproperties, "value") +" />");
- inputproperties.remove("value");
- inputproperties.remove("ssCcp"); // ("wdCascadingSelect")。Lin
- inputproperties.remove("type");
- inputproperties.put("name", inputName +"Name"); // 1。Lin
- inputproperties.put("type", "text"); // 2。Lin
- if (inputproperties.get("width") != null) {
- String style_ = inputproperties.get("style");
- style_ = style_ == null ? "" : style_;
- style_ += "width:" + inputproperties.get("width") + ";";
- inputproperties.put("style", style_);
- }
-
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- hiddenElement += "\r\n<input "; // 3。Lin
- */ hiddenElement.append("\r\n<input "); // 3。Lin
- inputproperties.remove("width"); // 4。Lin
- for (Entry<String, String> entry : inputproperties.entrySet()) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- hiddenElement += entry.getKey() + "=\"" + entry.getValue() + "\" ";
- */ hiddenElement.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\" ");
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- hiddenElement += " />"; // 5,去掉 \r\n。Lin
- */ hiddenElement.append(" />"); // 5,去掉 \r\n。Lin
- //
- // 奇怪,前面 1、2、3、4 行被注释掉。Lin
- // 翻译出来的是:<input name="hksheng" type="hidden" name="hksheng" width="85px" style="width:85px;" />
- // 这明显是错的
- //
- // 去掉 1、2、3、4 行的注释后,翻译出来的是:
- // <input name="hksheng" type="hidden" />
- // <input name="hkshengName" style="width:85px;" type="text" />
- // 这应该才是对的。(原翻译后的,也是这样的
- //
- // 另,0 行也加了闭标签 />,5 行去掉了 \r\n
- //
-
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- thisContent =thisContent.replace(temp[0],hiddenElement);
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- thisContent = new StringBuilder(thisContent.toString().replace(temp[0], hiddenElement));
- */ thisContent = new StringBuilder(thisContent.toString().replace(temp[0], hiddenElement.toString()));
- }
- if (isBaseInfo && haveRules) {
- // if(firstInputName.equals(name)){
- // thisContent="<wd:permission name=\""+name+"\">\r\n"+thisContent;
- // }else
- if (lastInputName.equals(inputName)) {
- /* 改。Lin
- thisContent+="\r\n</wd:permission>\r\n";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- thisContent+="\r\n</ss:auth>\r\n"; // 不用编译 <auth@ss -- 直接写编译后的。Lin
- */ thisContent.append("\r\n</ss:auth>\r\n"); // 不用编译 <auth@ss -- 直接写编译后的。Lin
- }
- }
-
- if (isinputs) {
- /* 再改,IDEA:Condition 'isinputs' is always 'true'。Lin
- if(isBaseInfo&&isinputs&&haveRules){
- */ if (isBaseInfo && haveRules) {
- content = content.replace(temp[0],
- "<ss:auth field=\""+inputName+"\">\r\n"+ temp[0]); // 不用编译 <auth@ss -- 直接写编译后的。Lin
- }
- } else {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- content = content.replace(temp[0], thisContent);
- */ content = content.replace(temp[0], thisContent.toString());
- }
- /// 改为新UI,增加。Lin
- }
- ///
- // } // for (String[] temp : allcascadingSelect_input) {。再去掉(,把下面的 if (isInfo) { 也包到 for 里 -- 改为新UI时,大叶改为这样。Lin
-
- // 级联查看
- if (isInfo) {
- //combine=true
- // { // 再去掉,没意义。Lin
- Pattern p2 = Pattern.compile(
- /* 再改为 IDEA 规范。Lin
- * Redundant character escape '\\<' in RegExp
- * Empty branch in alternation -- ||
- * '\'' is unnecessarily escaped
- * Redundant character escape '\\>' in RegExp
- * Redundant character escape '\\/' in RegExp
- "\\<(td||TD)[^>]*?(wdCombine|wdcombine)=[\"\']true[\"\'][^>]*?\\>(.*?)\\<\\/(td||TD)>",
- */ "<(td|TD)[^>]*?(ssComb)=[\"']true[\"'][^>]*?>(.*?)</(td|TD)>",
- Pattern.DOTALL);
- Matcher m2 = p2.matcher(content);
- /* 去掉,没用到。Lin
- boolean dd = false;
- */
- int combineIndex=1;
- while (m2.find()) {
- String thismatch = m2.group();//(<td>...</td>)
- String innerMatch = m2.group(3);//(<td>(...)</td>)
- String combineId = "div"+ combineIndex+"combine";
-
- innerMatch = "<div id=\""+combineId+ "\">"
- + innerMatch
- + "</div>";
- /// 再增加,去掉 thismatch > content 里的 ssComb="true",避免被重复匹配到 -- 修正多个字段的 <td ssComb="true"。Lin
- Pattern ssCombPattern = Pattern.compile("ssComb=[\"']true[\"']");
- Matcher ssCombMatcher = ssCombPattern.matcher(thismatch);
- thismatch = ssCombMatcher.replaceAll("");
- ///
- thismatch = thismatch.replaceFirst(Pattern.quote(m2.group(3)), Matcher.quoteReplacement(innerMatch)) +
- //td之后追加
- "<script>wd.display.combineDiv(\""+ combineId+ "\");</script>\r\n"+
- TagComper.compTag(
- // 用 TagComper.transform(),growHeightTransformer 没盖写过。Lin
- /* 改。Lin
- "<wd:write type=\"growHeight\" name=\"" +combineId
- + "\" mode=\"play\" />");
- */ "<growh.ss name=\"" +combineId
- + "\" mode=\"play\" />");
- content=content.replaceFirst(Pattern.quote(m2.group()), Matcher.quoteReplacement(thismatch));
- combineIndex++;
- }
- // } // 再去掉,没意义。Lin
- }
- } // for (String[] temp : allcascadingSelect_input) {。增加,从上面上移到这,把 if (isInfo) { 也包到 for 里 -- 改为新UI时,大叶改为这样。Lin
- /// 再增加,查看时,在 <td 里增加样式 padding:0 15px。Lin
- // 在实现 growh 弹出框的左右边线与 <td 的边线重叠时,去掉 base.css 里的 .form-container td { 里的 padding: 0 15px,导致查看页的 <td 没有缩进 15px
- // 抄自上面的 处理 <td ssComb="true" 的程序
- if (isInfo) {
- Pattern tdPattern = Pattern.compile("<(td|TD)(.*?)>", Pattern.DOTALL); // <td ...>。Lin
- Matcher tdMatcher = tdPattern.matcher(content);
- while (tdMatcher.find()) {
- String tdMatch = tdMatcher.group(); // <td style="width:400px;">。Lin
- String tdCont = tdMatcher.group(2); // style="width:400px;"。Lin
- Pattern stylePattern = Pattern.compile("(style=[\"'].*?[\"'])", Pattern.DOTALL); // <td 里 style=。Lin
- Matcher styleMatcher = stylePattern.matcher(tdCont);
- if (styleMatcher.find()) { // 有 style=。Lin
- String styleMatch = styleMatcher.group(); // style="width:400px;"。Lin
- String styleStr = styleMatcher.group(1); // style="width:400px;"。Lin
- styleStr = styleStr.substring(0, styleStr.length() -1).trim(); // 去掉最后的 "。Lin
- if (!StringUtils.endsWith(styleStr, ";"))
- styleStr += ";";
- styleStr += "padding:0 15px;\"";
- tdCont = tdMatch.replaceFirst(styleMatch, styleStr); // 替换 style=。Lin
- } else { // 没有 style=。Lin
- tdCont = tdMatch.substring(0, tdMatch.length() -1).trim() + // <td > 改为 <td。Lin
- " style=\"padding:0 15px;\">"; // 增加 style=。Lin
- }
- // 更新到 content。Lin
- content = content.replaceFirst(Pattern.quote(tdMatch), Matcher.quoteReplacement(tdCont));
- }
- }
- ///
- /// 再增加,<th 里不需要写 style="width:160px;" -- 没有写 style="width: 时,自动补上。Lin
- // 抄自上面的 在 <td 里增加样式 padding:0 15px 的程序
- Pattern tdPattern = Pattern.compile("<(th|TH)(.*?)>", Pattern.DOTALL); // <th ...>。Lin
- Matcher tdMatcher = tdPattern.matcher(content);
- while (tdMatcher.find()) {
- String thMatch = tdMatcher.group(); // <th style="width:100px;">。Lin
- String thCont = tdMatcher.group(2); // style="width:100px;"。Lin
- Pattern stylePattern = Pattern.compile("(style=[\"'].*?[\"'])", Pattern.DOTALL); // <th 里 style=。Lin
- Matcher styleMatcher = stylePattern.matcher(thCont);
- if (styleMatcher.find()) { // 有 style=。Lin
- if (!thCont.contains("width:")) { // 没有 width:。Lin
- String styleMatch = styleMatcher.group(); // style="height:120px"。Lin
- String styleStr = styleMatcher.group(1); // style="height:120px"。Lin
- styleStr = styleStr.substring(0, styleStr.length() -1).trim(); // 去掉最后的 "。Lin
- if (!StringUtils.endsWith(styleStr, ";"))
- styleStr += ";";
- styleStr += SkinC.STYLE_thWidthStr +"\"";
- thCont = thMatch.replaceFirst(styleMatch, styleStr); // 替换 style=。Lin
- content = content.replaceFirst(Pattern.quote(thMatch), Matcher.quoteReplacement(thCont)); // 更新到 content。Lin
- }
- } else { // 没有 style=。Lin
- thCont = thMatch.substring(0, thMatch.length() -1).trim() + // <th > 改为 <th。Lin
- " style=\""+ SkinC.STYLE_thWidthStr +"\">"; // 增加 style="width:160px;"。Lin
- content = content.replaceFirst(Pattern.quote(thMatch), Matcher.quoteReplacement(thCont)); // 更新到 content。Lin
- }
- }
- ///
- return new StringReader(content);
- } catch (Exception e) {
- /* 改,去掉 e.printStackTrace(),改用 log4j -- 按 IDEA 规范。Lin
- e.printStackTrace();
- */ log4j.error("PageComper.addViewObjectTools() 异常", e);
- }
- return reader;
- }
- // 从 addViewObjectTools( 抽取出来,在 addViewObjectTools( 里共用。Lin
- // m(CcpB) 改为 ccp,name(String) 改为 inputName
- private static void doCcpByInfo(String inputName, String lastInputName, CcpB ccp, boolean haveRules, String prfx,
- Map<String, String> namesValue, Map<String, Map<String, String>> cascadingTagNewAttribute,
- ObjB vo, String dxm, StringBuilder thisContent) {
- if (lastInputName.equals(inputName)) { // 在最后的 <input 后面加 <ss:ccp mode="edit" name="dw_bzr" val="${bj.dwid},${bj.bzrid}"/>。Lin
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- String v="";
- */ StringBuilder v = new StringBuilder();
- if (haveRules) {
- /* 改。Lin
- * 支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'
- * IDEA -- String concatenation '+=' in loop
- if(namesValue.get(m.combField.name) != null){
- v=namesValue.get(m.combField.name);
- }else if(vo.fieldMap.get(m.combField.name) != null){
- v = "${"+ dxm +"."+ m.combField.name +"},";
- }
- */
- if (namesValue.get(prfx + ccp.combField.name) != null) {
- v = new StringBuilder(namesValue.get(prfx + ccp.combField.name));
- } else if (vo.fieldMap.get(prfx + ccp.combField.name) != null) {
- v = new StringBuilder("${"+ dxm +"."+ prfx + ccp.combField.name +"},");
- }
- } else {
- /* List<Input> 改为 Map<String, CascaderFieldB>。Lin
- for(int i=0;i<m.getInputs().getInputList().size();i++){
- String n=m.getInputs().getInputList().get(i).getName();
- */
- for (CcpFieldB input : ccp.combField.fieldList) {
- /* 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- String n = input.name;
- */ String n = prfx + input.name;
- if (namesValue.get(n) != null) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- v+=namesValue.get(n)+",";
- */ v.append(namesValue.get(n)).append(",");
- } else if (vo.fieldMap.get(n) != null) {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- v+="${"+dxm+"."+n+"},";
- */ v.append("${").append(dxm).append(".").append(n).append("},");
- } else {
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- v+=",";
- */ v.append(",");
- }
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- v=v.substring(0, v.length() -1);
- */ v = new StringBuilder(v.substring(0, v.length() -1));
- }
- /* 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- cascadingTagNewAttribute.get(m.name).put("value",v);
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- cascadingTagNewAttribute.get(prfx + m.name).put("value",v);
- */ cascadingTagNewAttribute.get(prfx + ccp.name).put("value", v.toString());
- /* 改。Lin
- thisContent+="\r\n<wd:cascadingSelect ";
- */
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- *??? 另,考虑把 <ss:ccp 的处理程序 CcpTag 上移到这 -- 搞明白 miniInfo、Tips 内容 再定???
- * 把下面 .append( 的 <ss:ccp mode="edit" prfx="sz" name="dq" val="${dw.szdqm}"/> 直接改为 wd.edit.objectPicker.createObjectPicker(
- thisContent+="\r\n<ss:ccp"; // 不能用 <ccp@ss,没有编译。Lin
- */ thisContent.append("\r\n<ss:ccp"); // 不能用 <ccp@ss,没有编译。Lin
- /* 改,支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'。Lin
- for(String key : cascadingTagNewAttribute.get(m.name).keySet()){
- */ for (String key : cascadingTagNewAttribute.get(prfx + ccp.name).keySet()) {
- /* 改,支持共用 ccp 定义。Lin
- if(cascadingTagNewAttribute.get(m.name).get(key)==null)
- */ if (cascadingTagNewAttribute.get(prfx + ccp.name).get(key) == null)
- continue;
- /* 改,使用新标准的 val=。Lin
- thisContent += " "+ getAttributeStr(cascadingTagNewAttribute.get(m.name), key);
- */
- /* 再改。Lin
- * 支持共用 ccp 定义 -- 增加前缀 <input ssCcp='{name:"bm_ry",prfx:"fz"}'
- * IDEA 规范 -- String concatenation '+=' in loop
- String str = getAttributeStr(cascadingTagNewAttribute.get(m.name), key);
- if ("value".equals(key))
- str = str.replace("value=", "val=");
- thisContent += " "+ str;
- */
- String str = getAttributeStr(cascadingTagNewAttribute.get(prfx + ccp.name), key);
- if ("value".equals(key))
- str = str.replace("value=", "val=");
- thisContent.append(" ").append(str);
- }
- /* 再改,IDEA:String concatenation '+=' in loop。Lin
- thisContent+="/>";
- */ thisContent.append("/>");
- }
- }
- private static String getAttributeStr(Map<String, String> map, String name) {
- if (StringUtils.isBlank(map.get(name))) // 去掉 StrU.isNull(),直接用 StringUtils.isBlank()。Lin
- return "";
- if ("button".equals(name)){
- if(map.get(name).contains("'"))
- return name + "=\"" + map.get(name) + "\"";
- return name + "='" + map.get(name) + "'";
- }
- if (map.get(name).contains("\"")) {
- return name + "='" + map.get(name) + "'";
- }else{
- return name + "=\"" + map.get(name) + "\"";
- }
- }
- /**
- * 查找生成<wd:write/>标签的附加属性
- *
- * @param source;
- * @return Map<String, String>
- */
- private static Map<String, String> inputElementProperties_WdWrite(String source) {
- Map<String, String> r = new HashMap<>();
- /// <input name="kssj" width="168px" format="yyyy-MM-dd HH:mm:ss" miniDate="false"/>。Lin
- // format= 改为 ssFmt=、miniDate= 改为 ssMiniDate=
- // 先不改,等 新UI 发布程序搞好了再改 -- 不打扰 大叶
- ///
- for (String a : new String[] { "value", "format", "miniDate", "length" }) {
- String value = StrWeb.findAtrVal(source, a, 1);
- if (StringUtils.isNotBlank(value)) { // 去掉 StrU.notNull(),直接用 StringUtils.isNotBlank()。Lin
- r.put(a, value);
- }
- }
- return r;
- }
-
- /* 再改。Lin
- private static final String[] inputElementPropertiess = {
- "class", "style", "id", "size", "type", "name", "onclick", "onchange",
- "placeholder", "autocomplete", "width", "height", "button", "input",
- "cascadingSelect", "wdCascadingSelect", "wdButton", "wdInput", "wdRadio",
- "wdCheckbox", "wdCallback", "value", "wdFilter", "clear","wdReadonly" ,"wdTabNo","wdCodebook"};
- */ private static final String[] inputElementPropertiess = {
- "class", "style", "id", "size", "type", "name", "onclick", "onchange",
- "placeholder", "autocomplete", "width", "height", "button", "ssInp",
- "cascadingSelect", "ssCcp", "ssChg", "ssBtn", "wdInput", "ssRad",
- "wdCheckbox", "ssRun", "value", "ssFilter","ssFilterField", "clear", "wdReadonly" ,
- ObjC.FIELD_no, // "wdTabNo",。Lin
- "wdCodebook"};
- /**
- * 查找生成<input />的附加属性
- *
- * @param source;
- * @return Map<String, String>
- */
- private static Map<String, String> inputElementProperties_input(String source) {
- // http://www.w3school.com.cn/tags/tag_input.asp
- Map<String, String> r = new HashMap<>();
- for (String a : inputElementPropertiess) {
- /* 去掉 findAttributeValue(),用 findAtrVal(,,1) -- 原 _findString()。Lin
- String value = findAttributeValue(source, a);
- */
- String value = StrWeb.findAtrVal(source, a, 1);
- if (value != null) {
- r.put(a, value);
- }
- }
- return r;
- // accept
- // align
- // alt
- // autocomplete
- // autofocus
- // checked
- // disabled
- // form
- // formaction
- // formenctype
- // formmethod
- // formnovalidate
- // formtarget
- // height
- // list
- // max
- // maxlength
- // min
- // multiple
- // name
- // pattern
- // placeholder
- // readonly
- // required
- // size
- // src
- // step
- // type
- // style
- // class
- }
-
-
-
- // =============
- // 把 PageConfig.systemComponent() 拆开,为 isWebsite() 和 isHomep()
- // 增加。Lin
- /* 再去掉,增加 PageB.isHomep 和 PageB.isSitep 了 -- 来自插件的 <pages homep="true"/sitep="true"。Lin
- private static boolean isWebsite(Integer pageType, Long devType){
- if (devType == null // 不指定访问设备,默认为 PC。Lin
- || devType == UserC.DEV_pcType) {
- /// * 再改,IDEA:'if' statement can be simplified。Lin
- // if (pageType > 10700 && pageType < 11000)
- // return true;
- // else
- // return false;
- /// *
- return pageType > 10700 && pageType < 11000;
- }
- return false;
- }
- */
- // 增加。Lin
- /* 再去掉,增加 PageB.isHomep 和 PageB.isSitep 了 -- 来自插件的 <pages homep="true"/sitep="true"。Lin
- private static boolean isHomep(Integer pageType, Long devType){
- if (devType == null // 不指定访问设备,默认为 PC。Lin
- || devType == UserC.DEV_pcType) {
- /// * 再改,IDEA:'if' statement can be simplified。Lin
- // if (pageType > 10500 && pageType < 10700)
- // return true;
- // else
- // return false;
- /// *
- return pageType > 10500 && pageType < 10700;
- }
- return false;
- }
- */
- }
|