dwz.min.js 134 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501
  1. var DWZ={
  2. keyCode:{
  3. ENTER:13,ESC:27,END:35,HOME:36,
  4. SHIFT:16,TAB:9,
  5. LEFT:37,RIGHT:39,UP:38,DOWN:40,
  6. DELETE:46,BACKSPACE:8},
  7. eventType:{
  8. pageClear:"pageClear",
  9. resizeGrid:"resizeGrid"},
  10. isOverAxis:function(x,reference,size){
  11. return(x>reference)&&(x<(reference+size));},
  12. isOver:function(y,x,top,left,height,width){
  13. return this.isOverAxis(y,top,height)&&this.isOverAxis(x,left,width);},
  14. pageInfo:{pageNum:"pageNum",numPerPage:"numPerPage",orderField:"orderField",orderDirection:"orderDirection"},
  15. statusCode:{ok:200,error:300,timeout:301},
  16. ui:{sbar:true},
  17. frag:{},
  18. _msg:{},
  19. _set:{
  20. loginUrl:"",
  21. loginTitle:"",
  22. debug:false},
  23. msg:function(key,args){
  24. var _format=function(str,args){
  25. args=args||[];
  26. var result=str||"";
  27. for(var i=0;i<args.length;i++){
  28. result=result.replace(new RegExp("\\{"+i+"\\}","g"),args[i]);}
  29. return result;}
  30. return _format(this._msg[key],args);},
  31. debug:function(msg){
  32. if(this._set.debug){
  33. if(typeof(console)!="undefined")console.log(msg);
  34. else alert(msg);}},
  35. loadLogin:function(){
  36. if($.pdialog&&DWZ._set.loginTitle){
  37. $.pdialog.open(DWZ._set.loginUrl,"login",DWZ._set.loginTitle,{mask:true,width:520,height:260});}else{
  38. window.location=DWZ._set.loginUrl;}},
  39. obj2str:function(o){
  40. var r=[];
  41. if(typeof o=="string")return "\""+o.replace(/([\'\"\\])/g,"\\$1").replace(/(\n)/g,"\\n").replace(/(\r)/g,"\\r").replace(/(\t)/g,"\\t")+"\"";
  42. if(typeof o=="object"){
  43. if(!o.sort){
  44. for(var i in o)
  45. r.push(i+":"+DWZ.obj2str(o[i]));
  46. if(!!document.all&&!/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)){
  47. r.push("toString:"+o.toString.toString());}
  48. r="{"+r.join()+"}"}else{
  49. for(var i=0;i<o.length;i++){
  50. r.push(DWZ.obj2str(o[i]));}
  51. r="["+r.join()+"]"}
  52. return r;}
  53. return o.toString();},
  54. jsonEval:function(data){
  55. try{
  56. if($.type(data)=='string')
  57. return eval('('+data+')');
  58. else return data;}catch(e){
  59. return{};}},
  60. ajaxError:function(xhr,ajaxOptions,thrownError){
  61. if(alertMsg){
  62. alertMsg.error("<div>Http status: "+xhr.status+" "+xhr.statusText+"</div>"+"<div>ajaxOptions: "+ajaxOptions+"</div>"+"<div>thrownError: "+thrownError+"</div>"+"<div>"+xhr.responseText+"</div>");}else{
  63. alert("Http status: "+xhr.status+" "+xhr.statusText+"\najaxOptions: "+ajaxOptions+"\nthrownError:"+thrownError+"\n"+xhr.responseText);}},
  64. ajaxDone:function(json){
  65. if(json.statusCode==DWZ.statusCode.error){
  66. if(json.message&&alertMsg)alertMsg.error(json.message);}else if(json.statusCode==DWZ.statusCode.timeout){
  67. if(alertMsg)alertMsg.error(json.message||DWZ.msg("sessionTimout"),{okCall:DWZ.loadLogin});
  68. else DWZ.loadLogin();}else{
  69. if(json.message&&alertMsg)alertMsg.correct(json.message);};},
  70. init:function(pageFrag,options){
  71. var op=$.extend({
  72. loginUrl:"login.html",loginTitle:null,callback:null,debug:false,
  73. statusCode:{}},options);
  74. this._set.loginUrl=op.loginUrl;
  75. this._set.loginTitle=op.loginTitle;
  76. this._set.debug=op.debug;
  77. $.extend(DWZ.statusCode,op.statusCode);
  78. $.extend(DWZ.pageInfo,op.pageInfo);
  79. jQuery.ajax({
  80. type:'GET',
  81. url:pageFrag,
  82. dataType:'xml',
  83. timeout:50000,
  84. cache:false,
  85. error:function(xhr){
  86. alert('Error loading XML document: '+pageFrag+"\nHttp status: "+xhr.status+" "+xhr.statusText);},
  87. success:function(xml){
  88. $(xml).find("_PAGE_").each(function(){
  89. var pageId=$(this).attr("id");
  90. if(pageId)DWZ.frag[pageId]=$(this).text();});
  91. $(xml).find("_MSG_").each(function(){
  92. var id=$(this).attr("id");
  93. if(id)DWZ._msg[id]=$(this).text();});
  94. if(jQuery.isFunction(op.callback))op.callback();}});
  95. var _doc=$(document);
  96. if(!_doc.isBind(DWZ.eventType.pageClear)){
  97. _doc.bind(DWZ.eventType.pageClear,function(event){
  98. var box=event.target;
  99. if($.fn.xheditor){
  100. $("textarea.editor",box).xheditor(false);}});}}};(function($){
  101. $.setRegional=function(key,value){
  102. if(!$.regional)$.regional={};
  103. $.regional[key]=value;};
  104. $.fn.extend({
  105. ajaxUrl:function(op){
  106. var $this=$(this);
  107. $this.trigger(DWZ.eventType.pageClear);
  108. $.ajax({
  109. type:op.type||'GET',
  110. url:op.url,
  111. data:op.data,
  112. cache:false,
  113. success:function(response){
  114. var json=DWZ.jsonEval(response);
  115. if(json.statusCode==DWZ.statusCode.error){
  116. if(json.message)alertMsg.error(json.message);}else{
  117. $this.html(response).initUI();
  118. if($.isFunction(op.callback))op.callback(response);}
  119. if(json.statusCode==DWZ.statusCode.timeout){
  120. if($.pdialog)$.pdialog.checkTimeout();
  121. if(navTab)navTab.checkTimeout();
  122. alertMsg.error(json.message||DWZ.msg("sessionTimout"),{okCall:function(){
  123. DWZ.loadLogin();}});}},
  124. error:DWZ.ajaxError,
  125. statusCode:{
  126. 503:function(xhr,ajaxOptions,thrownError){
  127. alert(DWZ.msg("statusCode_503")||thrownError);}}});},
  128. loadUrl:function(url,data,callback){
  129. $(this).ajaxUrl({url:url,data:data,callback:callback});},
  130. initUI:function(){
  131. return this.each(function(){
  132. if($.isFunction(initUI))initUI(this);});},
  133. layoutH:function($refBox){
  134. return this.each(function(){
  135. var $this=$(this);
  136. if(!$refBox)$refBox=$this.parents("div.layoutBox:first");
  137. var iRefH=$refBox.height();
  138. var iLayoutH=parseInt($this.attr("layoutH"));
  139. var iH=iRefH-iLayoutH>50?iRefH-iLayoutH:50;
  140. if($this.isTag("table")){
  141. $this.removeAttr("layoutH").wrap('<div layoutH="'+iLayoutH+'" style="overflow:auto;height:'+iH+'px"></div>');}else{
  142. $this.height(iH).css("overflow","auto");}});},
  143. hoverClass:function(className,speed){
  144. var _className=className||"hover";
  145. return this.each(function(){
  146. var $this=$(this),mouseOutTimer;
  147. $this.hover(function(){
  148. if(mouseOutTimer)clearTimeout(mouseOutTimer);
  149. $this.addClass(_className);},function(){
  150. mouseOutTimer=setTimeout(function(){$this.removeClass(_className);},speed||10);});});},
  151. focusClass:function(className){
  152. var _className=className||"textInputFocus";
  153. return this.each(function(){
  154. $(this).focus(function(){
  155. $(this).addClass(_className);}).blur(function(){
  156. $(this).removeClass(_className);});});},
  157. inputAlert:function(){
  158. return this.each(function(){
  159. var $this=$(this);
  160. function getAltBox(){
  161. return $this.parent().find("label.alt");}
  162. function altBoxCss(opacity){
  163. var position=$this.position();
  164. return{
  165. width:$this.width(),
  166. top:position.top+'px',
  167. left:position.left+'px',
  168. opacity:opacity||1};}
  169. if(getAltBox().size()<1){
  170. if(!$this.attr("id"))$this.attr("id",$this.attr("name")+"_"+Math.round(Math.random()*10000));
  171. var $label=$('<label class="alt" for="'+$this.attr("id")+'">'+$this.attr("alt")+'</label>').appendTo($this.parent());
  172. $label.css(altBoxCss(1));
  173. if($this.val())$label.hide();}
  174. $this.focus(function(){
  175. getAltBox().css(altBoxCss(0.3));}).blur(function(){
  176. if(!$(this).val())getAltBox().show().css("opacity",1);}).keydown(function(){
  177. getAltBox().hide();});});},
  178. isTag:function(tn){
  179. if(!tn)return false;
  180. return $(this)[0].tagName.toLowerCase()==tn?true:false;},
  181. isBind:function(type){
  182. var _events=$(this).data("events");
  183. return _events&&type&&_events[type];},
  184. log:function(msg){
  185. return this.each(function(){
  186. if(console)console.log("%s: %o",msg,this);});}});
  187. $.extend(String.prototype,{
  188. isPositiveInteger:function(){
  189. return(new RegExp(/^[1-9]\d*$/).test(this));},
  190. isInteger:function(){
  191. return(new RegExp(/^\d+$/).test(this));},
  192. isNumber:function(value,element){
  193. return(new RegExp(/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/).test(this));},
  194. trim:function(){
  195. return this.replace(/(^\s*)|(\s*$)|\r|\n/g,"");},
  196. startsWith:function(pattern){
  197. return this.indexOf(pattern)===0;},
  198. endsWith:function(pattern){
  199. var d=this.length-pattern.length;
  200. return d>=0&&this.lastIndexOf(pattern)===d;},
  201. replaceSuffix:function(index){
  202. return this.replace(/\[[0-9]+\]/,'['+index+']').replace('#index#',index);},
  203. trans:function(){
  204. return this.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"');},
  205. encodeTXT:function(){
  206. return(this).replaceAll('&','&amp;').replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll(" ","&nbsp;");},
  207. replaceAll:function(os,ns){
  208. return this.replace(new RegExp(os,"gm"),ns);},
  209. replaceTm:function($data){
  210. if(!$data)return this;
  211. return this.replace(RegExp("({[A-Za-z_]+[A-Za-z0-9_]*})","g"),function($1){
  212. return $data[$1.replace(/[{}]+/g,"")];});},
  213. replaceTmById:function(_box){
  214. var $parent=_box||$(document);
  215. return this.replace(RegExp("({[A-Za-z_]+[A-Za-z0-9_]*})","g"),function($1){
  216. var $input=$parent.find("#"+$1.replace(/[{}]+/g,""));
  217. return $input.val()?$input.val():$1;});},
  218. isFinishedTm:function(){
  219. return !(new RegExp("{[A-Za-z_]+[A-Za-z0-9_]*}").test(this));},
  220. skipChar:function(ch){
  221. if(!this||this.length===0){return '';}
  222. if(this.charAt(0)===ch){return this.substring(1).skipChar(ch);}
  223. return this;},
  224. isValidPwd:function(){
  225. return(new RegExp(/^([_]|[a-zA-Z0-9]){6,32}$/).test(this));},
  226. isValidMail:function(){
  227. return(new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(this.trim()));},
  228. isSpaces:function(){
  229. for(var i=0;i<this.length;i+=1){
  230. var ch=this.charAt(i);
  231. if(ch!=' '&&ch!="\n"&&ch!="\t"&&ch!="\r"){return false;}}
  232. return true;},
  233. isPhone:function(){
  234. return(new RegExp(/(^([0-9]{3,4}[-])?\d{3,8}(-\d{1,6})?$)|(^\([0-9]{3,4}\)\d{3,8}(\(\d{1,6}\))?$)|(^\d{3,8}$)/).test(this));},
  235. isUrl:function(){
  236. return(new RegExp(/^[a-zA-z]+:\/\/([a-zA-Z0-9\-\.]+)([-\w .\/?%&=:]*)$/).test(this));},
  237. isExternalUrl:function(){
  238. return this.isUrl()&&this.indexOf("://"+document.domain)==-1;}});})(jQuery);
  239. function Map(){
  240. this.elements=new Array();
  241. this.size=function(){
  242. return this.elements.length;}
  243. this.isEmpty=function(){
  244. return(this.elements.length<1);}
  245. this.clear=function(){
  246. this.elements=new Array();}
  247. this.put=function(_key,_value){
  248. this.remove(_key);
  249. this.elements.push({key:_key,value:_value});}
  250. this.remove=function(_key){
  251. try{
  252. for(i=0;i<this.elements.length;i++){
  253. if(this.elements[i].key==_key){
  254. this.elements.splice(i,1);
  255. return true;}}}catch(e){
  256. return false;}
  257. return false;}
  258. this.get=function(_key){
  259. try{
  260. for(i=0;i<this.elements.length;i++){
  261. if(this.elements[i].key==_key){return this.elements[i].value;}}}catch(e){
  262. return null;}}
  263. this.element=function(_index){
  264. if(_index<0||_index>=this.elements.length){return null;}
  265. return this.elements[_index];}
  266. this.containsKey=function(_key){
  267. try{
  268. for(i=0;i<this.elements.length;i++){
  269. if(this.elements[i].key==_key){
  270. return true;}}}catch(e){
  271. return false;}
  272. return false;}
  273. this.values=function(){
  274. var arr=new Array();
  275. for(i=0;i<this.elements.length;i++){
  276. arr.push(this.elements[i].value);}
  277. return arr;}
  278. this.keys=function(){
  279. var arr=new Array();
  280. for(i=0;i<this.elements.length;i++){
  281. arr.push(this.elements[i].key);}
  282. return arr;}}(function(){
  283. var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  284. var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
  285. function LZ(x){return(x<0||x>9?"":"0")+x}
  286. function formatDate(date,format){
  287. format=format+"";
  288. var result="";
  289. var i_format=0;
  290. var c="";
  291. var token="";
  292. var y=date.getYear()+"";
  293. var M=date.getMonth()+1;
  294. var d=date.getDate();
  295. var E=date.getDay();
  296. var H=date.getHours();
  297. var m=date.getMinutes();
  298. var s=date.getSeconds();
  299. var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
  300. var value={};
  301. if(y.length<4){y=""+(y-0+1900);}
  302. value["y"]=""+y;
  303. value["yyyy"]=y;
  304. value["yy"]=y.substring(2,4);
  305. value["M"]=M;
  306. value["MM"]=LZ(M);
  307. value["MMM"]=MONTH_NAMES[M-1];
  308. value["NNN"]=MONTH_NAMES[M+11];
  309. value["d"]=d;
  310. value["dd"]=LZ(d);
  311. value["E"]=DAY_NAMES[E+7];
  312. value["EE"]=DAY_NAMES[E];
  313. value["H"]=H;
  314. value["HH"]=LZ(H);
  315. if(H==0){value["h"]=12;}
  316. else if(H>12){value["h"]=H-12;}
  317. else{value["h"]=H;}
  318. value["hh"]=LZ(value["h"]);
  319. if(H>11){value["K"]=H-12;}else{value["K"]=H;}
  320. value["k"]=H+1;
  321. value["KK"]=LZ(value["K"]);
  322. value["kk"]=LZ(value["k"]);
  323. if(H>11){value["a"]="PM";}
  324. else{value["a"]="AM";}
  325. value["m"]=m;
  326. value["mm"]=LZ(m);
  327. value["s"]=s;
  328. value["ss"]=LZ(s);
  329. while(i_format<format.length){
  330. c=format.charAt(i_format);
  331. token="";
  332. while((format.charAt(i_format)==c)&&(i_format<format.length)){
  333. token+=format.charAt(i_format++);}
  334. if(value[token]!=null){result+=value[token];}
  335. else{result+=token;}}
  336. return result;}
  337. function _isInteger(val){
  338. return(new RegExp(/^\d+$/).test(val));}
  339. function _getInt(str,i,minlength,maxlength){
  340. for(var x=maxlength;x>=minlength;x--){
  341. var token=str.substring(i,i+x);
  342. if(token.length<minlength){return null;}
  343. if(_isInteger(token)){return token;}}
  344. return null;}
  345. function parseDate(val,format){
  346. val=val+"";
  347. format=format+"";
  348. var i_val=0;
  349. var i_format=0;
  350. var c="";
  351. var token="";
  352. var token2="";
  353. var x,y;
  354. var now=new Date(1900,0,1);
  355. var year=now.getYear();
  356. var month=now.getMonth()+1;
  357. var date=1;
  358. var hh=now.getHours();
  359. var mm=now.getMinutes();
  360. var ss=now.getSeconds();
  361. var ampm="";
  362. while(i_format<format.length){
  363. c=format.charAt(i_format);
  364. token="";
  365. while((format.charAt(i_format)==c)&&(i_format<format.length)){
  366. token+=format.charAt(i_format++);}
  367. if(token=="yyyy"||token=="yy"||token=="y"){
  368. if(token=="yyyy"){x=4;y=4;}
  369. if(token=="yy"){x=2;y=2;}
  370. if(token=="y"){x=2;y=4;}
  371. year=_getInt(val,i_val,x,y);
  372. if(year==null){return 0;}
  373. i_val+=year.length;
  374. if(year.length==2){
  375. if(year>70){year=1900+(year-0);}
  376. else{year=2000+(year-0);}}}else if(token=="MMM"||token=="NNN"){
  377. month=0;
  378. for(var i=0;i<MONTH_NAMES.length;i++){
  379. var month_name=MONTH_NAMES[i];
  380. if(val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()){
  381. if(token=="MMM"||(token=="NNN"&&i>11)){
  382. month=i+1;
  383. if(month>12){month-=12;}
  384. i_val+=month_name.length;
  385. break;}}}
  386. if((month<1)||(month>12)){return 0;}}else if(token=="EE"||token=="E"){
  387. for(var i=0;i<DAY_NAMES.length;i++){
  388. var day_name=DAY_NAMES[i];
  389. if(val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()){
  390. i_val+=day_name.length;
  391. break;}}}else if(token=="MM"||token=="M"){
  392. month=_getInt(val,i_val,token.length,2);
  393. if(month==null||(month<1)||(month>12)){return 0;}
  394. i_val+=month.length;}else if(token=="dd"||token=="d"){
  395. date=_getInt(val,i_val,token.length,2);
  396. if(date==null||(date<1)||(date>31)){return 0;}
  397. i_val+=date.length;}else if(token=="hh"||token=="h"){
  398. hh=_getInt(val,i_val,token.length,2);
  399. if(hh==null||(hh<1)||(hh>12)){return 0;}
  400. i_val+=hh.length;}else if(token=="HH"||token=="H"){
  401. hh=_getInt(val,i_val,token.length,2);
  402. if(hh==null||(hh<0)||(hh>23)){return 0;}
  403. i_val+=hh.length;}
  404. else if(token=="KK"||token=="K"){
  405. hh=_getInt(val,i_val,token.length,2);
  406. if(hh==null||(hh<0)||(hh>11)){return 0;}
  407. i_val+=hh.length;}else if(token=="kk"||token=="k"){
  408. hh=_getInt(val,i_val,token.length,2);
  409. if(hh==null||(hh<1)||(hh>24)){return 0;}
  410. i_val+=hh.length;hh--;}else if(token=="mm"||token=="m"){
  411. mm=_getInt(val,i_val,token.length,2);
  412. if(mm==null||(mm<0)||(mm>59)){return 0;}
  413. i_val+=mm.length;}else if(token=="ss"||token=="s"){
  414. ss=_getInt(val,i_val,token.length,2);
  415. if(ss==null||(ss<0)||(ss>59)){return 0;}
  416. i_val+=ss.length;}else if(token=="a"){
  417. if(val.substring(i_val,i_val+2).toLowerCase()=="am"){ampm="AM";}
  418. else if(val.substring(i_val,i_val+2).toLowerCase()=="pm"){ampm="PM";}
  419. else{return 0;}
  420. i_val+=2;}else{
  421. if(val.substring(i_val,i_val+token.length)!=token){return 0;}
  422. else{i_val+=token.length;}}}
  423. if(i_val!=val.length){return 0;}
  424. if(month==2){
  425. if(((year%4==0)&&(year%100!=0))||(year%400==0)){
  426. if(date>29){return 0;}}else{if(date>28){return 0;}}}
  427. if((month==4)||(month==6)||(month==9)||(month==11)){
  428. if(date>30){return 0;}}
  429. if(hh<12&&ampm=="PM"){hh=hh-0+12;}
  430. else if(hh>11&&ampm=="AM"){hh-=12;}
  431. return new Date(year,month-1,date,hh,mm,ss);}
  432. Date.prototype.formatDate=function(dateFmt){
  433. return formatDate(this,dateFmt);};
  434. String.prototype.parseDate=function(dateFmt){
  435. if(this.length<dateFmt.length){
  436. dateFmt=dateFmt.slice(0,this.length);}
  437. return parseDate(this,dateFmt);};
  438. function replaceTmEval(data){
  439. return data.replace(RegExp("({[A-Za-z0-9_+-]*})","g"),function($1){
  440. return eval('('+$1.replace(/[{}]+/g,"")+')');});}
  441. Date.prototype.formatDateTm=function(dateFmt){
  442. var y=this.getFullYear();
  443. var m=this.getMonth()+1;
  444. var d=this.getDate();
  445. var sDate=dateFmt.replaceAll("%y",y).replaceAll("%M",m).replaceAll("%d",d);
  446. sDate=replaceTmEval(sDate);
  447. var _y=1900,_m=0,_d=1;
  448. var aDate=sDate.split('-');
  449. if(aDate.length>0)_y=aDate[0];
  450. if(aDate.length>1)_m=aDate[1]-1;
  451. if(aDate.length>2)_d=aDate[2];
  452. return new Date(_y,_m,_d).formatDate('yyyy-MM-dd');};})();(function($){
  453. if($.validator){
  454. $.validator.addMethod("alphanumeric",function(value,element){
  455. return this.optional(element)||/^\w+$/i.test(value);},"Letters, numbers or underscores only please");
  456. $.validator.addMethod("lettersonly",function(value,element){
  457. return this.optional(element)||/^[a-z]+$/i.test(value);},"Letters only please");
  458. $.validator.addMethod("phone",function(value,element){
  459. return this.optional(element)||/^[0-9 \(\)]{7,30}$/.test(value);},"Please specify a valid phone number");
  460. $.validator.addMethod("postcode",function(value,element){
  461. return this.optional(element)||/^[0-9 A-Za-z]{5,20}$/.test(value);},"Please specify a valid postcode");
  462. $.validator.addMethod("date",function(value,element){
  463. value=value.replace(/\s+/g,"");
  464. if(String.prototype.parseDate){
  465. var $input=$(element);
  466. var pattern=$input.attr('dateFmt')||'yyyy-MM-dd';
  467. return !$input.val()||$input.val().parseDate(pattern);}else{
  468. return this.optional(element)||value.match(/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/);}},"Please enter a valid date.");
  469. $.validator.addMethod("customvalid",function(value,element,params){
  470. try{
  471. return eval('('+params+')');}catch(e){
  472. return false;}},"Please fix this field.");
  473. $.validator.addClassRules({
  474. date:{date:true},
  475. alphanumeric:{alphanumeric:true},
  476. lettersonly:{lettersonly:true},
  477. phone:{phone:true},
  478. postcode:{postcode:true}});
  479. $.validator.setDefaults({errorElement:"span"});
  480. $.validator.autoCreateRanges=true;}})(jQuery);(function($){
  481. $.fn.cssv=function(pre){
  482. var cssPre=$(this).css(pre);
  483. return cssPre.substring(0,cssPre.indexOf("px"))*1;};
  484. $.fn.jBar=function(options){
  485. var op=$.extend({container:"#container",collapse:".collapse",toggleBut:".toggleCollapse div",sideBar:"#sidebar",sideBar2:"#sidebar_s",splitBar:"#splitBar",splitBar2:"#splitBarProxy"},options);
  486. return this.each(function(){
  487. var jbar=this;
  488. var sbar=$(op.sideBar2,jbar);
  489. var bar=$(op.sideBar,jbar);
  490. $(op.toggleBut,bar).click(function(){
  491. DWZ.ui.sbar=false;
  492. $(op.splitBar).hide();
  493. var sbarwidth=sbar.cssv("left")+sbar.outerWidth();
  494. var barleft=sbarwidth-bar.outerWidth();
  495. var cleft=$(op.container).cssv("left")-(bar.outerWidth()-sbar.outerWidth());
  496. var cwidth=bar.outerWidth()-sbar.outerWidth()+$(op.container).outerWidth();
  497. $(op.container).animate({left:cleft,width:cwidth},50,function(){
  498. bar.animate({left:barleft},500,function(){
  499. bar.hide();
  500. sbar.show().css("left",-50).animate({left:5},200);
  501. $(window).trigger(DWZ.eventType.resizeGrid);});});
  502. $(op.collapse,sbar).click(function(){
  503. var sbarwidth=sbar.cssv("left")+sbar.outerWidth();
  504. if(bar.is(":hidden")){
  505. $(op.toggleBut,bar).hide();
  506. bar.show().animate({left:sbarwidth},500);
  507. $(op.container).click(_hideBar);}else{
  508. bar.animate({left:barleft},500,function(){
  509. bar.hide();});}
  510. function _hideBar(){
  511. $(op.container).unbind("click",_hideBar);
  512. if(!DWZ.ui.sbar){
  513. bar.animate({left:barleft},500,function(){
  514. bar.hide();});}}
  515. return false;});
  516. return false;});
  517. $(op.toggleBut,sbar).click(function(){
  518. DWZ.ui.sbar=true;
  519. sbar.animate({left:-25},200,function(){
  520. bar.show();});
  521. bar.animate({left:5},800,function(){
  522. $(op.splitBar).show();
  523. $(op.toggleBut,bar).show();
  524. var cleft=5+bar.outerWidth()+$(op.splitBar).outerWidth();
  525. var cwidth=$(op.container).outerWidth()-(cleft-$(op.container).cssv("left"));
  526. $(op.container).css({left:cleft,width:cwidth});
  527. $(op.collapse,sbar).unbind('click');
  528. $(window).trigger(DWZ.eventType.resizeGrid);});
  529. return false;});
  530. $(op.splitBar).mousedown(function(event){
  531. $(op.splitBar2).each(function(){
  532. var spbar2=$(this);
  533. setTimeout(function(){spbar2.show();},100);
  534. spbar2.css({visibility:"visible",left:$(op.splitBar).css("left")});
  535. spbar2.jDrag($.extend(options,{obj:$("#sidebar"),move:"horizontal",event:event,stop:function(){
  536. $(this).css("visibility","hidden");
  537. var move=$(this).cssv("left")-$(op.splitBar).cssv("left");
  538. var sbarwidth=bar.outerWidth()+move;
  539. var cleft=$(op.container).cssv("left")+move;
  540. var cwidth=$(op.container).outerWidth()-move;
  541. bar.css("width",sbarwidth);
  542. $(op.splitBar).css("left",$(this).css("left"));
  543. $(op.container).css({left:cleft,width:cwidth});}}));
  544. return false;});});});}})(jQuery);(function($){
  545. $.fn.jDrag=function(options){
  546. if(typeof options=='string'){
  547. if(options=='destroy')
  548. return this.each(function(){
  549. $(this).unbind('mousedown',$.rwdrag.start);
  550. $.data(this,'pp-rwdrag',null);});}
  551. return this.each(function(){
  552. var el=$(this);
  553. $.data($.rwdrag,'pp-rwdrag',{
  554. options:$.extend({
  555. el:el,
  556. obj:el},options)});
  557. if(options.event)
  558. $.rwdrag.start(options.event);
  559. else{
  560. var select=options.selector;
  561. $(select,obj).bind('mousedown',$.rwdrag.start);}});};
  562. $.rwdrag={
  563. start:function(e){
  564. document.onselectstart=function(e){return false};
  565. var data=$.data(this,'pp-rwdrag');
  566. var el=data.options.el[0];
  567. $.data(el,'pp-rwdrag',{
  568. options:data.options});
  569. if(!$.rwdrag.current){
  570. $.rwdrag.current={
  571. el:el,
  572. oleft:parseInt(el.style.left)||0,
  573. otop:parseInt(el.style.top)||0,
  574. ox:e.pageX||e.screenX,
  575. oy:e.pageY||e.screenY};
  576. $(document).bind("mouseup",$.rwdrag.stop).bind("mousemove",$.rwdrag.drag);}},
  577. drag:function(e){
  578. if(!e)var e=window.event;
  579. var current=$.rwdrag.current;
  580. var data=$.data(current.el,'pp-rwdrag');
  581. var left=(current.oleft+(e.pageX||e.clientX)-current.ox);
  582. var top=(current.otop+(e.pageY||e.clientY)-current.oy);
  583. if(top<1)top=0;
  584. if(data.options.move=='horizontal'){
  585. if((data.options.minW&&left>=$(data.options.obj).cssv("left")+data.options.minW)&&(data.options.maxW&&left<=$(data.options.obj).cssv("left")+data.options.maxW))
  586. current.el.style.left=left+'px';
  587. else if(data.options.scop){
  588. if(data.options.relObj){
  589. if((left-parseInt(data.options.relObj.style.left))>data.options.cellMinW){
  590. current.el.style.left=left+'px';}}else
  591. current.el.style.left=left+'px';}}else if(data.options.move=='vertical'){
  592. current.el.style.top=top+'px';}else{
  593. var selector=data.options.selector?$(data.options.selector,data.options.obj):$(data.options.obj);
  594. if(left>=-selector.outerWidth()*2/ 3&& top>= 0&&(left+ selector.outerWidth()/ 3<$(window).width())&&(top+selector.outerHeight()<$(window).height())){
  595. current.el.style.left=left+'px';
  596. current.el.style.top=top+'px';}}
  597. if(data.options.drag){
  598. data.options.drag.apply(current.el,[current.el]);}
  599. return $.rwdrag.preventEvent(e);},
  600. stop:function(e){
  601. var current=$.rwdrag.current;
  602. var data=$.data(current.el,'pp-rwdrag');
  603. $(document).unbind('mousemove',$.rwdrag.drag).unbind('mouseup',$.rwdrag.stop);
  604. if(data.options.stop){
  605. data.options.stop.apply(current.el,[current.el]);}
  606. $.rwdrag.current=null;
  607. document.onselectstart=function(e){return true};
  608. return $.rwdrag.preventEvent(e);},
  609. preventEvent:function(e){
  610. if(e.stopPropagation)e.stopPropagation();
  611. if(e.preventDefault)e.preventDefault();
  612. return false;}};})(jQuery);(function($){
  613. $.extend($.fn,{
  614. jTree:function(options){
  615. var op=$.extend({checkFn:null,selected:"selected",exp:"expandable",coll:"collapsable",firstExp:"first_expandable",firstColl:"first_collapsable",lastExp:"last_expandable",lastColl:"last_collapsable",folderExp:"folder_expandable",folderColl:"folder_collapsable",endExp:"end_expandable",endColl:"end_collapsable",file:"file",ck:"checked",unck:"unchecked"},options);
  616. return this.each(function(){
  617. var $this=$(this);
  618. var cnum=$this.children().length;
  619. $(">li",$this).each(function(){
  620. var $li=$(this);
  621. var first=$li.prev()[0]?false:true;
  622. var last=$li.next()[0]?false:true;
  623. $li.genTree({
  624. icon:$this.hasClass("treeFolder"),
  625. ckbox:$this.hasClass("treeCheck"),
  626. options:op,
  627. level:0,
  628. exp:(cnum>1?(first?op.firstExp:(last?op.lastExp:op.exp)):op.endExp),
  629. coll:(cnum>1?(first?op.firstColl:(last?op.lastColl:op.coll)):op.endColl),
  630. showSub:(!$this.hasClass("collapse")&&($this.hasClass("expand")||(cnum>1?(first?true:false):true))),
  631. isLast:(cnum>1?(last?true:false):true)});});
  632. setTimeout(function(){
  633. if($this.hasClass("treeCheck")){
  634. var checkFn=eval($this.attr("oncheck"));
  635. if(checkFn&&$.isFunction(checkFn)){
  636. $("div.ckbox",$this).each(function(){
  637. var ckbox=$(this);
  638. ckbox.click(function(){
  639. var checked=$(ckbox).hasClass("checked");
  640. var items=[];
  641. if(checked){
  642. var tnode=$(ckbox).parent().parent();
  643. var boxes=$("input",tnode);
  644. if(boxes.size()>1){
  645. $(boxes).each(function(){
  646. items[items.length]={name:$(this).attr("name"),value:$(this).val(),text:$(this).attr("text")};});}else{
  647. items={name:boxes.attr("name"),value:boxes.val(),text:boxes.attr("text")};}}
  648. checkFn({checked:checked,items:items});});});}}
  649. $("a",$this).click(function(event){
  650. $("div."+op.selected,$this).removeClass(op.selected);
  651. var parent=$(this).parent().addClass(op.selected);
  652. var $li=$(this).parents("li:first"),sTarget=$li.attr("target");
  653. if(sTarget){
  654. if($("#"+sTarget,$this).size()==0){
  655. $this.prepend('<input id="'+sTarget+'" type="hidden" />');}
  656. $("#"+sTarget,$this).val($li.attr("rel"));}
  657. $(".ckbox",parent).trigger("click");
  658. event.stopPropagation();
  659. $(document).trigger("click");
  660. if(!$(this).attr("target"))return false;});},1);});},
  661. subTree:function(op,level){
  662. return this.each(function(){
  663. $(">li",this).each(function(){
  664. var $this=$(this);
  665. var isLast=($this.next()[0]?false:true);
  666. $this.genTree({
  667. icon:op.icon,
  668. ckbox:op.ckbox,
  669. exp:isLast?op.options.lastExp:op.options.exp,
  670. coll:isLast?op.options.lastColl:op.options.coll,
  671. options:op.options,
  672. level:level,
  673. space:isLast?null:op.space,
  674. showSub:op.showSub,
  675. isLast:isLast});});});},
  676. genTree:function(options){
  677. var op=$.extend({icon:options.icon,ckbox:options.ckbox,exp:"",coll:"",showSub:false,level:0,options:null,isLast:false},options);
  678. return this.each(function(){
  679. var node=$(this);
  680. var tree=$(">ul",node);
  681. var parent=node.parent().prev();
  682. var checked='unchecked';
  683. if(op.ckbox){
  684. if($(">.checked",parent).size()>0)checked='checked';}
  685. if(tree.size()>0){
  686. node.children(":first").wrap("<div></div>");
  687. $(">div",node).prepend("<div class='"+(op.showSub?op.coll:op.exp)+"'></div>"+(op.ckbox?"<div class='ckbox "+checked+"'></div>":"")+(op.icon?"<div class='"+(op.showSub?op.options.folderColl:op.options.folderExp)+"'></div>":""));
  688. op.showSub?tree.show():tree.hide();
  689. $(">div>div:first,>div>a",node).click(function(){
  690. var $fnode=$(">li:first",tree);
  691. if($fnode.children(":first").isTag('a'))tree.subTree(op,op.level+1);
  692. var $this=$(this);
  693. var isA=$this.isTag('a');
  694. var $this=isA?$(">div>div",node).eq(op.level):$this;
  695. if(!isA||tree.is(":hidden")){
  696. $this.toggleClass(op.exp).toggleClass(op.coll);
  697. if(op.icon){
  698. $(">div>div:last",node).toggleClass(op.options.folderExp).toggleClass(op.options.folderColl);}}(tree.is(":hidden"))?tree.slideDown("fast"):(isA?"":tree.slideUp("fast"));
  699. return false;});
  700. addSpace(op.level,node);
  701. if(op.showSub)tree.subTree(op,op.level+1);}else{
  702. node.children().wrap("<div></div>");
  703. $(">div",node).prepend("<div class='node'></div>"+(op.ckbox?"<div class='ckbox "+checked+"'></div>":"")+(op.icon?"<div class='file'></div>":""));
  704. addSpace(op.level,node);
  705. if(op.isLast)$(node).addClass("last");}
  706. if(op.ckbox)node._check(op);
  707. $(">div",node).mouseover(function(){
  708. $(this).addClass("hover");}).mouseout(function(){
  709. $(this).removeClass("hover");});
  710. if($.browser.msie)
  711. $(">div",node).click(function(){
  712. $("a",this).trigger("click");
  713. return false;});});
  714. function addSpace(level,node){
  715. if(level>0){
  716. var parent=node.parent().parent();
  717. var space=!parent.next()[0]?"indent":"line";
  718. var plist="<div class='"+space+"'></div>";
  719. if(level>1){
  720. var next=$(">div>div",parent).filter(":first");
  721. var prev="";
  722. while(level>1){
  723. prev=prev+"<div class='"+next.attr("class")+"'></div>";
  724. next=next.next();
  725. level--;}
  726. plist=prev+plist;}
  727. $(">div",node).prepend(plist);}}},
  728. _check:function(op){
  729. var node=$(this);
  730. var ckbox=$(">div>.ckbox",node);
  731. var $input=node.find("a");
  732. var tname=$input.attr("tname"),tvalue=$input.attr("tvalue");
  733. var attrs="text='"+$input.text()+"' ";
  734. if(tname)attrs+="name='"+tname+"' ";
  735. if(tvalue)attrs+="value='"+tvalue+"' ";
  736. ckbox.append("<input type='checkbox' style='display:none;' "+attrs+"/>").click(function(){
  737. var cked=ckbox.hasClass("checked");
  738. var aClass=cked?"unchecked":"checked";
  739. var rClass=cked?"checked":"unchecked";
  740. ckbox.removeClass(rClass).removeClass(!cked?"indeterminate":"").addClass(aClass);
  741. $("input",ckbox).attr("checked",!cked);
  742. $(">ul",node).find("li").each(function(){
  743. var box=$("div.ckbox",this);
  744. box.removeClass(rClass).removeClass(!cked?"indeterminate":"").addClass(aClass)
  745. .find("input").attr("checked",!cked);});
  746. $(node)._checkParent();
  747. return false;});
  748. var cAttr=$input.attr("checked")||false;
  749. if(cAttr){
  750. ckbox.find("input").attr("checked",true);
  751. ckbox.removeClass("unchecked").addClass("checked");
  752. $(node)._checkParent();}},
  753. _checkParent:function(){
  754. if($(this).parent().hasClass("tree"))return;
  755. var parent=$(this).parent().parent();
  756. var stree=$(">ul",parent);
  757. var ckbox=stree.find(">li>a").size()+stree.find("div.ckbox").size();
  758. var ckboxed=stree.find("div.checked").size();
  759. var aClass=(ckboxed==ckbox?"checked":(ckboxed!=0?"indeterminate":"unchecked"));
  760. var rClass=(ckboxed==ckbox?"indeterminate":(ckboxed!=0?"checked":"indeterminate"));
  761. $(">div>.ckbox",parent).removeClass("unchecked").removeClass("checked").removeClass(rClass).addClass(aClass);
  762. var $checkbox=$(":checkbox",parent);
  763. if(aClass=="checked")$checkbox.attr("checked","checked");
  764. else $checkbox.removeAttr("checked");
  765. parent._checkParent();}});})(jQuery);(function($){
  766. var jmenus=new Map();
  767. $.dwz=$.dwz||{};
  768. $(window).resize(function(){
  769. setTimeout(function(){
  770. for(var i=0;i<jmenus.size();i++){
  771. fillSpace(jmenus.element(i).key);}},100);});
  772. $.fn.extend({
  773. accordion:function(options,data){
  774. var args=Array.prototype.slice.call(arguments,1);
  775. return this.each(function(){
  776. if(options.fillSpace)jmenus.put(options.fillSpace,this);
  777. if(typeof options=="string"){
  778. var accordion=$.data(this,"dwz-accordion");
  779. accordion[options].apply(accordion,args);}else if(!$(this).is(".dwz-accordion"))
  780. $.data(this,"dwz-accordion",new $.dwz.accordion(this,options));});},
  781. activate:function(index){
  782. return this.accordion("activate",index);}});
  783. $.dwz.accordion=function(container,options){
  784. this.options=options=$.extend({},$.dwz.accordion.defaults,options);
  785. this.element=container;
  786. $(container).addClass("dwz-accordion");
  787. if(options.navigation){
  788. var current=$(container).find("a").filter(options.navigationFilter);
  789. if(current.length){
  790. if(current.filter(options.header).length){
  791. options.active=current;}else{
  792. options.active=current.parent().parent().prev();
  793. current.addClass("current");}}}
  794. options.headers=$(container).find(options.header);
  795. options.active=findActive(options.headers,options.active);
  796. if(options.fillSpace){
  797. fillSpace(options.fillSpace);}else if(options.autoheight){
  798. var maxHeight=0;
  799. options.headers.next().each(function(){
  800. maxHeight=Math.max(maxHeight,$(this).outerHeight());}).height(maxHeight);}
  801. options.headers
  802. .not(options.active||"")
  803. .next()
  804. .hide();
  805. options.active.find("h2").addClass(options.selectedClass);
  806. if(options.event)
  807. $(container).bind((options.event)+".dwz-accordion",clickHandler);};
  808. $.dwz.accordion.prototype={
  809. activate:function(index){
  810. clickHandler.call(this.element,{
  811. target:findActive(this.options.headers,index)[0]});},
  812. enable:function(){
  813. this.options.disabled=false;},
  814. disable:function(){
  815. this.options.disabled=true;},
  816. destroy:function(){
  817. this.options.headers.next().css("display","");
  818. if(this.options.fillSpace||this.options.autoheight){
  819. this.options.headers.next().css("height","");}
  820. $.removeData(this.element,"dwz-accordion");
  821. $(this.element).removeClass("dwz-accordion").unbind(".dwz-accordion");}}
  822. function scopeCallback(callback,scope){
  823. return function(){
  824. return callback.apply(scope,arguments);};}
  825. function completed(cancel){
  826. if(!$.data(this,"dwz-accordion"))
  827. return;
  828. var instance=$.data(this,"dwz-accordion");
  829. var options=instance.options;
  830. options.running=cancel?0:--options.running;
  831. if(options.running)
  832. return;
  833. if(options.clearStyle){
  834. options.toShow.add(options.toHide).css({
  835. height:"",
  836. overflow:""});}
  837. $(this).triggerHandler("change.dwz-accordion",[options.data],options.change);}
  838. function fillSpace(key){
  839. var obj=jmenus.get(key);
  840. if(!obj)return;
  841. var parent=$(obj).parent();
  842. var height=parent.height()-(($(".accordionHeader",obj).size())*($(".accordionHeader:first-child",obj).outerHeight()))-2;
  843. var os=parent.children().not(obj);
  844. $.each(os,function(i){
  845. height-=$(os[i]).outerHeight();});
  846. $(".accordionContent",obj).height(height);}
  847. function toggle(toShow,toHide,data,clickedActive,down){
  848. var options=$.data(this,"dwz-accordion").options;
  849. options.toShow=toShow;
  850. options.toHide=toHide;
  851. options.data=data;
  852. var complete=scopeCallback(completed,this);
  853. options.running=toHide.size()==0?toShow.size():toHide.size();
  854. if(options.animated){
  855. if(!options.alwaysOpen&&clickedActive){
  856. $.dwz.accordion.animations[options.animated]({
  857. toShow:jQuery([]),
  858. toHide:toHide,
  859. complete:complete,
  860. down:down,
  861. autoheight:options.autoheight});}else{
  862. $.dwz.accordion.animations[options.animated]({
  863. toShow:toShow,
  864. toHide:toHide,
  865. complete:complete,
  866. down:down,
  867. autoheight:options.autoheight});}}else{
  868. if(!options.alwaysOpen&&clickedActive){
  869. toShow.toggle();}else{
  870. toHide.hide();
  871. toShow.show();}
  872. complete(true);}}
  873. function clickHandler(event){
  874. var options=$.data(this,"dwz-accordion").options;
  875. if(options.disabled)
  876. return false;
  877. if(!event.target&&!options.alwaysOpen){
  878. options.active.find("h2").toggleClass(options.selectedClass);
  879. var toHide=options.active.next(),
  880. data={
  881. instance:this,
  882. options:options,
  883. newHeader:jQuery([]),
  884. oldHeader:options.active,
  885. newContent:jQuery([]),
  886. oldContent:toHide},
  887. toShow=options.active=$([]);
  888. toggle.call(this,toShow,toHide,data);
  889. return false;}
  890. var clicked=$(event.target);
  891. if(clicked.parents(options.header).length)
  892. while(!clicked.is(options.header))
  893. clicked=clicked.parent();
  894. var clickedActive=clicked[0]==options.active[0];
  895. if(options.running||(options.alwaysOpen&&clickedActive))
  896. return false;
  897. if(!clicked.is(options.header))
  898. return;
  899. options.active.find("h2").toggleClass(options.selectedClass);
  900. if(!clickedActive){
  901. clicked.find("h2").addClass(options.selectedClass);}
  902. var toShow=clicked.next(),
  903. toHide=options.active.next(),
  904. data={
  905. instance:this,
  906. options:options,
  907. newHeader:clicked,
  908. oldHeader:options.active,
  909. newContent:toShow,
  910. oldContent:toHide},
  911. down=options.headers.index(options.active[0])>options.headers.index(clicked[0]);
  912. options.active=clickedActive?$([]):clicked;
  913. toggle.call(this,toShow,toHide,data,clickedActive,down);
  914. return false;};
  915. function findActive(headers,selector){
  916. return selector!=undefined?typeof selector=="number"?headers.filter(":eq("+selector+")"):headers.not(headers.not(selector)):selector===false?$([]):headers.filter(":eq(0)");}
  917. $.extend($.dwz.accordion,{
  918. defaults:{
  919. selectedClass:"collapsable",
  920. alwaysOpen:true,
  921. animated:'slide',
  922. event:"click",
  923. header:".accordionHeader",
  924. autoheight:true,
  925. running:0,
  926. navigationFilter:function(){
  927. return this.href.toLowerCase()==location.href.toLowerCase();}},
  928. animations:{
  929. slide:function(options,additions){
  930. options=$.extend({
  931. easing:"swing",
  932. duration:300},options,additions);
  933. if(!options.toHide.size()){
  934. options.toShow.animate({height:"show"},options);
  935. return;}
  936. var hideHeight=options.toHide.height(),
  937. showHeight=options.toShow.height(),
  938. difference=showHeight/hideHeight;
  939. options.toShow.css({height:0}).show();
  940. options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
  941. step:function(now){
  942. var current=(hideHeight-now)*difference;
  943. if($.browser.msie||$.browser.opera){
  944. current=Math.ceil(current);}
  945. options.toShow.height(current);},
  946. duration:options.duration,
  947. easing:options.easing,
  948. complete:function(){
  949. if(!options.autoheight){
  950. options.toShow.css({height:"auto"});}
  951. options.toShow.css({overflow:"auto"});
  952. options.complete();}});},
  953. bounceslide:function(options){
  954. this.slide(options,{
  955. easing:options.down?"bounceout":"swing",
  956. duration:options.down?1000:200});},
  957. easeslide:function(options){
  958. this.slide(options,{
  959. easing:"easeinout",
  960. duration:700})}}});})(jQuery);
  961. function initEnv(){
  962. $("body").append(DWZ.frag["dwzFrag"]);
  963. if($.browser.msie&&/6.0/.test(navigator.userAgent)){
  964. try{
  965. document.execCommand("BackgroundImageCache",false,true);}catch(e){}}
  966. if($.browser.msie){
  967. window.setInterval("CollectGarbage();",10000);}
  968. $(window).resize(function(){
  969. initLayout();
  970. $(this).trigger(DWZ.eventType.resizeGrid);});
  971. var ajaxbg=$("#background,#progressBar");
  972. ajaxbg.hide();
  973. $(document).ajaxStart(function(){
  974. ajaxbg.show();}).ajaxStop(function(){
  975. ajaxbg.hide();});
  976. $("#leftside").jBar({minW:150,maxW:700});
  977. if($.taskBar)$.taskBar.init();
  978. navTab.init();
  979. if($.fn.switchEnv)$("#switchEnvBox").switchEnv();
  980. if($.fn.navMenu)$("#navMenu").navMenu();
  981. setTimeout(function(){
  982. initLayout();
  983. initUI();
  984. var jTabsPH=$("div.tabsPageHeader");
  985. jTabsPH.find(".tabsLeft").hoverClass("tabsLeftHover");
  986. jTabsPH.find(".tabsRight").hoverClass("tabsRightHover");
  987. jTabsPH.find(".tabsMore").hoverClass("tabsMoreHover");},10);}
  988. function initLayout(){
  989. var iContentW=$(window).width()-(DWZ.ui.sbar?$("#sidebar").width()+10:34)-5;
  990. var iContentH=$(window).height()-$("#header").height()-34;
  991. $("#container").width(iContentW);
  992. $("#container .tabsPageContent").height(iContentH-34).find("[layoutH]").layoutH();
  993. $("#sidebar, #sidebar_s .collapse, #splitBar, #splitBarProxy").height(iContentH-5);
  994. $("#taskbar").css({top:iContentH+$("#header").height()+5,width:$(window).width()});}
  995. function initUI(_box){
  996. var $p=$(_box||document);
  997. $("div.panel",$p).jPanel();
  998. $("table.table",$p).jTable();
  999. $('table.list',$p).cssTable();
  1000. $("div.tabs",$p).each(function(){
  1001. var $this=$(this);
  1002. var options={};
  1003. options.currentIndex=$this.attr("currentIndex")||0;
  1004. options.eventType=$this.attr("eventType")||"click";
  1005. $this.tabs(options);});
  1006. $("ul.tree",$p).jTree();
  1007. $('div.accordion',$p).each(function(){
  1008. var $this=$(this);
  1009. $this.accordion({fillSpace:$this.attr("fillSpace"),alwaysOpen:true,active:0});});
  1010. $(":button.checkboxCtrl, :checkbox.checkboxCtrl",$p).checkboxCtrl($p);
  1011. if($.fn.combox)$("select.combox",$p).combox();
  1012. if($.fn.xheditor){
  1013. $("textarea.editor",$p).each(function(){
  1014. var $this=$(this);
  1015. var op={html5Upload:false,skin:'vista',tools:$this.attr("tools")||'full'};
  1016. var upAttrs=[["upLinkUrl","upLinkExt","zip,rar,txt"],["upImgUrl","upImgExt","jpg,jpeg,gif,png"],["upFlashUrl","upFlashExt","swf"],["upMediaUrl","upMediaExt","avi"]];
  1017. $(upAttrs).each(function(i){
  1018. var urlAttr=upAttrs[i][0];
  1019. var extAttr=upAttrs[i][1];
  1020. if($this.attr(urlAttr)){
  1021. op[urlAttr]=$this.attr(urlAttr);
  1022. op[extAttr]=$this.attr(extAttr)||upAttrs[i][2];}});
  1023. $this.xheditor(op);});}
  1024. if($.fn.uploadify){
  1025. $(":file[uploaderOption]",$p).each(function(){
  1026. var $this=$(this);
  1027. var options={
  1028. fileObjName:$this.attr("name")||"file",
  1029. auto:true,
  1030. multi:true,
  1031. onUploadError:uploadifyError};
  1032. var uploaderOption=DWZ.jsonEval($this.attr("uploaderOption"));
  1033. $.extend(options,uploaderOption);
  1034. DWZ.debug("uploaderOption: "+DWZ.obj2str(uploaderOption));
  1035. $this.uploadify(options);});}
  1036. $("input[type=text], input[type=password], textarea",$p).addClass("textInput").focusClass("focus");
  1037. $("input[readonly], textarea[readonly]",$p).addClass("readonly");
  1038. $("input[disabled=true], textarea[disabled=true]",$p).addClass("disabled");
  1039. $("input[type=text]",$p).not("div.tabs input[type=text]",$p).filter("[alt]").inputAlert();
  1040. $("div.panelBar li, div.panelBar",$p).hoverClass("hover");
  1041. $("div.button",$p).hoverClass("buttonHover");
  1042. $("div.buttonActive",$p).hoverClass("buttonActiveHover");
  1043. $("div.tabsHeader li, div.tabsPageHeader li, div.accordionHeader, div.accordion",$p).hoverClass("hover");
  1044. $("form.required-validate",$p).each(function(){
  1045. var $form=$(this);
  1046. $form.validate({
  1047. onsubmit:false,
  1048. focusInvalid:false,
  1049. focusCleanup:true,
  1050. errorElement:"span",
  1051. ignore:".ignore",
  1052. invalidHandler:function(form,validator){
  1053. var errors=validator.numberOfInvalids();
  1054. if(errors){
  1055. var message=DWZ.msg("validateFormError",[errors]);
  1056. alertMsg.error(message);}}});
  1057. $form.find('input[customvalid]').each(function(){
  1058. var $input=$(this);
  1059. $input.rules("add",{
  1060. customvalid:$input.attr("customvalid")})});});
  1061. if($.fn.datepicker){
  1062. $('input.date',$p).each(function(){
  1063. var $this=$(this);
  1064. var opts={};
  1065. if($this.attr("dateFmt"))opts.pattern=$this.attr("dateFmt");
  1066. if($this.attr("minDate"))opts.minDate=$this.attr("minDate");
  1067. if($this.attr("maxDate"))opts.maxDate=$this.attr("maxDate");
  1068. if($this.attr("mmStep"))opts.mmStep=$this.attr("mmStep");
  1069. if($this.attr("ssStep"))opts.ssStep=$this.attr("ssStep");
  1070. $this.datepicker(opts);});}
  1071. $("a[target=navTab]",$p).each(function(){
  1072. $(this).click(function(event){
  1073. var $this=$(this);
  1074. var title=$this.attr("title")||$this.text();
  1075. var tabid=$this.attr("rel")||"_blank";
  1076. var fresh=eval($this.attr("fresh")||"true");
  1077. var external=eval($this.attr("external")||"false");
  1078. var url=unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
  1079. DWZ.debug(url);
  1080. if(!url.isFinishedTm()){
  1081. alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
  1082. return false;}
  1083. navTab.openTab(tabid,url,{title:title,fresh:fresh,external:external});
  1084. event.preventDefault();});});
  1085. $("a[target=dialog]",$p).each(function(){
  1086. $(this).click(function(event){
  1087. var $this=$(this);
  1088. var title=$this.attr("title")||$this.text();
  1089. var rel=$this.attr("rel")||"_blank";
  1090. var options={};
  1091. var w=$this.attr("width");
  1092. var h=$this.attr("height");
  1093. if(w)options.width=w;
  1094. if(h)options.height=h;
  1095. options.max=eval($this.attr("max")||"false");
  1096. options.mask=eval($this.attr("mask")||"false");
  1097. options.maxable=eval($this.attr("maxable")||"true");
  1098. options.minable=eval($this.attr("minable")||"true");
  1099. options.fresh=eval($this.attr("fresh")||"true");
  1100. options.resizable=eval($this.attr("resizable")||"true");
  1101. options.drawable=eval($this.attr("drawable")||"true");
  1102. options.close=eval($this.attr("close")||"");
  1103. options.param=$this.attr("param")||"";
  1104. var url=unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
  1105. DWZ.debug(url);
  1106. if(!url.isFinishedTm()){
  1107. alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
  1108. return false;}
  1109. $.pdialog.open(url,rel,title,options);
  1110. return false;});});
  1111. $("a[target=ajax]",$p).each(function(){
  1112. $(this).click(function(event){
  1113. var $this=$(this);
  1114. var rel=$this.attr("rel");
  1115. if(rel){
  1116. var $rel=$("#"+rel);
  1117. $rel.loadUrl($this.attr("href"),{},function(){
  1118. $rel.find("[layoutH]").layoutH();});}
  1119. event.preventDefault();});});
  1120. $("div.pagination",$p).each(function(){
  1121. var $this=$(this);
  1122. $this.pagination({
  1123. targetType:$this.attr("targetType"),
  1124. rel:$this.attr("rel"),
  1125. totalCount:$this.attr("totalCount"),
  1126. numPerPage:$this.attr("numPerPage"),
  1127. pageNumShown:$this.attr("pageNumShown"),
  1128. currentPage:$this.attr("currentPage")});});
  1129. if($.fn.sortDrag)$("div.sortDrag",$p).sortDrag();
  1130. if($.fn.ajaxTodo)$("a[target=ajaxTodo]",$p).ajaxTodo();
  1131. if($.fn.dwzExport)$("a[target=dwzExport]",$p).dwzExport();
  1132. if($.fn.lookup)$("a[lookupGroup]",$p).lookup();
  1133. if($.fn.multLookup)$("[multLookup]:button",$p).multLookup();
  1134. if($.fn.suggest)$("input[suggestFields]",$p).suggest();
  1135. if($.fn.itemDetail)$("table.itemDetail",$p).itemDetail();
  1136. if($.fn.selectedTodo)$("a[target=selectedTodo]",$p).selectedTodo();
  1137. if($.fn.pagerForm)$("form[rel=pagerForm]",$p).pagerForm({parentBox:$p});}(function($){
  1138. $.fn.extend({
  1139. theme:function(options){
  1140. var op=$.extend({themeBase:"themes"},options);
  1141. var _themeHref=op.themeBase+"/#theme#/style.css";
  1142. return this.each(function(){
  1143. var jThemeLi=$(this).find(">li[theme]");
  1144. var setTheme=function(themeName){
  1145. $("head").find("link[href$='style.css']").attr("href",_themeHref.replace("#theme#",themeName));
  1146. jThemeLi.find(">div").removeClass("selected");
  1147. jThemeLi.filter("[theme="+themeName+"]").find(">div").addClass("selected");
  1148. if($.isFunction($.cookie))$.cookie("dwz_theme",themeName);}
  1149. jThemeLi.each(function(index){
  1150. var $this=$(this);
  1151. var themeName=$this.attr("theme");
  1152. $this.addClass(themeName).click(function(){
  1153. setTheme(themeName);});});
  1154. if($.isFunction($.cookie)){
  1155. var themeName=$.cookie("dwz_theme");
  1156. if(themeName){
  1157. setTheme(themeName);}}});}});})(jQuery);(function($){
  1158. $.fn.navMenu=function(){
  1159. return this.each(function(){
  1160. var $box=$(this);
  1161. $box.find("li>a").click(function(){
  1162. var $a=$(this);
  1163. $.post($a.attr("href"),{},function(html){
  1164. $("#sidebar").find(".accordion").remove().end().append(html).initUI();
  1165. $box.find("li").removeClass("selected");
  1166. $a.parent().addClass("selected");
  1167. navTab.closeAllTab();});
  1168. return false;});});}
  1169. $.fn.switchEnv=function(){
  1170. var op={cities$:">ul>li",boxTitle$:">a>span"};
  1171. return this.each(function(){
  1172. var $this=$(this);
  1173. $this.click(function(){
  1174. if($this.hasClass("selected")){
  1175. _hide($this);}else{
  1176. _show($this);}
  1177. return false;});
  1178. $this.find(op.cities$).click(function(){
  1179. var $li=$(this);
  1180. $.post($li.find(">a").attr("href"),{},function(html){
  1181. _hide($this);
  1182. $this.find(op.boxTitle$).html($li.find(">a").html());
  1183. navTab.closeAllTab();
  1184. $("#sidebar").find(".accordion").remove().end().append(html).initUI();});
  1185. return false;});});}
  1186. function _show($box){
  1187. $box.addClass("selected");
  1188. $(document).bind("click",{box:$box},_handler);}
  1189. function _hide($box){
  1190. $box.removeClass("selected");
  1191. $(document).unbind("click",_handler);}
  1192. function _handler(event){
  1193. _hide(event.data.box);}})(jQuery);
  1194. $.setRegional("alertMsg",{
  1195. title:{error:"Error",info:"Information",warn:"Warning",correct:"Successful",confirm:"Confirmation"},
  1196. butMsg:{ok:"OK",yes:"Yes",no:"No",cancel:"Cancel"}});
  1197. var alertMsg={
  1198. _boxId:"#alertMsgBox",
  1199. _bgId:"#alertBackground",
  1200. _closeTimer:null,
  1201. _types:{error:"error",info:"info",warn:"warn",correct:"correct",confirm:"confirm"},
  1202. _getTitle:function(key){
  1203. return $.regional.alertMsg.title[key];},
  1204. _keydownOk:function(event){
  1205. if(event.keyCode==DWZ.keyCode.ENTER)event.data.target.trigger("click");
  1206. return false;},
  1207. _keydownEsc:function(event){
  1208. if(event.keyCode==DWZ.keyCode.ESC)event.data.target.trigger("click");},
  1209. _open:function(type,msg,buttons){
  1210. $(this._boxId).remove();
  1211. var butsHtml="";
  1212. if(buttons){
  1213. for(var i=0;i<buttons.length;i++){
  1214. var sRel=buttons[i].call?"callback":"";
  1215. butsHtml+=DWZ.frag["alertButFrag"].replace("#butMsg#",buttons[i].name).replace("#callback#",sRel);}}
  1216. var boxHtml=DWZ.frag["alertBoxFrag"].replace("#type#",type).replace("#title#",this._getTitle(type)).replace("#message#",msg).replace("#butFragment#",butsHtml);
  1217. $(boxHtml).appendTo("body").css({top:-$(this._boxId).height()+"px"}).animate({top:"0px"},500);
  1218. if(this._closeTimer){
  1219. clearTimeout(this._closeTimer);
  1220. this._closeTimer=null;}
  1221. if(this._types.info==type||this._types.correct==type){
  1222. this._closeTimer=setTimeout(function(){alertMsg.close()},3500);}else{
  1223. $(this._bgId).show();}
  1224. $('<input type="text" style="width:0;height:0;" name="_alertFocusCtr"/>').appendTo(this._boxId).focus().hide();
  1225. var jButs=$(this._boxId).find("a.button");
  1226. var jCallButs=jButs.filter("[rel=callback]");
  1227. var jDoc=$(document);
  1228. for(var i=0;i<buttons.length;i++){
  1229. if(buttons[i].call)jCallButs.eq(i).click(buttons[i].call);
  1230. if(buttons[i].keyCode==DWZ.keyCode.ENTER){
  1231. jDoc.bind("keydown",{target:jButs.eq(i)},this._keydownOk);}
  1232. if(buttons[i].keyCode==DWZ.keyCode.ESC){
  1233. jDoc.bind("keydown",{target:jButs.eq(i)},this._keydownEsc);}}},
  1234. close:function(){
  1235. $(document).unbind("keydown",this._keydownOk).unbind("keydown",this._keydownEsc);
  1236. $(this._boxId).animate({top:-$(this._boxId).height()},500,function(){
  1237. $(this).remove();});
  1238. $(this._bgId).hide();},
  1239. error:function(msg,options){
  1240. this._alert(this._types.error,msg,options);},
  1241. info:function(msg,options){
  1242. this._alert(this._types.info,msg,options);},
  1243. warn:function(msg,options){
  1244. this._alert(this._types.warn,msg,options);},
  1245. correct:function(msg,options){
  1246. this._alert(this._types.correct,msg,options);},
  1247. _alert:function(type,msg,options){
  1248. var op={okName:$.regional.alertMsg.butMsg.ok,okCall:null};
  1249. $.extend(op,options);
  1250. var buttons=[{name:op.okName,call:op.okCall,keyCode:DWZ.keyCode.ENTER}];
  1251. this._open(type,msg,buttons);},
  1252. confirm:function(msg,options){
  1253. var op={okName:$.regional.alertMsg.butMsg.ok,okCall:null,cancelName:$.regional.alertMsg.butMsg.cancel,cancelCall:null};
  1254. $.extend(op,options);
  1255. var buttons=[{name:op.okName,call:op.okCall,keyCode:DWZ.keyCode.ENTER},{name:op.cancelName,call:op.cancelCall,keyCode:DWZ.keyCode.ESC}];
  1256. this._open(this._types.confirm,msg,buttons);}};(function($){
  1257. var menu,shadow,hash;
  1258. $.fn.extend({
  1259. contextMenu:function(id,options){
  1260. var op=$.extend({
  1261. shadow:true,
  1262. bindings:{},
  1263. ctrSub:null},options);
  1264. if(!menu){
  1265. menu=$('<div id="contextmenu"></div>').appendTo('body').hide();}
  1266. if(!shadow){
  1267. shadow=$('<div id="contextmenuShadow"></div>').appendTo('body').hide();}
  1268. hash=hash||[];
  1269. hash.push({
  1270. id:id,
  1271. shadow:op.shadow,
  1272. bindings:op.bindings||{},
  1273. ctrSub:op.ctrSub});
  1274. var index=hash.length-1;
  1275. $(this).bind('contextmenu',function(e){
  1276. display(index,this,e,op);
  1277. return false;});
  1278. return this;}});
  1279. function display(index,trigger,e,options){
  1280. var cur=hash[index];
  1281. var content=$(DWZ.frag[cur.id]);
  1282. content.find('li').hoverClass();
  1283. menu.html(content);
  1284. $.each(cur.bindings,function(id,func){
  1285. $("[rel='"+id+"']",menu).bind('click',function(e){
  1286. hide();
  1287. func($(trigger),$("#"+cur.id));});});
  1288. var posX=e.pageX;
  1289. var posY=e.pageY;
  1290. if($(window).width()<posX+menu.width())posX-=menu.width();
  1291. if($(window).height()<posY+menu.height())posY-=menu.height();
  1292. menu.css({'left':posX,'top':posY}).show();
  1293. if(cur.shadow)shadow.css({width:menu.width(),height:menu.height(),left:posX+3,top:posY+3}).show();
  1294. $(document).one('click',hide);
  1295. if($.isFunction(cur.ctrSub)){cur.ctrSub($(trigger),$("#"+cur.id));}}
  1296. function hide(){
  1297. menu.hide();
  1298. shadow.hide();}})(jQuery);
  1299. var navTab={
  1300. componentBox:null,
  1301. _tabBox:null,
  1302. _prevBut:null,
  1303. _nextBut:null,
  1304. _panelBox:null,
  1305. _moreBut:null,
  1306. _moreBox:null,
  1307. _currentIndex:0,
  1308. _op:{id:"navTab",stTabBox:".navTab-tab",stPanelBox:".navTab-panel",mainTabId:"main",close$:"a.close",prevClass:"tabsLeft",nextClass:"tabsRight",stMore:".tabsMore",stMoreLi:"ul.tabsMoreList"},
  1309. init:function(options){
  1310. if($.History)$.History.init("#container");
  1311. var $this=this;
  1312. $.extend(this._op,options);
  1313. this.componentBox=$("#"+this._op.id);
  1314. this._tabBox=this.componentBox.find(this._op.stTabBox);
  1315. this._panelBox=this.componentBox.find(this._op.stPanelBox);
  1316. this._prevBut=this.componentBox.find("."+this._op.prevClass);
  1317. this._nextBut=this.componentBox.find("."+this._op.nextClass);
  1318. this._moreBut=this.componentBox.find(this._op.stMore);
  1319. this._moreBox=this.componentBox.find(this._op.stMoreLi);
  1320. this._prevBut.click(function(event){$this._scrollPrev()});
  1321. this._nextBut.click(function(event){$this._scrollNext()});
  1322. this._moreBut.click(function(){
  1323. $this._moreBox.show();
  1324. return false;});
  1325. $(document).click(function(){$this._moreBox.hide()});
  1326. this._contextmenu(this._tabBox);
  1327. this._contextmenu(this._getTabs());
  1328. this._init();
  1329. this._ctrlScrollBut();},
  1330. _init:function(){
  1331. var $this=this;
  1332. this._getTabs().each(function(iTabIndex){
  1333. $(this).unbind("click").click(function(event){
  1334. $this._switchTab(iTabIndex);});
  1335. $(this).find(navTab._op.close$).unbind("click").click(function(){
  1336. $this._closeTab(iTabIndex);});});
  1337. this._getMoreLi().each(function(iTabIndex){
  1338. $(this).find(">a").unbind("click").click(function(event){
  1339. $this._switchTab(iTabIndex);});});
  1340. this._switchTab(this._currentIndex);},
  1341. _contextmenu:function($obj){
  1342. var $this=this;
  1343. $obj.contextMenu('navTabCM',{
  1344. bindings:{
  1345. reload:function(t,m){
  1346. $this._reload(t,true);},
  1347. closeCurrent:function(t,m){
  1348. var tabId=t.attr("tabid");
  1349. if(tabId)$this.closeTab(tabId);
  1350. else $this.closeCurrentTab();},
  1351. closeOther:function(t,m){
  1352. var index=$this._indexTabId(t.attr("tabid"));
  1353. $this._closeOtherTab(index>0?index:$this._currentIndex);},
  1354. closeAll:function(t,m){
  1355. $this.closeAllTab();}},
  1356. ctrSub:function(t,m){
  1357. var mReload=m.find("[rel='reload']");
  1358. var mCur=m.find("[rel='closeCurrent']");
  1359. var mOther=m.find("[rel='closeOther']");
  1360. var mAll=m.find("[rel='closeAll']");
  1361. var $tabLi=$this._getTabs();
  1362. if($tabLi.size()<2){
  1363. mCur.addClass("disabled");
  1364. mOther.addClass("disabled");
  1365. mAll.addClass("disabled");}
  1366. if($this._currentIndex==0||t.attr("tabid")==$this._op.mainTabId){
  1367. mCur.addClass("disabled");
  1368. mReload.addClass("disabled");}else if($tabLi.size()==2){
  1369. mOther.addClass("disabled");}}});},
  1370. _getTabs:function(){
  1371. return this._tabBox.find("> li");},
  1372. _getPanels:function(){
  1373. return this._panelBox.find("> div");},
  1374. _getMoreLi:function(){
  1375. return this._moreBox.find("> li");},
  1376. _getTab:function(tabid){
  1377. var index=this._indexTabId(tabid);
  1378. if(index>=0)return this._getTabs().eq(index);},
  1379. getPanel:function(tabid){
  1380. var index=this._indexTabId(tabid);
  1381. if(index>=0)return this._getPanels().eq(index);},
  1382. _getTabsW:function(iStart,iEnd){
  1383. return this._tabsW(this._getTabs().slice(iStart,iEnd));},
  1384. _tabsW:function($tabs){
  1385. var iW=0;
  1386. $tabs.each(function(){
  1387. iW+=$(this).outerWidth(true);});
  1388. return iW;},
  1389. _indexTabId:function(tabid){
  1390. if(!tabid)return -1;
  1391. var iOpenIndex=-1;
  1392. this._getTabs().each(function(index){
  1393. if($(this).attr("tabid")==tabid){iOpenIndex=index;return;}});
  1394. return iOpenIndex;},
  1395. _getLeft:function(){
  1396. return this._tabBox.position().left;},
  1397. _getScrollBarW:function(){
  1398. return this.componentBox.width()-55;},
  1399. _visibleStart:function(){
  1400. var iLeft=this._getLeft(),iW=0;
  1401. var $tabs=this._getTabs();
  1402. for(var i=0;i<$tabs.size();i++){
  1403. if(iW+iLeft>=0)return i;
  1404. iW+=$tabs.eq(i).outerWidth(true);}
  1405. return 0;},
  1406. _visibleEnd:function(){
  1407. var iLeft=this._getLeft(),iW=0;
  1408. var $tabs=this._getTabs();
  1409. for(var i=0;i<$tabs.size();i++){
  1410. iW+=$tabs.eq(i).outerWidth(true);
  1411. if(iW+iLeft>this._getScrollBarW())return i;}
  1412. return $tabs.size();},
  1413. _scrollPrev:function(){
  1414. var iStart=this._visibleStart();
  1415. if(iStart>0){
  1416. this._scrollTab(-this._getTabsW(0,iStart-1));}},
  1417. _scrollNext:function(){
  1418. var iEnd=this._visibleEnd();
  1419. if(iEnd<this._getTabs().size()){
  1420. this._scrollTab(-this._getTabsW(0,iEnd+1)+this._getScrollBarW());}},
  1421. _scrollTab:function(iLeft,isNext){
  1422. var $this=this;
  1423. this._tabBox.animate({left:iLeft+'px'},200,function(){$this._ctrlScrollBut();});},
  1424. _scrollCurrent:function(){
  1425. var iW=this._tabsW(this._getTabs());
  1426. if(iW<=this._getScrollBarW()){
  1427. this._scrollTab(0);}else if(this._getLeft()<this._getScrollBarW()-iW){
  1428. this._scrollTab(this._getScrollBarW()-iW);}else if(this._currentIndex<this._visibleStart()){
  1429. this._scrollTab(-this._getTabsW(0,this._currentIndex));}else if(this._currentIndex>=this._visibleEnd()){
  1430. this._scrollTab(this._getScrollBarW()-this._getTabs().eq(this._currentIndex).outerWidth(true)-this._getTabsW(0,this._currentIndex));}},
  1431. _ctrlScrollBut:function(){
  1432. var iW=this._tabsW(this._getTabs());
  1433. if(this._getScrollBarW()>iW){
  1434. this._prevBut.hide();
  1435. this._nextBut.hide();
  1436. this._tabBox.parent().removeClass("tabsPageHeaderMargin");}else{
  1437. this._prevBut.show().removeClass("tabsLeftDisabled");
  1438. this._nextBut.show().removeClass("tabsRightDisabled");
  1439. this._tabBox.parent().addClass("tabsPageHeaderMargin");
  1440. if(this._getLeft()>=0){
  1441. this._prevBut.addClass("tabsLeftDisabled");}else if(this._getLeft()<=this._getScrollBarW()-iW){
  1442. this._nextBut.addClass("tabsRightDisabled");}}},
  1443. _switchTab:function(iTabIndex){
  1444. var $tab=this._getTabs().removeClass("selected").eq(iTabIndex).addClass("selected");
  1445. this._getPanels().hide().eq(iTabIndex).show();
  1446. this._getMoreLi().removeClass("selected").eq(iTabIndex).addClass("selected");
  1447. this._currentIndex=iTabIndex;
  1448. this._scrollCurrent();
  1449. this._reload($tab);},
  1450. _closeTab:function(index,openTabid){
  1451. this._getTabs().eq(index).remove();
  1452. this._getPanels().eq(index).trigger(DWZ.eventType.pageClear).remove();
  1453. this._getMoreLi().eq(index).remove();
  1454. if(this._currentIndex>=index)this._currentIndex--;
  1455. if(openTabid){
  1456. var openIndex=this._indexTabId(openTabid);
  1457. if(openIndex>0)this._currentIndex=openIndex;}
  1458. this._init();
  1459. this._scrollCurrent();
  1460. this._reload(this._getTabs().eq(this._currentIndex));},
  1461. closeTab:function(tabid){
  1462. var index=this._indexTabId(tabid);
  1463. if(index>0){this._closeTab(index);}},
  1464. closeCurrentTab:function(openTabid){
  1465. if(this._currentIndex>0){this._closeTab(this._currentIndex,openTabid);}},
  1466. closeAllTab:function(){
  1467. this._getTabs().filter(":gt(0)").remove();
  1468. this._getPanels().filter(":gt(0)").trigger(DWZ.eventType.pageClear).remove();
  1469. this._getMoreLi().filter(":gt(0)").remove();
  1470. this._currentIndex=0;
  1471. this._init();
  1472. this._scrollCurrent();},
  1473. _closeOtherTab:function(index){
  1474. index=index||this._currentIndex;
  1475. if(index>0){
  1476. var str$=":eq("+index+")";
  1477. this._getTabs().not(str$).filter(":gt(0)").remove();
  1478. this._getPanels().not(str$).filter(":gt(0)").trigger(DWZ.eventType.pageClear).remove();
  1479. this._getMoreLi().not(str$).filter(":gt(0)").remove();
  1480. this._currentIndex=1;
  1481. this._init();
  1482. this._scrollCurrent();}else{
  1483. this.closeAllTab();}},
  1484. _loadUrlCallback:function($panel){
  1485. $panel.find("[layoutH]").layoutH();
  1486. $panel.find(":button.close").click(function(){
  1487. navTab.closeCurrentTab();});},
  1488. _reload:function($tab,flag){
  1489. flag=flag||$tab.data("reloadFlag");
  1490. var url=$tab.attr("url");
  1491. if(flag&&url){
  1492. $tab.data("reloadFlag",null);
  1493. var $panel=this.getPanel($tab.attr("tabid"));
  1494. if($tab.hasClass("external")){
  1495. navTab.openExternal(url,$panel);}else{
  1496. var $pagerForm=$("#pagerForm",$panel);
  1497. var args=$pagerForm.size()>0?$pagerForm.serializeArray():{}
  1498. $panel.loadUrl(url,args,function(){navTab._loadUrlCallback($panel);});}}},
  1499. reloadFlag:function(tabid){
  1500. var $tab=this._getTab(tabid);
  1501. if($tab){
  1502. if(this._indexTabId(tabid)==this._currentIndex)this._reload($tab,true);
  1503. else $tab.data("reloadFlag",1);}},
  1504. reload:function(url,options){
  1505. var op=$.extend({data:{},navTabId:"",callback:null},options);
  1506. var $tab=op.navTabId?this._getTab(op.navTabId):this._getTabs().eq(this._currentIndex);
  1507. var $panel=op.navTabId?this.getPanel(op.navTabId):this._getPanels().eq(this._currentIndex);
  1508. if($panel){
  1509. if(!url){
  1510. url=$tab.attr("url");}
  1511. if(url){
  1512. if($tab.hasClass("external")){
  1513. navTab.openExternal(url,$panel);}else{
  1514. if($.isEmptyObject(op.data)){
  1515. var $pagerForm=$("#pagerForm",$panel);
  1516. op.data=$pagerForm.size()>0?$pagerForm.serializeArray():{}}
  1517. $panel.ajaxUrl({
  1518. type:"POST",url:url,data:op.data,callback:function(response){
  1519. navTab._loadUrlCallback($panel);
  1520. if($.isFunction(op.callback))op.callback(response);}});}}}},
  1521. getCurrentPanel:function(){
  1522. return this._getPanels().eq(this._currentIndex);},
  1523. checkTimeout:function(){
  1524. var json=DWZ.jsonEval(this.getCurrentPanel().html());
  1525. if(json&&json.statusCode==DWZ.statusCode.timeout)this.closeCurrentTab();},
  1526. openExternal:function(url,$panel){
  1527. var ih=navTab._panelBox.height();
  1528. $panel.html(DWZ.frag["externalFrag"].replaceAll("{url}",url).replaceAll("{height}",ih+"px"));},
  1529. openTab:function(tabid,url,options){
  1530. var op=$.extend({title:"New Tab",data:{},fresh:true,external:false},options);
  1531. var iOpenIndex=this._indexTabId(tabid);
  1532. if(iOpenIndex>=0){
  1533. var $tab=this._getTabs().eq(iOpenIndex);
  1534. var span$=$tab.attr("tabid")==this._op.mainTabId?"> span > span":"> span";
  1535. $tab.find(">a").attr("title",op.title).find(span$).text(op.title);
  1536. var $panel=this._getPanels().eq(iOpenIndex);
  1537. if(op.fresh||$tab.attr("url")!=url){
  1538. $tab.attr("url",url);
  1539. if(op.external||url.isExternalUrl()){
  1540. $tab.addClass("external");
  1541. navTab.openExternal(url,$panel);}else{
  1542. $tab.removeClass("external");
  1543. $panel.ajaxUrl({
  1544. type:"GET",url:url,data:op.data,callback:function(){
  1545. navTab._loadUrlCallback($panel);}});}}
  1546. this._currentIndex=iOpenIndex;}else{
  1547. var tabFrag='<li tabid="#tabid#"><a href="javascript:" title="#title#" class="#tabid#"><span>#title#</span></a><a href="javascript:;" class="close">close</a></li>';
  1548. this._tabBox.append(tabFrag.replaceAll("#tabid#",tabid).replaceAll("#title#",op.title));
  1549. this._panelBox.append('<div class="page unitBox"></div>');
  1550. this._moreBox.append('<li><a href="javascript:" title="#title#">#title#</a></li>'.replaceAll("#title#",op.title));
  1551. var $tabs=this._getTabs();
  1552. var $tab=$tabs.filter(":last");
  1553. var $panel=this._getPanels().filter(":last");
  1554. if(op.external||url.isExternalUrl()){
  1555. $tab.addClass("external");
  1556. navTab.openExternal(url,$panel);}else{
  1557. $tab.removeClass("external");
  1558. $panel.ajaxUrl({
  1559. type:"GET",url:url,data:op.data,callback:function(){
  1560. navTab._loadUrlCallback($panel);}});}
  1561. if($.History){
  1562. setTimeout(function(){
  1563. $.History.addHistory(tabid,function(tabid){
  1564. var i=navTab._indexTabId(tabid);
  1565. if(i>=0)navTab._switchTab(i);},tabid);},10);}
  1566. this._currentIndex=$tabs.size()-1;
  1567. this._contextmenu($tabs.filter(":last").hoverClass("hover"));}
  1568. this._init();
  1569. this._scrollCurrent();
  1570. this._getTabs().eq(this._currentIndex).attr("url",url);}};(function($){
  1571. $.fn.extend({
  1572. tabs:function(options){
  1573. var op=$.extend({reverse:false,eventType:"click",currentIndex:0,stTabHeader:"> .tabsHeader",stTab:">.tabsHeaderContent>ul",stTabPanel:"> .tabsContent",ajaxClass:"j-ajax",closeClass:"close",prevClass:"tabsLeft",nextClass:"tabsRight"},options);
  1574. return this.each(function(){
  1575. initTab($(this));});
  1576. function initTab(jT){
  1577. var jSelector=jT.add($("> *",jT));
  1578. var jTabHeader=$(op.stTabHeader,jSelector);
  1579. var jTabs=$(op.stTab+" li",jTabHeader);
  1580. var jGroups=$(op.stTabPanel+" > *",jSelector);
  1581. jTabs.unbind().find("a").unbind();
  1582. jTabHeader.find("."+op.prevClass).unbind();
  1583. jTabHeader.find("."+op.nextClass).unbind();
  1584. jTabs.each(function(iTabIndex){
  1585. if(op.currentIndex==iTabIndex)$(this).addClass("selected");
  1586. else $(this).removeClass("selected");
  1587. if(op.eventType=="hover")$(this).hover(function(event){switchTab(jT,iTabIndex)});
  1588. else $(this).click(function(event){switchTab(jT,iTabIndex)});
  1589. $("a",this).each(function(){
  1590. if($(this).hasClass(op.ajaxClass)){
  1591. $(this).click(function(event){
  1592. var jGroup=jGroups.eq(iTabIndex);
  1593. if(this.href&&!jGroup.attr("loaded"))jGroup.loadUrl(this.href,{},function(){
  1594. jGroup.find("[layoutH]").layoutH();
  1595. jGroup.attr("loaded",true);});
  1596. event.preventDefault();});}else if($(this).hasClass(op.closeClass)){
  1597. $(this).click(function(event){
  1598. jTabs.eq(iTabIndex).remove();
  1599. jGroups.eq(iTabIndex).remove();
  1600. if(iTabIndex==op.currentIndex){
  1601. op.currentIndex=(iTabIndex+1<jTabs.size())?iTabIndex:iTabIndex-1;}else if(iTabIndex<op.currentIndex){
  1602. op.currentIndex=iTabIndex;}
  1603. initTab(jT);
  1604. return false;});}});});
  1605. switchTab(jT,op.currentIndex);}
  1606. function switchTab(jT,iTabIndex){
  1607. var jSelector=jT.add($("> *",jT));
  1608. var jTabHeader=$(op.stTabHeader,jSelector);
  1609. var jTabs=$(op.stTab+" li",jTabHeader);
  1610. var jGroups=$(op.stTabPanel+" > *",jSelector);
  1611. var jTab=jTabs.eq(iTabIndex);
  1612. var jGroup=jGroups.eq(iTabIndex);
  1613. if(op.reverse&&(jTab.hasClass("selected"))){
  1614. jTabs.removeClass("selected");
  1615. jGroups.hide();}else{
  1616. op.currentIndex=iTabIndex;
  1617. jTabs.removeClass("selected");
  1618. jTab.addClass("selected");
  1619. jGroups.hide().eq(op.currentIndex).show();}
  1620. if(!jGroup.attr("inited")){
  1621. jGroup.attr("inited",1000).find("input[type=text]").filter("[alt]").inputAlert();}}}});})(jQuery);(function($){
  1622. $.fn.extend({jresize:function(options){
  1623. if(typeof options=='string'){
  1624. if(options=='destroy')
  1625. return this.each(function(){
  1626. var dialog=this;
  1627. $("div[class^='resizable']",dialog).each(function(){
  1628. $(this).hide();});});}
  1629. return this.each(function(){
  1630. var dialog=$(this);
  1631. var resizable=$(".resizable");
  1632. $("div[class^='resizable']",dialog).each(function(){
  1633. var bar=this;
  1634. $(bar).mousedown(function(event){
  1635. $.pdialog.switchDialog(dialog);
  1636. $.resizeTool.start(resizable,dialog,event,$(bar).attr("tar"));
  1637. return false;}).show();});});}});
  1638. $.resizeTool={
  1639. start:function(resizable,dialog,e,target){
  1640. $.pdialog.initResize(resizable,dialog,target);
  1641. $.data(resizable[0],'layer-drag',{
  1642. options:$.extend($.pdialog._op,{target:target,dialog:dialog,stop:$.resizeTool.stop})});
  1643. $.layerdrag.start(resizable[0],e,$.pdialog._op);},
  1644. stop:function(){
  1645. var data=$.data(arguments[0],'layer-drag');
  1646. $.pdialog.resizeDialog(arguments[0],data.options.dialog,data.options.target);
  1647. $("body").css("cursor","");
  1648. $(arguments[0]).hide();}};
  1649. $.layerdrag={
  1650. start:function(obj,e,options){
  1651. if(!$.layerdrag.current){
  1652. $.layerdrag.current={
  1653. el:obj,
  1654. oleft:parseInt(obj.style.left)||0,
  1655. owidth:parseInt(obj.style.width)||0,
  1656. otop:parseInt(obj.style.top)||0,
  1657. oheight:parseInt(obj.style.height)||0,
  1658. ox:e.pageX||e.screenX,
  1659. oy:e.pageY||e.clientY};
  1660. $(document).bind('mouseup',$.layerdrag.stop);
  1661. $(document).bind('mousemove',$.layerdrag.drag);}
  1662. return $.layerdrag.preventEvent(e);},
  1663. drag:function(e){
  1664. if(!e)var e=window.event;
  1665. var current=$.layerdrag.current;
  1666. var data=$.data(current.el,'layer-drag');
  1667. var lmove=(e.pageX||e.screenX)-current.ox;
  1668. var tmove=(e.pageY||e.clientY)-current.oy;
  1669. if((e.pageY||e.clientY)<=0||(e.pageY||e.clientY)>=($(window).height()-$(".dialogHeader",$(data.options.dialog)).outerHeight()))return false;
  1670. var target=data.options.target;
  1671. var width=current.owidth;
  1672. var height=current.oheight;
  1673. if(target!="n"&&target!="s"){
  1674. width+=(target.indexOf("w")>=0)?-lmove:lmove;}
  1675. if(width>=$.pdialog._op.minW){
  1676. if(target.indexOf("w")>=0){
  1677. current.el.style.left=(current.oleft+lmove)+'px';}
  1678. if(target!="n"&&target!="s"){
  1679. current.el.style.width=width+'px';}}
  1680. if(target!="w"&&target!="e"){
  1681. height+=(target.indexOf("n")>=0)?-tmove:tmove;}
  1682. if(height>=$.pdialog._op.minH){
  1683. if(target.indexOf("n")>=0){
  1684. current.el.style.top=(current.otop+tmove)+'px';}
  1685. if(target!="w"&&target!="e"){
  1686. current.el.style.height=height+'px';}}
  1687. return $.layerdrag.preventEvent(e);},
  1688. stop:function(e){
  1689. var current=$.layerdrag.current;
  1690. var data=$.data(current.el,'layer-drag');
  1691. $(document).unbind('mousemove',$.layerdrag.drag);
  1692. $(document).unbind('mouseup',$.layerdrag.stop);
  1693. if(data.options.stop){
  1694. data.options.stop.apply(current.el,[current.el]);}
  1695. $.layerdrag.current=null;
  1696. return $.layerdrag.preventEvent(e);},
  1697. preventEvent:function(e){
  1698. if(e.stopPropagation)e.stopPropagation();
  1699. if(e.preventDefault)e.preventDefault();
  1700. return false;}};})(jQuery);(function($){
  1701. $.pdialog={
  1702. _op:{height:300,width:580,minH:40,minW:50,total:20,max:false,mask:false,resizable:true,drawable:true,maxable:true,minable:true,fresh:true},
  1703. _current:null,
  1704. _zIndex:42,
  1705. getCurrent:function(){
  1706. return this._current;},
  1707. reload:function(url,options){
  1708. var op=$.extend({data:{},dialogId:"",callback:null},options);
  1709. var dialog=(op.dialogId&&$("body").data(op.dialogId))||this._current;
  1710. if(dialog){
  1711. var jDContent=dialog.find(".dialogContent");
  1712. jDContent.ajaxUrl({
  1713. type:"POST",url:url,data:op.data,callback:function(response){
  1714. jDContent.find("[layoutH]").layoutH(jDContent);
  1715. $(".pageContent",dialog).width($(dialog).width()-14);
  1716. $(":button.close",dialog).click(function(){
  1717. $.pdialog.close(dialog);
  1718. return false;});
  1719. if($.isFunction(op.callback))op.callback(response);}});}},
  1720. open:function(url,dlgid,title,options){
  1721. var op=$.extend({},$.pdialog._op,options);
  1722. var dialog=$("body").data(dlgid);
  1723. if(dialog){
  1724. if(dialog.is(":hidden")){
  1725. dialog.show();}
  1726. if(op.fresh||url!=$(dialog).data("url")){
  1727. dialog.data("url",url);
  1728. dialog.find(".dialogHeader").find("h1").html(title);
  1729. this.switchDialog(dialog);
  1730. var jDContent=dialog.find(".dialogContent");
  1731. jDContent.loadUrl(url,{},function(){
  1732. jDContent.find("[layoutH]").layoutH(jDContent);
  1733. $(".pageContent",dialog).width($(dialog).width()-14);
  1734. $("button.close").click(function(){
  1735. $.pdialog.close(dialog);
  1736. return false;});});}}else{
  1737. $("body").append(DWZ.frag["dialogFrag"]);
  1738. dialog=$(">.dialog:last-child","body");
  1739. dialog.data("id",dlgid);
  1740. dialog.data("url",url);
  1741. if(options.close)dialog.data("close",options.close);
  1742. if(options.param)dialog.data("param",options.param);($.fn.bgiframe&&dialog.bgiframe());
  1743. dialog.find(".dialogHeader").find("h1").html(title);
  1744. $(dialog).css("zIndex",($.pdialog._zIndex+=2));
  1745. $("div.shadow").css("zIndex",$.pdialog._zIndex-3).show();
  1746. $.pdialog._init(dialog,options);
  1747. $(dialog).click(function(){
  1748. $.pdialog.switchDialog(dialog);});
  1749. if(op.resizable)
  1750. dialog.jresize();
  1751. if(op.drawable)
  1752. dialog.dialogDrag();
  1753. $("a.close",dialog).click(function(event){
  1754. $.pdialog.close(dialog);
  1755. return false;});
  1756. if(op.maxable){
  1757. $("a.maximize",dialog).show().click(function(event){
  1758. $.pdialog.switchDialog(dialog);
  1759. $.pdialog.maxsize(dialog);
  1760. dialog.jresize("destroy").dialogDrag("destroy");
  1761. return false;});}else{
  1762. $("a.maximize",dialog).hide();}
  1763. $("a.restore",dialog).click(function(event){
  1764. $.pdialog.restore(dialog);
  1765. dialog.jresize().dialogDrag();
  1766. return false;});
  1767. if(op.minable){
  1768. $("a.minimize",dialog).show().click(function(event){
  1769. $.pdialog.minimize(dialog);
  1770. return false;});}else{
  1771. $("a.minimize",dialog).hide();}
  1772. $("div.dialogHeader a",dialog).mousedown(function(){
  1773. return false;});
  1774. $("div.dialogHeader",dialog).dblclick(function(){
  1775. if($("a.restore",dialog).is(":hidden"))
  1776. $("a.maximize",dialog).trigger("click");
  1777. else
  1778. $("a.restore",dialog).trigger("click");});
  1779. if(op.max){
  1780. $.pdialog.maxsize(dialog);
  1781. dialog.jresize("destroy").dialogDrag("destroy");}
  1782. $("body").data(dlgid,dialog);
  1783. $.pdialog._current=dialog;
  1784. $.pdialog.attachShadow(dialog);
  1785. var jDContent=$(".dialogContent",dialog);
  1786. jDContent.loadUrl(url,{},function(){
  1787. jDContent.find("[layoutH]").layoutH(jDContent);
  1788. $(".pageContent",dialog).width($(dialog).width()-14);
  1789. $("button.close").click(function(){
  1790. $.pdialog.close(dialog);
  1791. return false;});});}
  1792. if(op.mask){
  1793. $(dialog).css("zIndex",1000);
  1794. $("a.minimize",dialog).hide();
  1795. $(dialog).data("mask",true);
  1796. $("#dialogBackground").show();}else{
  1797. if(op.minable)$.taskBar.addDialog(dlgid,title);}},
  1798. switchDialog:function(dialog){
  1799. var index=$(dialog).css("zIndex");
  1800. $.pdialog.attachShadow(dialog);
  1801. if($.pdialog._current){
  1802. var cindex=$($.pdialog._current).css("zIndex");
  1803. $($.pdialog._current).css("zIndex",index);
  1804. $(dialog).css("zIndex",cindex);
  1805. $("div.shadow").css("zIndex",cindex-1);
  1806. $.pdialog._current=dialog;}
  1807. $.taskBar.switchTask(dialog.data("id"));},
  1808. attachShadow:function(dialog){
  1809. var shadow=$("div.shadow");
  1810. if(shadow.is(":hidden"))shadow.show();
  1811. shadow.css({
  1812. top:parseInt($(dialog)[0].style.top)-2,
  1813. left:parseInt($(dialog)[0].style.left)-4,
  1814. height:parseInt($(dialog).height())+8,
  1815. width:parseInt($(dialog).width())+8,
  1816. zIndex:parseInt($(dialog).css("zIndex"))-1});
  1817. $(".shadow_c",shadow).children().andSelf().each(function(){
  1818. $(this).css("height",$(dialog).outerHeight()-4);});},
  1819. _init:function(dialog,options){
  1820. var op=$.extend({},this._op,options);
  1821. var height=op.height>op.minH?op.height:op.minH;
  1822. var width=op.width>op.minW?op.width:op.minW;
  1823. if(isNaN(dialog.height())||dialog.height()<height){
  1824. $(dialog).height(height+"px");
  1825. $(".dialogContent",dialog).height(height-$(".dialogHeader",dialog).outerHeight()-$(".dialogFooter",dialog).outerHeight()-6);}
  1826. if(isNaN(dialog.css("width"))||dialog.width()<width){
  1827. $(dialog).width(width+"px");}
  1828. var iTop=($(window).height()-dialog.height())/2;
  1829. dialog.css({
  1830. left:($(window).width()-dialog.width())/2,
  1831. top:iTop>0?iTop:0});},
  1832. initResize:function(resizable,dialog,target){
  1833. $("body").css("cursor",target+"-resize");
  1834. resizable.css({
  1835. top:$(dialog).css("top"),
  1836. left:$(dialog).css("left"),
  1837. height:$(dialog).css("height"),
  1838. width:$(dialog).css("width")});
  1839. resizable.show();},
  1840. repaint:function(target,options){
  1841. var shadow=$("div.shadow");
  1842. if(target!="w"&&target!="e"){
  1843. shadow.css("height",shadow.outerHeight()+options.tmove);
  1844. $(".shadow_c",shadow).children().andSelf().each(function(){
  1845. $(this).css("height",$(this).outerHeight()+options.tmove);});}
  1846. if(target=="n"||target=="nw"||target=="ne"){
  1847. shadow.css("top",options.otop-2);}
  1848. if(options.owidth&&(target!="n"||target!="s")){
  1849. shadow.css("width",options.owidth+8);}
  1850. if(target.indexOf("w")>=0){
  1851. shadow.css("left",options.oleft-4);}},
  1852. resizeTool:function(target,tmove,dialog){
  1853. $("div[class^='resizable']",dialog).filter(function(){
  1854. return $(this).attr("tar")=='w'||$(this).attr("tar")=='e';}).each(function(){
  1855. $(this).css("height",$(this).outerHeight()+tmove);});},
  1856. resizeDialog:function(obj,dialog,target){
  1857. var oleft=parseInt(obj.style.left);
  1858. var otop=parseInt(obj.style.top);
  1859. var height=parseInt(obj.style.height);
  1860. var width=parseInt(obj.style.width);
  1861. if(target=="n"||target=="nw"){
  1862. tmove=parseInt($(dialog).css("top"))-otop;}else{
  1863. tmove=height-parseInt($(dialog).css("height"));}
  1864. $(dialog).css({left:oleft,width:width,top:otop,height:height});
  1865. $(".dialogContent",dialog).css("width",(width-12)+"px");
  1866. $(".pageContent",dialog).css("width",(width-14)+"px");
  1867. if(target!="w"&&target!="e"){
  1868. var content=$(".dialogContent",dialog);
  1869. content.css({height:height-$(".dialogHeader",dialog).outerHeight()-$(".dialogFooter",dialog).outerHeight()-6});
  1870. content.find("[layoutH]").layoutH(content);
  1871. $.pdialog.resizeTool(target,tmove,dialog);}
  1872. $.pdialog.repaint(target,{oleft:oleft,otop:otop,tmove:tmove,owidth:width});
  1873. $(window).trigger(DWZ.eventType.resizeGrid);},
  1874. close:function(dialog){
  1875. if(typeof dialog=='string')dialog=$("body").data(dialog);
  1876. var close=dialog.data("close");
  1877. var go=true;
  1878. if(close&&$.isFunction(close)){
  1879. var param=dialog.data("param");
  1880. if(param&&param!=""){
  1881. param=DWZ.jsonEval(param);
  1882. go=close(param);}else{
  1883. go=close();}
  1884. if(!go)return;}
  1885. $(dialog).hide();
  1886. $("div.shadow").hide();
  1887. if($(dialog).data("mask")){
  1888. $("#dialogBackground").hide();}else{
  1889. if($(dialog).data("id"))$.taskBar.closeDialog($(dialog).data("id"));}
  1890. $("body").removeData($(dialog).data("id"));
  1891. $(dialog).trigger(DWZ.eventType.pageClear).remove();},
  1892. closeCurrent:function(){
  1893. this.close($.pdialog._current);},
  1894. checkTimeout:function(){
  1895. var $conetnt=$(".dialogContent",$.pdialog._current);
  1896. var json=DWZ.jsonEval($conetnt.html());
  1897. if(json&&json.statusCode==DWZ.statusCode.timeout)this.closeCurrent();},
  1898. maxsize:function(dialog){
  1899. $(dialog).data("original",{
  1900. top:$(dialog).css("top"),
  1901. left:$(dialog).css("left"),
  1902. width:$(dialog).css("width"),
  1903. height:$(dialog).css("height")});
  1904. $("a.maximize",dialog).hide();
  1905. $("a.restore",dialog).show();
  1906. var iContentW=$(window).width();
  1907. var iContentH=$(window).height()-34;
  1908. $(dialog).css({top:"0px",left:"0px",width:iContentW+"px",height:iContentH+"px"});
  1909. $.pdialog._resizeContent(dialog,iContentW,iContentH);},
  1910. restore:function(dialog){
  1911. var original=$(dialog).data("original");
  1912. var dwidth=parseInt(original.width);
  1913. var dheight=parseInt(original.height);
  1914. $(dialog).css({
  1915. top:original.top,
  1916. left:original.left,
  1917. width:dwidth,
  1918. height:dheight});
  1919. $.pdialog._resizeContent(dialog,dwidth,dheight);
  1920. $("a.maximize",dialog).show();
  1921. $("a.restore",dialog).hide();
  1922. $.pdialog.attachShadow(dialog);},
  1923. minimize:function(dialog){
  1924. $(dialog).hide();
  1925. $("div.shadow").hide();
  1926. var task=$.taskBar.getTask($(dialog).data("id"));
  1927. $(".resizable").css({
  1928. top:$(dialog).css("top"),
  1929. left:$(dialog).css("left"),
  1930. height:$(dialog).css("height"),
  1931. width:$(dialog).css("width")}).show().animate({top:$(window).height()-60,left:task.position().left,width:task.outerWidth(),height:task.outerHeight()},250,function(){
  1932. $(this).hide();
  1933. $.taskBar.inactive($(dialog).data("id"));});},
  1934. _resizeContent:function(dialog,width,height){
  1935. var content=$(".dialogContent",dialog);
  1936. content.css({width:(width-12)+"px",height:height-$(".dialogHeader",dialog).outerHeight()-$(".dialogFooter",dialog).outerHeight()-6});
  1937. content.find("[layoutH]").layoutH(content);
  1938. $(".pageContent",dialog).css("width",(width-14)+"px");
  1939. $(window).trigger(DWZ.eventType.resizeGrid);}};})(jQuery);(function($){
  1940. $.fn.dialogDrag=function(options){
  1941. if(typeof options=='string'){
  1942. if(options=='destroy')
  1943. return this.each(function(){
  1944. var dialog=this;
  1945. $("div.dialogHeader",dialog).unbind("mousedown");});}
  1946. return this.each(function(){
  1947. var dialog=$(this);
  1948. $("div.dialogHeader",dialog).mousedown(function(e){
  1949. $.pdialog.switchDialog(dialog);
  1950. dialog.data("task",true);
  1951. setTimeout(function(){
  1952. if(dialog.data("task"))$.dialogDrag.start(dialog,e);},100);
  1953. return false;}).mouseup(function(e){
  1954. dialog.data("task",false);
  1955. return false;});});};
  1956. $.dialogDrag={
  1957. currId:null,
  1958. _init:function(dialog){
  1959. this.currId=new Date().getTime();
  1960. var shadow=$("#dialogProxy");
  1961. if(!shadow.size()){
  1962. shadow=$(DWZ.frag["dialogProxy"]);
  1963. $("body").append(shadow);}
  1964. $("h1",shadow).html($(".dialogHeader h1",dialog).text());},
  1965. start:function(dialog,event){
  1966. this._init(dialog);
  1967. var sh=$("#dialogProxy");
  1968. sh.css({
  1969. left:dialog.css("left"),
  1970. top:dialog.css("top"),
  1971. height:dialog.css("height"),
  1972. width:dialog.css("width"),
  1973. zIndex:parseInt(dialog.css("zIndex"))+1}).show();
  1974. $("div.dialogContent",sh).css("height",$("div.dialogContent",dialog).css("height"));
  1975. sh.data("dialog",dialog);
  1976. dialog.css({left:"-10000px",top:"-10000px"});
  1977. $(".shadow").hide();
  1978. $(sh).jDrag({
  1979. selector:".dialogHeader",
  1980. stop:this.stop,
  1981. event:event});
  1982. return false;},
  1983. stop:function(){
  1984. var sh=$(arguments[0]);
  1985. var dialog=sh.data("dialog");
  1986. $(dialog).css({left:$(sh).css("left"),top:$(sh).css("top")});
  1987. $.pdialog.attachShadow(dialog);
  1988. $(sh).hide();}}})(jQuery);(function($){
  1989. var _op={
  1990. cursor:'move',
  1991. sortBoxs:'div.sortDrag',
  1992. replace:true,
  1993. items:'> *',
  1994. selector:'',
  1995. zIndex:1000};
  1996. var sortDrag={
  1997. start:function($sortBox,$item,event,op){
  1998. var $placeholder=this._createPlaceholder($item);
  1999. var $helper=$item.clone();
  2000. var position=$item.position();
  2001. $helper.data('$sortBox',$sortBox).data('op',op).data('$item',$item).data('$placeholder',$placeholder);
  2002. $helper.addClass('sortDragHelper').css({position:'absolute',top:position.top,left:position.left,zIndex:op.zIndex,width:$item.width()+'px',height:$item.height()+'px'}).jDrag({
  2003. selector:op.selector,
  2004. drag:this.drag,
  2005. stop:this.stop,
  2006. event:event});
  2007. $item.before($placeholder).before($helper).hide();
  2008. return false;},
  2009. drag:function(){
  2010. var $helper=$(arguments[0]),$sortBox=$helper.data('$sortBox'),$placeholder=$helper.data('$placeholder');
  2011. var $items=$sortBox.find($helper.data('op')['items']).filter(':visible').filter(':not(.sortDragPlaceholder, .sortDragHelper)');
  2012. var helperPos=$helper.position(),firstPos=$items.eq(0).position();
  2013. var $overBox=sortDrag._getOverSortBox($helper);
  2014. if($overBox.length>0&&$overBox[0]!=$sortBox[0]){
  2015. $placeholder.appendTo($overBox);
  2016. $helper.data('$sortBox',$overBox);}else{
  2017. for(var i=0;i<$items.length;i++){
  2018. var $this=$items.eq(i),position=$this.position();
  2019. if(helperPos.top>position.top+10){
  2020. $this.after($placeholder);}else if(helperPos.top<=position.top){
  2021. $this.before($placeholder);
  2022. break;}}}},
  2023. stop:function(){
  2024. var $helper=$(arguments[0]),$item=$helper.data('$item'),$placeholder=$helper.data('$placeholder');
  2025. var position=$placeholder.position();
  2026. $helper.animate({
  2027. top:position.top+"px",
  2028. left:position.left+"px"},{
  2029. complete:function(){
  2030. if($helper.data('op')['replace']){
  2031. $srcBox=$item.parents(_op.sortBoxs+":first");
  2032. $destBox=$placeholder.parents(_op.sortBoxs+":first");
  2033. if($srcBox[0]!=$destBox[0]){
  2034. $replaceItem=$placeholder.next();
  2035. if($replaceItem.size()>0){
  2036. $replaceItem.insertAfter($item);}}}
  2037. $item.insertAfter($placeholder).show();
  2038. $placeholder.remove();
  2039. $helper.remove();},
  2040. duration:300});},
  2041. _createPlaceholder:function($item){
  2042. return $('<'+$item[0].nodeName+' class="sortDragPlaceholder"/>').css({
  2043. width:$item.outerWidth()+'px',
  2044. height:$item.outerHeight()+'px',
  2045. marginTop:$item.css('marginTop'),
  2046. marginRight:$item.css('marginRight'),
  2047. marginBottom:$item.css('marginBottom'),
  2048. marginLeft:$item.css('marginLeft')});},
  2049. _getOverSortBox:function($item){
  2050. var itemPos=$item.position();
  2051. var y=itemPos.top+($item.height()/2), x = itemPos.left+($item.width()/2);
  2052. return $(_op.sortBoxs).filter(':visible').filter(function(){
  2053. var $sortBox=$(this),sortBoxPos=$sortBox.position();
  2054. return DWZ.isOver(y,x,sortBoxPos.top,sortBoxPos.left,$sortBox.height(),$sortBox.width());});}};
  2055. $.fn.sortDrag=function(options){
  2056. return this.each(function(){
  2057. var op=$.extend({},_op,options);
  2058. var $sortBox=$(this);
  2059. if($sortBox.attr('selector'))op.selector=$sortBox.attr('selector');
  2060. $sortBox.find(op.items).each(function(i){
  2061. var $item=$(this),$selector=$item;
  2062. if(op.selector){
  2063. $selector=$item.find(op.selector).css({cursor:op.cursor});}
  2064. $selector.mousedown(function(event){
  2065. sortDrag.start($sortBox,$item,event,op);
  2066. event.preventDefault();});});});}})(jQuery);(function($){
  2067. $.fn.extend({
  2068. cssTable:function(options){
  2069. return this.each(function(){
  2070. var $this=$(this);
  2071. var $trs=$this.find('tbody>tr');
  2072. var $grid=$this.parent();
  2073. var nowrap=$this.hasClass("nowrap");
  2074. $trs.hoverClass("hover").each(function(index){
  2075. var $tr=$(this);
  2076. if(!nowrap&&index%2==1)$tr.addClass("trbg");
  2077. $tr.click(function(){
  2078. $trs.filter(".selected").removeClass("selected");
  2079. $tr.addClass("selected");
  2080. var sTarget=$tr.attr("target");
  2081. if(sTarget){
  2082. if($("#"+sTarget,$grid).size()==0){
  2083. $grid.prepend('<input id="'+sTarget+'" type="hidden" />');}
  2084. $("#"+sTarget,$grid).val($tr.attr("rel"));}});});
  2085. $this.find("thead [orderField]").orderBy({
  2086. targetType:$this.attr("targetType"),
  2087. rel:$this.attr("rel"),
  2088. asc:$this.attr("asc")||"asc",
  2089. desc:$this.attr("desc")||"desc"});});}});})(jQuery);(function($){
  2090. $.fn.jTable=function(options){
  2091. return this.each(function(){
  2092. var $table=$(this),nowrapTD=$table.attr("nowrapTD");
  2093. var tlength=$table.width();
  2094. var aStyles=[];
  2095. var $tc=$table.parent().addClass("j-resizeGrid");
  2096. var layoutH=$(this).attr("layoutH");
  2097. var oldThs=$table.find("thead>tr:last-child").find("th");
  2098. for(var i=0,l=oldThs.size();i<l;i++){
  2099. var $th=$(oldThs[i]);
  2100. var style=[],width=$th.innerWidth()-(100*$th.innerWidth()/tlength)-2;
  2101. style[0]=parseInt(width);
  2102. style[1]=$th.attr("align");
  2103. aStyles[aStyles.length]=style;}
  2104. $(this).wrap("<div class='grid'></div>");
  2105. var $grid=$table.parent().html($table.html());
  2106. var thead=$grid.find("thead");
  2107. thead.wrap("<div class='gridHeader'><div class='gridThead'><table style='width:"+(tlength-20)+"px;'></table></div></div>");
  2108. var lastH=$(">tr:last-child",thead);
  2109. var ths=$(">th",lastH);
  2110. $("th",thead).each(function(){
  2111. var $th=$(this);
  2112. $th.html("<div class='gridCol' title='"+$th.text()+"'>"+$th.html()+"</div>");});
  2113. ths.each(function(i){
  2114. var $th=$(this),style=aStyles[i];
  2115. $th.addClass(style[1]).hoverClass("hover").removeAttr("align").removeAttr("width").width(style[0]);}).filter("[orderField]").orderBy({
  2116. targetType:$table.attr("targetType"),
  2117. rel:$table.attr("rel"),
  2118. asc:$table.attr("asc")||"asc",
  2119. desc:$table.attr("desc")||"desc"});
  2120. var tbody=$grid.find(">tbody");
  2121. var layoutStr=layoutH?" layoutH='"+layoutH+"'":"";
  2122. tbody.wrap("<div class='gridScroller'"+layoutStr+" style='width:"+$tc.width()+"px;'><div class='gridTbody'><table style='width:"+(tlength-20)+"px;'></table></div></div>");
  2123. var ftr=$(">tr:first-child",tbody);
  2124. var $trs=tbody.find('>tr');
  2125. $trs.hoverClass().each(function(){
  2126. var $tr=$(this);
  2127. var $ftds=$(">td",this);
  2128. for(var i=0;i<$ftds.size();i++){
  2129. var $ftd=$($ftds[i]);
  2130. if(nowrapTD!="false")$ftd.html("<div>"+$ftd.html()+"</div>");
  2131. if(i<aStyles.length)$ftd.addClass(aStyles[i][1]);}
  2132. $tr.click(function(){
  2133. $trs.filter(".selected").removeClass("selected");
  2134. $tr.addClass("selected");
  2135. var sTarget=$tr.attr("target");
  2136. if(sTarget){
  2137. if($("#"+sTarget,$grid).size()==0){
  2138. $grid.prepend('<input id="'+sTarget+'" type="hidden" />');}
  2139. $("#"+sTarget,$grid).val($tr.attr("rel"));}});});
  2140. $(">td",ftr).each(function(i){
  2141. if(i<aStyles.length)$(this).width(aStyles[i][0]);});
  2142. $grid.append("<div class='resizeMarker' style='height:300px; left:57px;display:none;'></div><div class='resizeProxy' style='height:300px; left:377px;display:none;'></div>");
  2143. var scroller=$(".gridScroller",$grid);
  2144. scroller.scroll(function(event){
  2145. var header=$(".gridThead",$grid);
  2146. if(scroller.scrollLeft()>0){
  2147. header.css("position","relative");
  2148. var scroll=scroller.scrollLeft();
  2149. header.css("left",scroller.cssv("left")-scroll);}
  2150. if(scroller.scrollLeft()==0){
  2151. header.css("position","relative");
  2152. header.css("left","0px");}
  2153. return false;});
  2154. $(">tr",thead).each(function(){
  2155. $(">th",this).each(function(i){
  2156. var th=this,$th=$(this);
  2157. $th.mouseover(function(event){
  2158. var offset=$.jTableTool.getOffset(th,event).offsetX;
  2159. if($th.outerWidth()-offset<5){
  2160. $th.css("cursor","col-resize").mousedown(function(event){
  2161. $(".resizeProxy",$grid).show().css({
  2162. left:$.jTableTool.getRight(th)-$(".gridScroller",$grid).scrollLeft(),
  2163. top:$.jTableTool.getTop(th),
  2164. height:$.jTableTool.getHeight(th,$grid),
  2165. cursor:"col-resize"});
  2166. $(".resizeMarker",$grid).show().css({
  2167. left:$.jTableTool.getLeft(th)+1-$(".gridScroller",$grid).scrollLeft(),
  2168. top:$.jTableTool.getTop(th),
  2169. height:$.jTableTool.getHeight(th,$grid)});
  2170. $(".resizeProxy",$grid).jDrag($.extend(options,{scop:true,cellMinW:20,relObj:$(".resizeMarker",$grid)[0],
  2171. move:"horizontal",
  2172. event:event,
  2173. stop:function(){
  2174. var pleft=$(".resizeProxy",$grid).position().left;
  2175. var mleft=$(".resizeMarker",$grid).position().left;
  2176. var move=pleft-mleft-$th.outerWidth()-9;
  2177. var cols=$.jTableTool.getColspan($th);
  2178. var cellNum=$.jTableTool.getCellNum($th);
  2179. var oldW=$th.width(),newW=$th.width()+move;
  2180. var $dcell=$(">td",ftr).eq(cellNum-1);
  2181. $th.width(newW+"px");
  2182. $dcell.width(newW+"px");
  2183. var $table1=$(thead).parent();
  2184. $table1.width(($table1.width()-oldW+newW)+"px");
  2185. var $table2=$(tbody).parent();
  2186. $table2.width(($table2.width()-oldW+newW)+"px");
  2187. $(".resizeMarker,.resizeProxy",$grid).hide();}}));});}else{
  2188. $th.css("cursor",$th.attr("orderField")?"pointer":"default");
  2189. $th.unbind("mousedown");}
  2190. return false;});});});
  2191. function _resizeGrid(){
  2192. $("div.j-resizeGrid").each(function(){
  2193. var width=$(this).innerWidth();
  2194. if(width){
  2195. $("div.gridScroller",this).width(width+"px");}});}
  2196. $(window).unbind(DWZ.eventType.resizeGrid).bind("resizeGrid",_resizeGrid);});};
  2197. $.jTableTool={
  2198. getLeft:function(obj){
  2199. var width=0;
  2200. $(obj).prevAll().each(function(){
  2201. width+=$(this).outerWidth();});
  2202. return width-1;},
  2203. getRight:function(obj){
  2204. var width=0;
  2205. $(obj).prevAll().andSelf().each(function(){
  2206. width+=$(this).outerWidth();});
  2207. return width-1;},
  2208. getTop:function(obj){
  2209. var height=0;
  2210. $(obj).parent().prevAll().each(function(){
  2211. height+=$(this).outerHeight();});
  2212. return height;},
  2213. getHeight:function(obj,parent){
  2214. var height=0;
  2215. var head=$(obj).parent();
  2216. head.nextAll().andSelf().each(function(){
  2217. height+=$(this).outerHeight();});
  2218. $(".gridTbody",parent).children().each(function(){
  2219. height+=$(this).outerHeight();});
  2220. return height;},
  2221. getCellNum:function(obj){
  2222. return $(obj).prevAll().andSelf().size();},
  2223. getColspan:function(obj){
  2224. return $(obj).attr("colspan")||1;},
  2225. getStart:function(obj){
  2226. var start=1;
  2227. $(obj).prevAll().each(function(){
  2228. start+=parseInt($(this).attr("colspan")||1);});
  2229. return start;},
  2230. getPageCoord:function(element){
  2231. var coord={x:0,y:0};
  2232. while(element){
  2233. coord.x+=element.offsetLeft;
  2234. coord.y+=element.offsetTop;
  2235. element=element.offsetParent;}
  2236. return coord;},
  2237. getOffset:function(obj,evt){
  2238. if($.browser.msie){
  2239. var objset=$(obj).offset();
  2240. var evtset={
  2241. offsetX:evt.pageX||evt.screenX,
  2242. offsetY:evt.pageY||evt.screenY};
  2243. var offset={
  2244. offsetX:evtset.offsetX-objset.left,
  2245. offsetY:evtset.offsetY-objset.top};
  2246. return offset;}
  2247. var target=evt.target;
  2248. if(target.offsetLeft==undefined){
  2249. target=target.parentNode;}
  2250. var pageCoord=$.jTableTool.getPageCoord(target);
  2251. var eventCoord={
  2252. x:window.pageXOffset+evt.clientX,
  2253. y:window.pageYOffset+evt.clientY};
  2254. var offset={
  2255. offsetX:eventCoord.x-pageCoord.x,
  2256. offsetY:eventCoord.y-pageCoord.y};
  2257. return offset;}};})(jQuery);(function($){
  2258. $.fn.extend({
  2259. jTask:function(options){
  2260. return this.each(function(){
  2261. var $task=$(this);
  2262. var id=$task.attr("id");
  2263. $task.click(function(e){
  2264. var dialog=$("body").data(id);
  2265. if($task.hasClass("selected")){
  2266. $("a.minimize",dialog).trigger("click");}else{
  2267. if(dialog.is(":hidden")){
  2268. $.taskBar.restoreDialog(dialog);}else
  2269. $(dialog).trigger("click");}
  2270. $.taskBar.scrollCurrent($(this));
  2271. return false;});
  2272. $("div.close",$task).click(function(e){
  2273. $.pdialog.close(id)
  2274. return false;}).hoverClass("closeHover");
  2275. $task.hoverClass("hover");});}});
  2276. $.taskBar={
  2277. _taskBar:null,
  2278. _taskBox:null,
  2279. _prevBut:null,
  2280. _nextBut:null,
  2281. _op:{id:"taskbar",taskBox:"div.taskbarContent",prevBut:".taskbarLeft",prevDis:"taskbarLeftDisabled",nextBut:".taskbarRight",nextDis:"taskbarRightDisabled",selected:"selected",boxMargin:"taskbarMargin"},
  2282. init:function(options){
  2283. var $this=this;
  2284. $.extend(this._op,options);
  2285. this._taskBar=$("#"+this._op.id);
  2286. if(this._taskBar.size()==0){
  2287. this._taskBar=$(DWZ.frag["taskbar"]).appendTo($("#layout"));
  2288. this._taskBar.find(".taskbarLeft").hoverClass("taskbarLeftHover");
  2289. this._taskBar.find(".taskbarRight").hoverClass("taskbarRightHover");}
  2290. this._taskBox=this._taskBar.find(this._op.taskBox);
  2291. this._taskList=this._taskBox.find(">ul");
  2292. this._prevBut=this._taskBar.find(this._op.prevBut);
  2293. this._nextBut=this._taskBar.find(this._op.nextBut);
  2294. this._prevBut.click(function(e){$this.scrollLeft()});
  2295. this._nextBut.click(function(e){$this.scrollRight()});
  2296. this._contextmenu(this._taskBox);},
  2297. _contextmenu:function(obj){
  2298. $(obj).contextMenu('dialogCM',{
  2299. bindings:{
  2300. closeCurrent:function(t,m){
  2301. var obj=t.isTag("li")?t:$.taskBar._getCurrent();
  2302. $("div.close",obj).trigger("click");},
  2303. closeOther:function(t,m){
  2304. var selector=t.isTag("li")?("#"+t.attr("id")):".selected";
  2305. var tasks=$.taskBar._taskList.find(">li:not(:"+selector+")");
  2306. tasks.each(function(i){
  2307. $("div.close",tasks[i]).trigger("click");});},
  2308. closeAll:function(t,m){
  2309. var tasks=$.taskBar._getTasks();
  2310. tasks.each(function(i){
  2311. $("div.close",tasks[i]).trigger("click");});}},
  2312. ctrSub:function(t,m){
  2313. var mCur=m.find("[rel='closeCurrent']");
  2314. var mOther=m.find("[rel='closeOther']");
  2315. if(!$.taskBar._getCurrent()[0]){
  2316. mCur.addClass("disabled");
  2317. mOther.addClass("disabled");}else{
  2318. if($.taskBar._getTasks().size()==1)
  2319. mOther.addClass("disabled");}}});},
  2320. _scrollCurrent:function(){
  2321. var iW=this._tasksW(this._getTasks());
  2322. if(iW>this._getTaskBarW()){
  2323. var $this=this;
  2324. var lTask=$(">li:last-child",this._taskList);
  2325. var left=this._getTaskBarW()-lTask.position().left-lTask.outerWidth(true);
  2326. this._taskList.animate({
  2327. left:left+'px'},200,function(){
  2328. $this._ctrlScrollBut();});}else{
  2329. this._ctrlScrollBut();}},
  2330. _getTaskBarW:function(){
  2331. return this._taskBox.width()-(this._prevBut.is(":hidden")?this._prevBut.width()+2:0)-(this._nextBut.is(":hidden")?this._nextBut.width()+2:0);},
  2332. _scrollTask:function(task){
  2333. var $this=this;
  2334. if(task.position().left+this._getLeft()+task.outerWidth()>this._getBarWidth()){
  2335. var left=this._getTaskBarW()-task.position().left-task.outerWidth(true)-2;
  2336. this._taskList.animate({left:left+'px'},200,function(){
  2337. $this._ctrlScrollBut();});}else if(task.position().left+this._getLeft()<0){
  2338. var left=this._getLeft()-(task.position().left+this._getLeft());
  2339. this._taskList.animate({left:left+'px'},200,function(){
  2340. $this._ctrlScrollBut();});}},
  2341. _ctrlScrollBut:function(){
  2342. var iW=this._tasksW(this._getTasks());
  2343. if(this._getTaskBarW()>iW){
  2344. this._taskBox.removeClass(this._op.boxMargin);
  2345. this._nextBut.hide();
  2346. this._prevBut.hide();
  2347. if(this._getTasks().eq(0)[0])this._scrollTask(this._getTasks().eq(0));}else{
  2348. this._taskBox.addClass(this._op.boxMargin);
  2349. this._nextBut.show().removeClass(this._op.nextDis);
  2350. this._prevBut.show().removeClass(this._op.prevDis);
  2351. if(this._getLeft()>=0){
  2352. this._prevBut.addClass(this._op.prevDis);}
  2353. if(this._getLeft()<=this._getTaskBarW()-iW){
  2354. this._nextBut.addClass(this._op.nextDis);}}},
  2355. _getLeft:function(){
  2356. return this._taskList.position().left;},
  2357. _visibleStart:function(){
  2358. var iLeft=this._getLeft();
  2359. var jTasks=this._getTasks();
  2360. for(var i=0;i<jTasks.size();i++){
  2361. if(jTasks.eq(i).position().left+jTasks.eq(i).outerWidth(true)+iLeft>=0)return jTasks.eq(i);}
  2362. return jTasks.eq(0);},
  2363. _visibleEnd:function(){
  2364. var iLeft=this._getLeft();
  2365. var jTasks=this._getTasks();
  2366. for(var i=0;i<jTasks.size();i++){
  2367. if(jTasks.eq(i).position().left+jTasks.eq(i).outerWidth(true)+iLeft>this._getBarWidth())return jTasks.eq(i);}
  2368. return jTasks.eq(jTasks.size()-1);},
  2369. _getTasks:function(){
  2370. return this._taskList.find(">li");},
  2371. _tasksW:function(jTasks){
  2372. var iW=0;
  2373. jTasks.each(function(){
  2374. iW+=$(this).outerWidth(true);});
  2375. return iW;},
  2376. _getBarWidth:function(){
  2377. return this._taskBar.innerWidth(true);},
  2378. addDialog:function(id,title){
  2379. this.show();
  2380. var task=$("#"+id,this._taskList);
  2381. if(!task[0]){
  2382. var taskFrag='<li id="#taskid#"><div class="taskbutton"><span>#title#</span></div><div class="close">Close</div></li>';
  2383. this._taskList.append(taskFrag.replace("#taskid#",id).replace("#title#",title));
  2384. task=$("#"+id,this._taskList);
  2385. task.jTask();}else{
  2386. $(">div>span",task).text(title);}
  2387. this._contextmenu(task);
  2388. this.switchTask(id);
  2389. this._scrollTask(task);},
  2390. closeDialog:function(obj){
  2391. var task=(typeof obj=='string')?$("#"+obj,this._taskList):obj;
  2392. task.remove();
  2393. if(this._getTasks().size()==0){
  2394. this.hide();}
  2395. this._scrollCurrent();},
  2396. restoreDialog:function(obj){
  2397. var dialog=(typeof obj=='string')?$("body").data(obj):obj;
  2398. var id=(typeof obj=='string')?obj:dialog.data("id");
  2399. var task=$.taskBar.getTask(id);
  2400. $(".resizable").css({top:$(window).height()-60,left:$(task).position().left,height:$(task).outerHeight(),width:$(task).outerWidth()}).show().animate({top:$(dialog).css("top"),left:$(dialog).css("left"),width:$(dialog).css("width"),height:$(dialog).css("height")},250,function(){
  2401. $(this).hide();
  2402. $(dialog).show();
  2403. $.pdialog.attachShadow(dialog);});
  2404. $.taskBar.switchTask(id);},
  2405. inactive:function(id){
  2406. $("#"+id,this._taskList).removeClass("selected");},
  2407. scrollLeft:function(){
  2408. var task=this._visibleStart();
  2409. this._scrollTask(task);},
  2410. scrollRight:function(){
  2411. var task=this._visibleEnd();
  2412. this._scrollTask(task);},
  2413. scrollCurrent:function(task){
  2414. this._scrollTask(task);},
  2415. switchTask:function(id){
  2416. this._getCurrent().removeClass("selected");
  2417. this.getTask(id).addClass("selected");},
  2418. _getCurrent:function(){
  2419. return this._taskList.find(">.selected");},
  2420. getTask:function(id){
  2421. return $("#"+id,this._taskList);},
  2422. show:function(){
  2423. if(this._taskBar.is(":hidden")){
  2424. this._taskBar.css("top",$(window).height()-34+this._taskBar.outerHeight()).show();
  2425. this._taskBar.animate({
  2426. top:$(window).height()-this._taskBar.outerHeight()},500);}},
  2427. hide:function(){
  2428. this._taskBar.animate({
  2429. top:$(window).height()-29+this._taskBar.outerHeight(true)},500,function(){
  2430. $.taskBar._taskBar.hide();});}}})(jQuery);
  2431. function validateCallback(form,callback,confirmMsg){
  2432. var $form=$(form);
  2433. if(!$form.valid()){
  2434. return false;}
  2435. var _submitFn=function(){
  2436. $.ajax({
  2437. type:form.method||'POST',
  2438. url:$form.attr("action"),
  2439. data:$form.serializeArray(),
  2440. dataType:"json",
  2441. cache:false,
  2442. success:callback||DWZ.ajaxDone,
  2443. error:DWZ.ajaxError});}
  2444. if(confirmMsg){
  2445. alertMsg.confirm(confirmMsg,{okCall:_submitFn});}else{
  2446. _submitFn();}
  2447. return false;}
  2448. function iframeCallback(form,callback){
  2449. var $form=$(form),$iframe=$("#callbackframe");
  2450. if(!$form.valid()){return false;}
  2451. if($iframe.size()==0){
  2452. $iframe=$("<iframe id='callbackframe' name='callbackframe' src='about:blank' style='display:none'></iframe>").appendTo("body");}
  2453. if(!form.ajax){
  2454. $form.append('<input type="hidden" name="ajax" value="1" />');}
  2455. form.target="callbackframe";
  2456. _iframeResponse($iframe[0],callback||DWZ.ajaxDone);}
  2457. function _iframeResponse(iframe,callback){
  2458. var $iframe=$(iframe),$document=$(document);
  2459. $document.trigger("ajaxStart");
  2460. $iframe.bind("load",function(event){
  2461. $iframe.unbind("load");
  2462. $document.trigger("ajaxStop");
  2463. if(iframe.src=="javascript:'%3Chtml%3E%3C/html%3E';"||
  2464. iframe.src=="javascript:'<html></html>';"){
  2465. return;}
  2466. var doc=iframe.contentDocument||iframe.document;
  2467. if(doc.readyState&&doc.readyState!='complete')return;
  2468. if(doc.body&&doc.body.innerHTML=="false")return;
  2469. var response;
  2470. if(doc.XMLDocument){
  2471. response=doc.XMLDocument;}else if(doc.body){
  2472. try{
  2473. response=$iframe.contents().find("body").text();
  2474. response=jQuery.parseJSON(response);}catch(e){
  2475. response=doc.body.innerHTML;}}else{
  2476. response=doc;}
  2477. callback(response);});}
  2478. function navTabAjaxDone(json){
  2479. DWZ.ajaxDone(json);
  2480. if(json.statusCode==DWZ.statusCode.ok){
  2481. if(json.navTabId){
  2482. navTab.reloadFlag(json.navTabId);}else{
  2483. var $pagerForm=$("#pagerForm",navTab.getCurrentPanel());
  2484. var args=$pagerForm.size()>0?$pagerForm.serializeArray():{}
  2485. navTabPageBreak(args,json.rel);}
  2486. if("closeCurrent"==json.callbackType){
  2487. setTimeout(function(){navTab.closeCurrentTab(json.navTabId);},100);}else if("forward"==json.callbackType){
  2488. navTab.reload(json.forwardUrl);}else if("forwardConfirm"==json.callbackType){
  2489. alertMsg.confirm(json.confirmMsg||DWZ.msg("forwardConfirmMsg"),{
  2490. okCall:function(){
  2491. navTab.reload(json.forwardUrl);}});}else{
  2492. navTab.getCurrentPanel().find(":input[initValue]").each(function(){
  2493. var initVal=$(this).attr("initValue");
  2494. $(this).val(initVal);});}}}
  2495. function dialogAjaxDone(json){
  2496. DWZ.ajaxDone(json);
  2497. if(json.statusCode==DWZ.statusCode.ok){
  2498. if(json.navTabId){
  2499. navTab.reload(json.forwardUrl,{navTabId:json.navTabId});}else if(json.rel){
  2500. var $pagerForm=$("#pagerForm",navTab.getCurrentPanel());
  2501. var args=$pagerForm.size()>0?$pagerForm.serializeArray():{}
  2502. navTabPageBreak(args,json.rel);}
  2503. if("closeCurrent"==json.callbackType){
  2504. $.pdialog.closeCurrent();}}}
  2505. function navTabSearch(form,navTabId){
  2506. var $form=$(form);
  2507. if(form[DWZ.pageInfo.pageNum])form[DWZ.pageInfo.pageNum].value=1;
  2508. navTab.reload($form.attr('action'),{data:$form.serializeArray(),navTabId:navTabId});
  2509. return false;}
  2510. function dialogSearch(form){
  2511. var $form=$(form);
  2512. if(form[DWZ.pageInfo.pageNum])form[DWZ.pageInfo.pageNum].value=1;
  2513. $.pdialog.reload($form.attr('action'),{data:$form.serializeArray()});
  2514. return false;}
  2515. function dwzSearch(form,targetType){
  2516. if(targetType=="dialog")dialogSearch(form);
  2517. else navTabSearch(form);
  2518. return false;}
  2519. function divSearch(form,rel){
  2520. var $form=$(form);
  2521. if(form[DWZ.pageInfo.pageNum])form[DWZ.pageInfo.pageNum].value=1;
  2522. if(rel){
  2523. var $box=$("#"+rel);
  2524. $box.ajaxUrl({
  2525. type:"POST",url:$form.attr("action"),data:$form.serializeArray(),callback:function(){
  2526. $box.find("[layoutH]").layoutH();}});}
  2527. return false;}
  2528. function _getPagerForm($parent,args){
  2529. var form=$("#pagerForm",$parent).get(0);
  2530. if(form){
  2531. if(args["pageNum"])form[DWZ.pageInfo.pageNum].value=args["pageNum"];
  2532. if(args["numPerPage"])form[DWZ.pageInfo.numPerPage].value=args["numPerPage"];
  2533. if(args["orderField"])form[DWZ.pageInfo.orderField].value=args["orderField"];
  2534. if(args["orderDirection"]&&form[DWZ.pageInfo.orderDirection])form[DWZ.pageInfo.orderDirection].value=args["orderDirection"];}
  2535. return form;}
  2536. function dwzPageBreak(options){
  2537. var op=$.extend({targetType:"navTab",rel:"",data:{pageNum:"",numPerPage:"",orderField:"",orderDirection:""},callback:null},options);
  2538. var $parent=op.targetType=="dialog"?$.pdialog.getCurrent():navTab.getCurrentPanel();
  2539. if(op.rel){
  2540. var $box=$parent.find("#"+op.rel);
  2541. var form=_getPagerForm($box,op.data);
  2542. if(form){
  2543. $box.ajaxUrl({
  2544. type:"POST",url:$(form).attr("action"),data:$(form).serializeArray(),callback:function(){
  2545. $box.find("[layoutH]").layoutH();}});}}else{
  2546. var form=_getPagerForm($parent,op.data);
  2547. var params=$(form).serializeArray();
  2548. if(op.targetType=="dialog"){
  2549. if(form)$.pdialog.reload($(form).attr("action"),{data:params,callback:op.callback});}else{
  2550. if(form)navTab.reload($(form).attr("action"),{data:params,callback:op.callback});}}}
  2551. function navTabPageBreak(args,rel){
  2552. dwzPageBreak({targetType:"navTab",rel:rel,data:args});}
  2553. function dialogPageBreak(args,rel){
  2554. dwzPageBreak({targetType:"dialog",rel:rel,data:args});}
  2555. function ajaxTodo(url,callback){
  2556. var $callback=callback||navTabAjaxDone;
  2557. if(!$.isFunction($callback))$callback=eval('('+callback+')');
  2558. $.ajax({
  2559. type:'POST',
  2560. url:url,
  2561. dataType:"json",
  2562. cache:false,
  2563. success:$callback,
  2564. error:DWZ.ajaxError});}
  2565. function uploadifyQueueComplete(queueData){
  2566. var msg="The total number of files uploaded: "+queueData.uploadsSuccessful+"<br/>"+"The total number of errors while uploading: "+queueData.uploadsErrored+"<br/>"+"The total number of bytes uploaded: "+queueData.queueBytesUploaded+"<br/>"+"The average speed of all uploaded files: "+queueData.averageSpeed;
  2567. if(queueData.uploadsErrored){
  2568. alertMsg.error(msg);}else{
  2569. alertMsg.correct(msg);}}
  2570. function uploadifySuccess(file,data,response){
  2571. alert(data)}
  2572. function uploadifyError(file,errorCode,errorMsg){
  2573. alertMsg.error(errorCode+": "+errorMsg);}
  2574. function uploadifyError(event,queueId,fileObj,errorObj){
  2575. alert("event:"+event+"\nqueueId:"+queueId+"\nfileObj.name:"+fileObj.name+"\nerrorObj.type:"+errorObj.type+"\nerrorObj.info:"+errorObj.info);}
  2576. $.fn.extend({
  2577. ajaxTodo:function(){
  2578. return this.each(function(){
  2579. var $this=$(this);
  2580. $this.click(function(event){
  2581. var url=unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
  2582. DWZ.debug(url);
  2583. if(!url.isFinishedTm()){
  2584. alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
  2585. return false;}
  2586. var title=$this.attr("title");
  2587. if(title){
  2588. alertMsg.confirm(title,{
  2589. okCall:function(){
  2590. ajaxTodo(url,$this.attr("callback"));}});}else{
  2591. ajaxTodo(url,$this.attr("callback"));}
  2592. event.preventDefault();});});},
  2593. dwzExport:function(){
  2594. function _doExport($this){
  2595. var $p=$this.attr("targetType")=="dialog"?$.pdialog.getCurrent():navTab.getCurrentPanel();
  2596. var $form=$("#pagerForm",$p);
  2597. var url=$this.attr("href");
  2598. window.location=url+(url.indexOf('?')==-1?"?":"&")+$form.serialize();}
  2599. return this.each(function(){
  2600. var $this=$(this);
  2601. $this.click(function(event){
  2602. var title=$this.attr("title");
  2603. if(title){
  2604. alertMsg.confirm(title,{
  2605. okCall:function(){_doExport($this);}});}else{_doExport($this);}
  2606. event.preventDefault();});});}});(function($){
  2607. $.fn.extend({
  2608. pagination:function(opts){
  2609. var setting={
  2610. first$:"li.j-first",prev$:"li.j-prev",next$:"li.j-next",last$:"li.j-last",nums$:"li.j-num>a",jumpto$:"li.jumpto",
  2611. pageNumFrag:'<li class="#liClass#"><a href="javascript:;">#pageNum#</a></li>'};
  2612. return this.each(function(){
  2613. var $this=$(this);
  2614. var pc=new Pagination(opts);
  2615. var interval=pc.getInterval();
  2616. var pageNumFrag='';
  2617. for(var i=interval.start;i<interval.end;i++){
  2618. pageNumFrag+=setting.pageNumFrag.replaceAll("#pageNum#",i).replaceAll("#liClass#",i==pc.getCurrentPage()?'selected j-num':'j-num');}
  2619. $this.html(DWZ.frag["pagination"].replaceAll("#pageNumFrag#",pageNumFrag).replaceAll("#currentPage#",pc.getCurrentPage())).find("li").hoverClass();
  2620. var $first=$this.find(setting.first$);
  2621. var $prev=$this.find(setting.prev$);
  2622. var $next=$this.find(setting.next$);
  2623. var $last=$this.find(setting.last$);
  2624. if(pc.hasPrev()){
  2625. $first.add($prev).find(">span").hide();
  2626. _bindEvent($prev,pc.getCurrentPage()-1,pc.targetType(),pc.rel());
  2627. _bindEvent($first,1,pc.targetType(),pc.rel());}else{
  2628. $first.add($prev).addClass("disabled").find(">a").hide();}
  2629. if(pc.hasNext()){
  2630. $next.add($last).find(">span").hide();
  2631. _bindEvent($next,pc.getCurrentPage()+1,pc.targetType(),pc.rel());
  2632. _bindEvent($last,pc.numPages(),pc.targetType(),pc.rel());}else{
  2633. $next.add($last).addClass("disabled").find(">a").hide();}
  2634. $this.find(setting.nums$).each(function(i){
  2635. _bindEvent($(this),i+interval.start,pc.targetType(),pc.rel());});
  2636. $this.find(setting.jumpto$).each(function(){
  2637. var $this=$(this);
  2638. var $inputBox=$this.find(":text");
  2639. var $button=$this.find(":button");
  2640. $button.click(function(event){
  2641. var pageNum=$inputBox.val();
  2642. if(pageNum&&pageNum.isPositiveInteger()){
  2643. dwzPageBreak({targetType:pc.targetType(),rel:pc.rel(),data:{pageNum:pageNum}});}});
  2644. $inputBox.keyup(function(event){
  2645. if(event.keyCode==DWZ.keyCode.ENTER)$button.click();});});});
  2646. function _bindEvent($target,pageNum,targetType,rel){
  2647. $target.bind("click",{pageNum:pageNum},function(event){
  2648. dwzPageBreak({targetType:targetType,rel:rel,data:{pageNum:event.data.pageNum}});
  2649. event.preventDefault();});}},
  2650. orderBy:function(options){
  2651. var op=$.extend({targetType:"navTab",rel:"",asc:"asc",desc:"desc"},options);
  2652. return this.each(function(){
  2653. var $this=$(this).css({cursor:"pointer"}).click(function(){
  2654. var orderField=$this.attr("orderField");
  2655. var orderDirection=$this.hasClass(op.asc)?op.desc:op.asc;
  2656. dwzPageBreak({targetType:op.targetType,rel:op.rel,data:{orderField:orderField,orderDirection:orderDirection}});});});},
  2657. pagerForm:function(options){
  2658. var op=$.extend({pagerForm$:"#pagerForm",parentBox:document},options);
  2659. var frag='<input type="hidden" name="#name#" value="#value#" />';
  2660. return this.each(function(){
  2661. var $searchForm=$(this),$pagerForm=$(op.pagerForm$,op.parentBox);
  2662. var actionUrl=$pagerForm.attr("action").replaceAll("#rel#",$searchForm.attr("action"));
  2663. $pagerForm.attr("action",actionUrl);
  2664. $searchForm.find(":input").each(function(){
  2665. var $input=$(this),name=$input.attr("name");
  2666. if(name&&(!$input.is(":checkbox,:radio")||$input.is(":checked"))){
  2667. if($pagerForm.find(":input[name='"+name+"']").length==0){
  2668. var inputFrag=frag.replaceAll("#name#",name).replaceAll("#value#",$input.val());
  2669. $pagerForm.append(inputFrag);}}});});}});
  2670. var Pagination=function(opts){
  2671. this.opts=$.extend({
  2672. targetType:"navTab",
  2673. rel:"",
  2674. totalCount:0,
  2675. numPerPage:10,
  2676. pageNumShown:10,
  2677. currentPage:1,
  2678. callback:function(){return false;}},opts);}
  2679. $.extend(Pagination.prototype,{
  2680. targetType:function(){return this.opts.targetType},
  2681. rel:function(){return this.opts.rel},
  2682. numPages:function(){
  2683. return Math.ceil(this.opts.totalCount/this.opts.numPerPage);},
  2684. getInterval:function(){
  2685. var ne_half=Math.ceil(this.opts.pageNumShown/2);
  2686. var np=this.numPages();
  2687. var upper_limit=np-this.opts.pageNumShown;
  2688. var start=this.getCurrentPage()>ne_half?Math.max(Math.min(this.getCurrentPage()-ne_half,upper_limit),0):0;
  2689. var end=this.getCurrentPage()>ne_half?Math.min(this.getCurrentPage()+ne_half,np):Math.min(this.opts.pageNumShown,np);
  2690. return{start:start+1,end:end+1};},
  2691. getCurrentPage:function(){
  2692. var currentPage=parseInt(this.opts.currentPage);
  2693. if(isNaN(currentPage))return 1;
  2694. return currentPage;},
  2695. hasPrev:function(){
  2696. return this.getCurrentPage()>1;},
  2697. hasNext:function(){
  2698. return this.getCurrentPage()<this.numPages();}});})(jQuery);(function($){
  2699. var _lookup={currentGroup:"",suffix:"",$target:null,pk:"id"};
  2700. var _util={
  2701. _lookupPrefix:function(key){
  2702. var strDot=_lookup.currentGroup?".":"";
  2703. return _lookup.currentGroup+strDot+key+_lookup.suffix;},
  2704. lookupPk:function(key){
  2705. return this._lookupPrefix(key);},
  2706. lookupField:function(key){
  2707. return this.lookupPk(key);}};
  2708. $.extend({
  2709. bringBackSuggest:function(args){
  2710. var $box=_lookup['$target'].parents(".unitBox:first");
  2711. $box.find(":input").each(function(){
  2712. var $input=$(this),inputName=$input.attr("name");
  2713. for(var key in args){
  2714. var name=(_lookup.pk==key)?_util.lookupPk(key):_util.lookupField(key);
  2715. if(name==inputName){
  2716. $input.val(args[key]);
  2717. break;}}});},
  2718. bringBack:function(args){
  2719. $.bringBackSuggest(args);
  2720. $.pdialog.closeCurrent();}});
  2721. $.fn.extend({
  2722. lookup:function(){
  2723. return this.each(function(){
  2724. var $this=$(this),options={mask:true,
  2725. width:$this.attr('width')||820,height:$this.attr('height')||400,
  2726. maxable:eval($this.attr("maxable")||"true"),
  2727. resizable:eval($this.attr("resizable")||"true")};
  2728. $this.click(function(event){
  2729. _lookup=$.extend(_lookup,{
  2730. currentGroup:$this.attr("lookupGroup")||"",
  2731. suffix:$this.attr("suffix")||"",
  2732. $target:$this,
  2733. pk:$this.attr("lookupPk")||"id"});
  2734. var url=unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
  2735. if(!url.isFinishedTm()){
  2736. alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
  2737. return false;}
  2738. $.pdialog.open(url,"_blank",$this.attr("title")||$this.text(),options);
  2739. return false;});});},
  2740. multLookup:function(){
  2741. return this.each(function(){
  2742. var $this=$(this),args={};
  2743. $this.click(function(event){
  2744. var $unitBox=$this.parents(".unitBox:first");
  2745. $unitBox.find("[name='"+$this.attr("multLookup")+"']").filter(":checked").each(function(){
  2746. var _args=DWZ.jsonEval($(this).val());
  2747. for(var key in _args){
  2748. var value=args[key]?args[key]+",":"";
  2749. args[key]=value+_args[key];}});
  2750. if($.isEmptyObject(args)){
  2751. alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
  2752. return false;}
  2753. $.bringBack(args);});});},
  2754. suggest:function(){
  2755. var op={suggest$:"#suggest",suggestShadow$:"#suggestShadow"};
  2756. var selectedIndex=-1;
  2757. return this.each(function(){
  2758. var $input=$(this).attr('autocomplete','off').keydown(function(event){
  2759. if(event.keyCode==DWZ.keyCode.ENTER&&$(op.suggest$).is(':visible'))return false;});
  2760. var suggestFields=$input.attr('suggestFields').split(",");
  2761. function _show(event){
  2762. var offset=$input.offset();
  2763. var iTop=offset.top+this.offsetHeight;
  2764. var $suggest=$(op.suggest$);
  2765. if($suggest.size()==0)$suggest=$('<div id="suggest"></div>').appendTo($('body'));
  2766. $suggest.css({
  2767. left:offset.left+'px',
  2768. top:iTop+'px'}).show();
  2769. _lookup=$.extend(_lookup,{
  2770. currentGroup:$input.attr("lookupGroup")||"",
  2771. suffix:$input.attr("suffix")||"",
  2772. $target:$input,
  2773. pk:$input.attr("lookupPk")||"id"});
  2774. var url=unescape($input.attr("suggestUrl")).replaceTmById($(event.target).parents(".unitBox:first"));
  2775. if(!url.isFinishedTm()){
  2776. alertMsg.error($input.attr("warn")||DWZ.msg("alertSelectMsg"));
  2777. return false;}
  2778. var postData={};
  2779. postData[$input.attr("postField")||"inputValue"]=$input.val();
  2780. $.ajax({
  2781. global:false,
  2782. type:'POST',dataType:"json",url:url,cache:false,
  2783. data:postData,
  2784. success:function(response){
  2785. if(!response)return;
  2786. var html='';
  2787. $.each(response,function(i){
  2788. var liAttr='',liLabel='';
  2789. for(var i=0;i<suggestFields.length;i++){
  2790. var str=this[suggestFields[i]];
  2791. if(str){
  2792. if(liLabel)liLabel+='-';
  2793. liLabel+=str;}}
  2794. for(var key in this){
  2795. if(liAttr)liAttr+=',';
  2796. liAttr+=key+":'"+this[key]+"'";}
  2797. html+='<li lookupAttrs="'+liAttr+'">'+liLabel+'</li>';});
  2798. var $lis=$suggest.html('<ul>'+html+'</ul>').find("li");
  2799. $lis.hoverClass("selected").click(function(){
  2800. _select($(this));});
  2801. if($lis.size()==1&&event.keyCode!=DWZ.keyCode.BACKSPACE){
  2802. _select($lis.eq(0));}else if($lis.size()==0){
  2803. var jsonStr="";
  2804. for(var i=0;i<suggestFields.length;i++){
  2805. if(_util.lookupField(suggestFields[i])==event.target.name){
  2806. break;}
  2807. if(jsonStr)jsonStr+=',';
  2808. jsonStr+=suggestFields[i]+":''";}
  2809. jsonStr="{"+_lookup.pk+":'',"+jsonStr+"}";
  2810. $.bringBackSuggest(DWZ.jsonEval(jsonStr));}},
  2811. error:function(){
  2812. $suggest.html('');}});
  2813. $(document).bind("click",_close);
  2814. return false;}
  2815. function _select($item){
  2816. var jsonStr="{"+$item.attr('lookupAttrs')+"}";
  2817. $.bringBackSuggest(DWZ.jsonEval(jsonStr));}
  2818. function _close(){
  2819. $(op.suggest$).html('').hide();
  2820. selectedIndex=-1;
  2821. $(document).unbind("click",_close);}
  2822. $input.focus(_show).click(false).keyup(function(event){
  2823. var $items=$(op.suggest$).find("li");
  2824. switch(event.keyCode){
  2825. case DWZ.keyCode.ESC:
  2826. case DWZ.keyCode.TAB:
  2827. case DWZ.keyCode.SHIFT:
  2828. case DWZ.keyCode.HOME:
  2829. case DWZ.keyCode.END:
  2830. case DWZ.keyCode.LEFT:
  2831. case DWZ.keyCode.RIGHT:
  2832. break;
  2833. case DWZ.keyCode.ENTER:
  2834. _close();
  2835. break;
  2836. case DWZ.keyCode.DOWN:
  2837. if(selectedIndex>=$items.size()-1)selectedIndex=-1;
  2838. else selectedIndex++;
  2839. break;
  2840. case DWZ.keyCode.UP:
  2841. if(selectedIndex<0)selectedIndex=$items.size()-1;
  2842. else selectedIndex--;
  2843. break;
  2844. default:
  2845. _show(event);}
  2846. $items.removeClass("selected");
  2847. if(selectedIndex>=0){
  2848. var $item=$items.eq(selectedIndex).addClass("selected");
  2849. _select($item);}});});},
  2850. itemDetail:function(){
  2851. return this.each(function(){
  2852. var $table=$(this).css("clear","both"),$tbody=$table.find("tbody");
  2853. var fields=[];
  2854. $table.find("tr:first th[type]").each(function(i){
  2855. var $th=$(this);
  2856. var field={
  2857. type:$th.attr("type")||"text",
  2858. patternDate:$th.attr("dateFmt")||"yyyy-MM-dd",
  2859. name:$th.attr("name")||"",
  2860. defaultVal:$th.attr("defaultVal")||"",
  2861. size:$th.attr("size")||"12",
  2862. enumUrl:$th.attr("enumUrl")||"",
  2863. lookupGroup:$th.attr("lookupGroup")||"",
  2864. lookupUrl:$th.attr("lookupUrl")||"",
  2865. lookupPk:$th.attr("lookupPk")||"id",
  2866. suggestUrl:$th.attr("suggestUrl"),
  2867. suggestFields:$th.attr("suggestFields"),
  2868. postField:$th.attr("postField")||"",
  2869. fieldClass:$th.attr("fieldClass")||"",
  2870. fieldAttrs:$th.attr("fieldAttrs")||""};
  2871. fields.push(field);});
  2872. $tbody.find("a.btnDel").click(function(){
  2873. var $btnDel=$(this);
  2874. if($btnDel.is("[href^=javascript:]")){
  2875. $btnDel.parents("tr:first").remove();
  2876. initSuffix($tbody);
  2877. return false;}
  2878. function delDbData(){
  2879. $.ajax({
  2880. type:'POST',dataType:"json",url:$btnDel.attr('href'),cache:false,
  2881. success:function(){
  2882. $btnDel.parents("tr:first").remove();
  2883. initSuffix($tbody);},
  2884. error:DWZ.ajaxError});}
  2885. if($btnDel.attr("title")){
  2886. alertMsg.confirm($btnDel.attr("title"),{okCall:delDbData});}else{
  2887. delDbData();}
  2888. return false;});
  2889. var addButTxt=$table.attr('addButton')||"Add New";
  2890. if(addButTxt){
  2891. var $addBut=$('<div class="button"><div class="buttonContent"><button type="button">'+addButTxt+'</button></div></div>').insertBefore($table).find("button");
  2892. var $rowNum=$('<input type="text" name="dwz_rowNum" class="textInput" style="margin:2px;" value="1" size="2"/>').insertBefore($table);
  2893. var trTm="";
  2894. $addBut.click(function(){
  2895. if(!trTm)trTm=trHtml(fields);
  2896. var rowNum=1;
  2897. try{rowNum=parseInt($rowNum.val())}catch(e){}
  2898. for(var i=0;i<rowNum;i++){
  2899. var $tr=$(trTm);
  2900. $tr.appendTo($tbody).initUI().find("a.btnDel").click(function(){
  2901. $(this).parents("tr:first").remove();
  2902. initSuffix($tbody);
  2903. return false;});}
  2904. initSuffix($tbody);});}});
  2905. function initSuffix($tbody){
  2906. $tbody.find('>tr').each(function(i){
  2907. $(':input, a.btnLook, a.btnAttach',this).each(function(){
  2908. var $this=$(this),name=$this.attr('name'),val=$this.val();
  2909. if(name)$this.attr('name',name.replaceSuffix(i));
  2910. var lookupGroup=$this.attr('lookupGroup');
  2911. if(lookupGroup){$this.attr('lookupGroup',lookupGroup.replaceSuffix(i));}
  2912. var suffix=$this.attr("suffix");
  2913. if(suffix){$this.attr('suffix',suffix.replaceSuffix(i));}
  2914. if(val&&val.indexOf("#index#")>=0)$this.val(val.replace('#index#',i+1));});});}
  2915. function tdHtml(field){
  2916. var html='',suffix='';
  2917. if(field.name.endsWith("[#index#]"))suffix="[#index#]";
  2918. else if(field.name.endsWith("[]"))suffix="[]";
  2919. var suffixFrag=suffix?' suffix="'+suffix+'" ':'';
  2920. var attrFrag='';
  2921. if(field.fieldAttrs){
  2922. var attrs=DWZ.jsonEval(field.fieldAttrs);
  2923. for(var key in attrs){
  2924. attrFrag+=key+'="'+attrs[key]+'"';}}
  2925. switch(field.type){
  2926. case 'del':
  2927. html='<a href="javascript:void(0)" class="btnDel '+field.fieldClass+'">删除</a>';
  2928. break;
  2929. case 'lookup':
  2930. var suggestFrag='';
  2931. if(field.suggestFields){
  2932. suggestFrag='autocomplete="off" lookupGroup="'+field.lookupGroup+'"'+suffixFrag+' suggestUrl="'+field.suggestUrl+'" suggestFields="'+field.suggestFields+'"'+' postField="'+field.postField+'"';}
  2933. html='<input type="hidden" name="'+field.lookupGroup+'.'+field.lookupPk+suffix+'"/>'+'<input type="text" name="'+field.name+'"'+suggestFrag+' lookupPk="'+field.lookupPk+'" size="'+field.size+'" class="'+field.fieldClass+'"/>'+'<a class="btnLook" href="'+field.lookupUrl+'" lookupGroup="'+field.lookupGroup+'" '+suggestFrag+' lookupPk="'+field.lookupPk+'" title="查找带回">查找带回</a>';
  2934. break;
  2935. case 'attach':
  2936. html='<input type="hidden" name="'+field.lookupGroup+'.'+field.lookupPk+suffix+'"/>'+'<input type="text" name="'+field.name+'" size="'+field.size+'" readonly="readonly" class="'+field.fieldClass+'"/>'+'<a class="btnAttach" href="'+field.lookupUrl+'" lookupGroup="'+field.lookupGroup+'" '+suggestFrag+' lookupPk="'+field.lookupPk+'" width="560" height="300" title="查找带回">查找带回</a>';
  2937. break;
  2938. case 'enum':
  2939. $.ajax({
  2940. type:"POST",dataType:"html",async:false,
  2941. url:field.enumUrl,
  2942. data:{inputName:field.name},
  2943. success:function(response){
  2944. html=response;}});
  2945. break;
  2946. case 'date':
  2947. html='<input type="text" name="'+field.name+'" value="'+field.defaultVal+'" class="date '+field.fieldClass+'" dateFmt="'+field.patternDate+'" size="'+field.size+'"/>'+'<a class="inputDateButton" href="javascript:void(0)">选择</a>';
  2948. break;
  2949. default:
  2950. html='<input type="text" name="'+field.name+'" value="'+field.defaultVal+'" size="'+field.size+'" class="'+field.fieldClass+'" '+attrFrag+'/>';
  2951. break;}
  2952. return '<td>'+html+'</td>';}
  2953. function trHtml(fields){
  2954. var html='';
  2955. $(fields).each(function(){
  2956. html+=tdHtml(this);});
  2957. return '<tr class="unitBox">'+html+'</tr>';}},
  2958. selectedTodo:function(){
  2959. function _getIds(selectedIds,targetType){
  2960. var ids="";
  2961. var $box=targetType=="dialog"?$.pdialog.getCurrent():navTab.getCurrentPanel();
  2962. $box.find("input:checked").filter("[name='"+selectedIds+"']").each(function(i){
  2963. var val=$(this).val();
  2964. ids+=i==0?val:","+val;});
  2965. return ids;}
  2966. return this.each(function(){
  2967. var $this=$(this);
  2968. var selectedIds=$this.attr("rel")||"ids";
  2969. var postType=$this.attr("postType")||"map";
  2970. $this.click(function(){
  2971. var targetType=$this.attr("targetType");
  2972. var ids=_getIds(selectedIds,targetType);
  2973. if(!ids){
  2974. alertMsg.error($this.attr("warn")||DWZ.msg("alertSelectMsg"));
  2975. return false;}
  2976. var _callback=$this.attr("callback")||(targetType=="dialog"?dialogAjaxDone:navTabAjaxDone);
  2977. if(!$.isFunction(_callback))_callback=eval('('+_callback+')');
  2978. function _doPost(){
  2979. $.ajax({
  2980. type:'POST',url:$this.attr('href'),dataType:'json',cache:false,
  2981. data:function(){
  2982. if(postType=='map'){
  2983. return $.map(ids.split(','),function(val,i){
  2984. return{name:selectedIds,value:val};})}else{
  2985. var _data={};
  2986. _data[selectedIds]=ids;
  2987. return _data;}}(),
  2988. success:_callback,
  2989. error:DWZ.ajaxError});}
  2990. var title=$this.attr("title");
  2991. if(title){
  2992. alertMsg.confirm(title,{okCall:_doPost});}else{
  2993. _doPost();}
  2994. return false;});});}});})(jQuery);(function($){
  2995. $.setRegional("datepicker",{
  2996. dayNames:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
  2997. monthNames:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']});
  2998. $.fn.datepicker=function(opts){
  2999. var setting={
  3000. box$:"#calendar",
  3001. year$:"#calendar [name=year]",month$:"#calendar [name=month]",
  3002. tmInputs$:"#calendar .time :text",hour$:"#calendar .time .hh",minute$:"#calendar .time .mm",second$:"#calendar .time .ss",
  3003. tmBox$:"#calendar .tm",tmUp$:"#calendar .time .up",tmDown$:"#calendar .time .down",
  3004. close$:"#calendar .close",calIcon$:"a.inputDateButton",
  3005. main$:"#calendar .main",days$:"#calendar .days",dayNames$:"#calendar .dayNames",
  3006. clearBut$:"#calendar .clearBut",okBut$:"#calendar .okBut"};
  3007. function changeTmMenu(sltClass){
  3008. var $tm=$(setting.tmBox$);
  3009. $tm.removeClass("hh").removeClass("mm").removeClass("ss");
  3010. if(sltClass){
  3011. $tm.addClass(sltClass);
  3012. $(setting.tmInputs$).removeClass("slt").filter("."+sltClass).addClass("slt");}}
  3013. function clickTmMenu($input,type){
  3014. $(setting.tmBox$).find("."+type+" li").each(function(){
  3015. var $li=$(this);
  3016. $li.click(function(){
  3017. $input.val($li.text());});});}
  3018. function keydownInt(e){
  3019. if(!((e.keyCode>=48&&e.keyCode<=57)||(e.keyCode==DWZ.keyCode.DELETE||e.keyCode==DWZ.keyCode.BACKSPACE))){return false;}}
  3020. function changeTm($input,type){
  3021. var ivalue=parseInt($input.val()),istart=parseInt($input.attr("start"))||0,iend=parseInt($input.attr("end"));
  3022. var istep=parseInt($input.attr('step')||1);
  3023. if(type==1){
  3024. if(ivalue<=iend-istep){$input.val(ivalue+istep);}}else if(type==-1){
  3025. if(ivalue>=istart+istep){$input.val(ivalue-istep);}}else if(ivalue>iend){
  3026. $input.val(iend);}else if(ivalue<istart){
  3027. $input.val(istart);}}
  3028. return this.each(function(){
  3029. var $this=$(this);
  3030. var dp=new Datepicker($this.val(),opts);
  3031. function generateCalendar(dp){
  3032. var dw=dp.getDateWrap();
  3033. var minDate=dp.getMinDate();
  3034. var maxDate=dp.getMaxDate();
  3035. var monthStart=new Date(dw.year,dw.month-1,1);
  3036. var startDay=monthStart.getDay();
  3037. var dayStr="";
  3038. if(startDay>0){
  3039. monthStart.setMonth(monthStart.getMonth()-1);
  3040. var prevDateWrap=dp.getDateWrap(monthStart);
  3041. for(var t=prevDateWrap.days-startDay+1;t<=prevDateWrap.days;t++){
  3042. var _date=new Date(dw.year,dw.month-2,t);
  3043. var _ctrClass=(_date>=minDate&&_date<=maxDate)?'':'disabled';
  3044. dayStr+='<dd class="other '+_ctrClass+'" chMonth="-1" day="'+t+'">'+t+'</dd>';}}
  3045. for(var t=1;t<=dw.days;t++){
  3046. var _date=new Date(dw.year,dw.month-1,t);
  3047. var _ctrClass=(_date>=minDate&&_date<=maxDate)?'':'disabled';
  3048. if(t==dw.day){
  3049. dayStr+='<dd class="slt '+_ctrClass+'" day="'+t+'">'+t+'</dd>';}else{
  3050. dayStr+='<dd class="'+_ctrClass+'" day="'+t+'">'+t+'</dd>';}}
  3051. for(var t=1;t<=42-startDay-dw.days;t++){
  3052. var _date=new Date(dw.year,dw.month,t);
  3053. var _ctrClass=(_date>=minDate&&_date<=maxDate)?'':'disabled';
  3054. dayStr+='<dd class="other '+_ctrClass+'" chMonth="1" day="'+t+'">'+t+'</dd>';}
  3055. var $days=$(setting.days$).html(dayStr).find("dd");
  3056. $days.not('.disabled').click(function(){
  3057. var $day=$(this);
  3058. if(!dp.hasTime()){
  3059. $this.val(dp.formatDate(dp.changeDay($day.attr("day"),$day.attr("chMonth"))));
  3060. closeCalendar();}else{
  3061. $days.removeClass("slt");
  3062. $day.addClass("slt");}});
  3063. if(!dp.hasDate())$(setting.main$).addClass('nodate');
  3064. if(dp.hasTime()){
  3065. $("#calendar .time").show();
  3066. var $hour=$(setting.hour$).val(dw.hour).focus(function(){
  3067. changeTmMenu("hh");});
  3068. var iMinute=parseInt(dw.minute/dp.opts.mmStep)*dp.opts.mmStep;
  3069. var $minute=$(setting.minute$).val(iMinute).attr('step',dp.opts.mmStep).focus(function(){
  3070. changeTmMenu("mm");});
  3071. var $second=$(setting.second$).val(dp.hasSecond()?dw.second:0).attr('step',dp.opts.ssStep).focus(function(){
  3072. changeTmMenu("ss");});
  3073. $hour.add($minute).add($second).click(function(){return false});
  3074. clickTmMenu($hour,"hh");
  3075. clickTmMenu($minute,"mm");
  3076. clickTmMenu($second,"ss");
  3077. $(setting.box$).click(function(){
  3078. changeTmMenu();});
  3079. var $inputs=$(setting.tmInputs$);
  3080. $inputs.keydown(keydownInt).each(function(){
  3081. var $input=$(this);
  3082. $input.keyup(function(){
  3083. changeTm($input,0);});});
  3084. $(setting.tmUp$).click(function(){
  3085. $inputs.filter(".slt").each(function(){
  3086. changeTm($(this),1);});});
  3087. $(setting.tmDown$).click(function(){
  3088. $inputs.filter(".slt").each(function(){
  3089. changeTm($(this),-1);});});
  3090. if(!dp.hasHour())$hour.attr("disabled",true);
  3091. if(!dp.hasMinute())$minute.attr("disabled",true);
  3092. if(!dp.hasSecond())$second.attr("disabled",true);}}
  3093. function closeCalendar(){
  3094. $(setting.box$).remove();
  3095. $(document).unbind("click",closeCalendar);}
  3096. $this.click(function(event){
  3097. closeCalendar();
  3098. var dp=new Datepicker($this.val(),opts);
  3099. var offset=$this.offset();
  3100. var iTop=offset.top+this.offsetHeight;
  3101. $(DWZ.frag['calendarFrag']).appendTo("body").css({
  3102. left:offset.left+'px',
  3103. top:iTop+'px'}).show().click(function(event){
  3104. event.stopPropagation();});($.fn.bgiframe&&$(setting.box$).bgiframe());
  3105. var dayNames="";
  3106. $.each($.regional.datepicker.dayNames,function(i,v){
  3107. dayNames+="<dt>"+v+"</dt>"});
  3108. $(setting.dayNames$).html(dayNames);
  3109. var dw=dp.getDateWrap();
  3110. var $year=$(setting.year$);
  3111. var yearstart=dp.getMinDate().getFullYear();
  3112. var yearend=dp.getMaxDate().getFullYear();
  3113. for(y=yearstart;y<=yearend;y++){
  3114. $year.append('<option value="'+y+'"'+(dw.year==y?'selected="selected"':'')+'>'+y+'</option>');}
  3115. var $month=$(setting.month$);
  3116. $.each($.regional.datepicker.monthNames,function(i,v){
  3117. var m=i+1;
  3118. $month.append('<option value="'+m+'"'+(dw.month==m?'selected="selected"':'')+'>'+v+'</option>');});
  3119. generateCalendar(dp);
  3120. $year.add($month).change(function(){
  3121. dp.changeDate($year.val(),$month.val());
  3122. generateCalendar(dp);});
  3123. var iBoxH=$(setting.box$).outerHeight(true);
  3124. if(iTop>iBoxH&&iTop>$(window).height()-iBoxH){
  3125. $(setting.box$).css("top",offset.top-iBoxH);}
  3126. $(setting.close$).click(function(){
  3127. closeCalendar();});
  3128. $(setting.clearBut$).click(function(){
  3129. $this.val("");
  3130. closeCalendar();});
  3131. $(setting.okBut$).click(function(){
  3132. var $dd=$(setting.days$).find("dd.slt");
  3133. if($dd.hasClass("disabled"))return false;
  3134. var date=dp.changeDay($dd.attr("day"),$dd.attr("chMonth"));
  3135. if(dp.hasTime()){
  3136. date.setHours(parseInt($(setting.hour$).val()));
  3137. date.setMinutes(parseInt($(setting.minute$).val()));
  3138. date.setSeconds(parseInt($(setting.second$).val()));}
  3139. $this.val(dp.formatDate(date));
  3140. closeCalendar();});
  3141. $(document).bind("click",closeCalendar);
  3142. return false;});
  3143. $this.parent().find(setting.calIcon$).click(function(){
  3144. $this.trigger("click");
  3145. return false;});});}
  3146. var Datepicker=function(sDate,opts){
  3147. this.opts=$.extend({
  3148. pattern:'yyyy-MM-dd',
  3149. minDate:"1900-01-01",
  3150. maxDate:"2099-12-31",
  3151. mmStep:1,
  3152. ssStep:1},opts);
  3153. var now=new Date();
  3154. this.opts.minDate=now.formatDateTm(this.opts.minDate);
  3155. this.opts.maxDate=now.formatDateTm(this.opts.maxDate);
  3156. this.sDate=sDate.trim();}
  3157. $.extend(Datepicker.prototype,{
  3158. get:function(name){
  3159. return this.opts[name];},
  3160. _getDays:function(y,m){
  3161. return m==2?(y%4||!(y%100)&&y%400?28:29):(/4|6|9|11/.test(m)?30:31);},
  3162. _minMaxDate:function(sDate){
  3163. var _count=sDate.split('-').length-1;
  3164. var _format='y-M-d';
  3165. if(_count==1)_format='y-M';
  3166. else if(_count==0)_format='y';
  3167. return sDate.parseDate(_format);},
  3168. getMinDate:function(){
  3169. return this._minMaxDate(this.opts.minDate);},
  3170. getMaxDate:function(){
  3171. var _sDate=this.opts.maxDate;
  3172. var _count=_sDate.split('-').length-1;
  3173. var _date=this._minMaxDate(_sDate);
  3174. if(_count<2){
  3175. var _day=this._getDays(_date.getFullYear(),_date.getMonth()+1);
  3176. _date.setDate(_day);
  3177. if(_count==0){
  3178. _date.setMonth(11);}}
  3179. return _date;},
  3180. getDateWrap:function(date){
  3181. if(!date)date=this.parseDate(this.sDate)||new Date();
  3182. var y=date.getFullYear();
  3183. var m=date.getMonth()+1;
  3184. var days=this._getDays(y,m);
  3185. return{
  3186. year:y,month:m,day:date.getDate(),
  3187. hour:date.getHours(),minute:date.getMinutes(),second:date.getSeconds(),
  3188. days:days,date:date}},
  3189. changeDate:function(y,m,d){
  3190. var date=new Date(y,m-1,d||1);
  3191. this.sDate=this.formatDate(date);
  3192. return date;},
  3193. changeDay:function(day,chMonth){
  3194. if(!chMonth)chMonth=0;
  3195. var dw=this.getDateWrap();
  3196. return this.changeDate(dw.year,dw.month+parseInt(chMonth),day);},
  3197. parseDate:function(sDate){
  3198. if(!sDate)return null;
  3199. return sDate.parseDate(this.opts.pattern);},
  3200. formatDate:function(date){
  3201. return date.formatDate(this.opts.pattern);},
  3202. hasHour:function(){
  3203. return this.opts.pattern.indexOf("H")!=-1;},
  3204. hasMinute:function(){
  3205. return this.opts.pattern.indexOf("m")!=-1;},
  3206. hasSecond:function(){
  3207. return this.opts.pattern.indexOf("s")!=-1;},
  3208. hasTime:function(){
  3209. return this.hasHour()||this.hasMinute()||this.hasSecond();},
  3210. hasDate:function(){
  3211. var _dateKeys=['y','M','d','E'];
  3212. for(var i=0;i<_dateKeys.length;i++){
  3213. if(this.opts.pattern.indexOf(_dateKeys[i])!=-1)return true;}
  3214. return false;}});})(jQuery);(function($){
  3215. $.extend($.fn,{
  3216. jBlindUp:function(options){
  3217. var op=$.extend({duration:500,easing:"swing",call:function(){}},options);
  3218. return this.each(function(){
  3219. var $this=$(this);
  3220. $(this).animate({height:0},{
  3221. step:function(){},
  3222. duration:op.duration,
  3223. easing:op.easing,
  3224. complete:function(){
  3225. $this.css({display:"none"});
  3226. op.call();}});});},
  3227. jBlindDown:function(options){
  3228. var op=$.extend({to:0,duration:500,easing:"swing",call:function(){}},options);
  3229. return this.each(function(){
  3230. var $this=$(this);
  3231. var fixedPanelHeight=(op.to>0)?op.to:$.effect.getDimensions($this[0]).height;
  3232. $this.animate({height:fixedPanelHeight},{
  3233. step:function(){},
  3234. duration:op.duration,
  3235. easing:op.easing,
  3236. complete:function(){
  3237. $this.css({display:""});
  3238. op.call();}});});},
  3239. jSlideUp:function(options){
  3240. var op=$.extend({to:0,duration:500,easing:"swing",call:function(){}},options);
  3241. return this.each(function(){
  3242. var $this=$(this);
  3243. $this.wrapInner("<div></div>");
  3244. var fixedHeight=(op.to>0)?op.to:$.effect.getDimensions($(">div",$this)[0]).height;
  3245. $this.css({overflow:"visible",position:"relative"});
  3246. $(">div",$this).css({position:"relative"}).animate({top:-fixedHeight},{
  3247. easing:op.easing,
  3248. duration:op.duration,
  3249. complete:function(){$this.html($(this).html());}});});},
  3250. jSlideDown:function(options){
  3251. var op=$.extend({to:0,duration:500,easing:"swing",call:function(){}},options);
  3252. return this.each(function(){
  3253. var $this=$(this);
  3254. var fixedHeight=(op.to>0)?op.to:$.effect.getDimensions($this[0]).height;
  3255. $this.wrapInner("<div style=\"top:-" + fixedHeight + "px;\"></div>");
  3256. $this.css({overflow:"visible",position:"relative",height:"0px"})
  3257. .animate({height:fixedHeight},{
  3258. duration:op.duration,
  3259. easing:op.easing,
  3260. complete:function(){$this.css({display:"",overflow:""});op.call();}});
  3261. $(">div",$this).css({position:"relative"}).animate({top:0},{
  3262. easing:op.easing,
  3263. duration:op.duration,
  3264. complete:function(){$this.html($(this).html());}});});}});
  3265. $.effect={
  3266. getDimensions:function(element,displayElement){
  3267. var dimensions=new $.effect.Rectangle;
  3268. var displayOrig=$(element).css('display');
  3269. var visibilityOrig=$(element).css('visibility');
  3270. var isZero=$(element).height()==0?true:false;
  3271. if($(element).is(":hidden")){
  3272. $(element).css({visibility:'hidden',display:'block'});
  3273. if(isZero)$(element).css("height","");
  3274. if($.browser.opera)
  3275. refElement.focus();}
  3276. dimensions.height=$(element).outerHeight();
  3277. dimensions.width=$(element).outerWidth();
  3278. if(displayOrig=='none'){
  3279. $(element).css({visibility:visibilityOrig,display:'none'});
  3280. if(isZero)if(isZero)$(element).css("height","0px");}
  3281. return dimensions;}}
  3282. $.effect.Rectangle=function(){
  3283. this.width=0;
  3284. this.height=0;
  3285. this.unit="px";}})(jQuery);(function($){
  3286. $.extend($.fn,{
  3287. jPanel:function(options){
  3288. var op=$.extend({header:"panelHeader",headerC:"panelHeaderContent",content:"panelContent",coll:"collapsable",exp:"expandable",footer:"panelFooter",footerC:"panelFooterContent"},options);
  3289. return this.each(function(){
  3290. var $panel=$(this);
  3291. var close=$panel.hasClass("close");
  3292. var collapse=$panel.hasClass("collapse");
  3293. var $content=$(">div",$panel).addClass(op.content);
  3294. var title=$(">h1",$panel).wrap('<div class="'+op.header+'"><div class="'+op.headerC+'"></div></div>');
  3295. if(collapse)$("<a href=\"\"></a>").addClass(close?op.exp:op.coll).insertAfter(title);
  3296. var header=$(">div:first",$panel);
  3297. var footer=$('<div class="'+op.footer+'"><div class="'+op.footerC+'"></div></div>').appendTo($panel);
  3298. var defaultH=$panel.attr("defH")?$panel.attr("defH"):0;
  3299. var minH=$panel.attr("minH")?$panel.attr("minH"):0;
  3300. if(close)
  3301. $content.css({
  3302. height:"0px",
  3303. display:"none"});
  3304. else{
  3305. if(defaultH>0)
  3306. $content.height(defaultH+"px");
  3307. else if(minH>0){
  3308. $content.css("minHeight",minH+"px");}}
  3309. if(!collapse)return;
  3310. var $pucker=$("a",header);
  3311. var inH=$content.innerHeight()-6;
  3312. if(minH>0&&minH>=inH)defaultH=minH;
  3313. else defaultH=inH;
  3314. $pucker.click(function(){
  3315. if($pucker.hasClass(op.exp)){
  3316. $content.jBlindDown({to:defaultH,call:function(){
  3317. $pucker.removeClass(op.exp).addClass(op.coll);
  3318. if(minH>0)$content.css("minHeight",minH+"px");}});}else{
  3319. if(minH>0)$content.css("minHeight","");
  3320. if(minH>=inH)$content.css("height",minH+"px");
  3321. $content.jBlindUp({call:function(){
  3322. $pucker.removeClass(op.coll).addClass(op.exp);}});}
  3323. return false;});});}});})(jQuery);(function($){
  3324. $.fn.extend({
  3325. checkboxCtrl:function(parent){
  3326. return this.each(function(){
  3327. var $trigger=$(this);
  3328. $trigger.click(function(){
  3329. var group=$trigger.attr("group");
  3330. if($trigger.is(":checkbox")){
  3331. var type=$trigger.is(":checked")?"all":"none";
  3332. if(group)$.checkbox.select(group,type,parent);}else{
  3333. if(group)$.checkbox.select(group,$trigger.attr("selectType")||"all",parent);}});});}});
  3334. $.checkbox={
  3335. selectAll:function(_name,_parent){
  3336. this.select(_name,"all",_parent);},
  3337. unSelectAll:function(_name,_parent){
  3338. this.select(_name,"none",_parent);},
  3339. selectInvert:function(_name,_parent){
  3340. this.select(_name,"invert",_parent);},
  3341. select:function(_name,_type,_parent){
  3342. $parent=$(_parent||document);
  3343. $checkboxLi=$parent.find(":checkbox[name='"+_name+"']");
  3344. switch(_type){
  3345. case "invert":
  3346. $checkboxLi.each(function(){
  3347. $checkbox=$(this);
  3348. $checkbox.attr('checked',!$checkbox.is(":checked"));});
  3349. break;
  3350. case "none":
  3351. $checkboxLi.attr('checked',false);
  3352. break;
  3353. default:
  3354. $checkboxLi.attr('checked',true);
  3355. break;}}};})(jQuery);(function($){
  3356. var allSelectBox=[];
  3357. var killAllBox=function(bid){
  3358. $.each(allSelectBox,function(i){
  3359. if(allSelectBox[i]!=bid){
  3360. if(!$("#"+allSelectBox[i])[0]){
  3361. $("#op_"+allSelectBox[i]).remove();}else{
  3362. $("#op_"+allSelectBox[i]).css({height:"",width:""}).hide();}
  3363. $(document).unbind("click",killAllBox);}});};
  3364. $.extend($.fn,{
  3365. comboxSelect:function(options){
  3366. var op=$.extend({selector:">a"},options);
  3367. return this.each(function(){
  3368. var box=$(this);
  3369. var selector=$(op.selector,box);
  3370. allSelectBox.push(box.attr("id"));
  3371. $(op.selector,box).click(function(){
  3372. var options=$("#op_"+box.attr("id"));
  3373. if(options.is(":hidden")){
  3374. if(options.height()>300){
  3375. options.css({height:"300px",overflow:"scroll"});}
  3376. var top=box.offset().top+box[0].offsetHeight-50;
  3377. if(top+options.height()>$(window).height()-20){
  3378. top=$(window).height()-20-options.height();}
  3379. options.css({top:top,left:box.offset().left}).show();
  3380. killAllBox(box.attr("id"));
  3381. $(document).click(killAllBox);}else{
  3382. $(document).unbind("click",killAllBox);
  3383. killAllBox();}
  3384. return false;});
  3385. $("#op_"+box.attr("id")).find(">li").comboxOption(selector,box);});},
  3386. comboxOption:function(selector,box){
  3387. return this.each(function(){
  3388. $(">a",this).click(function(){
  3389. var $this=$(this);
  3390. $this.parent().parent().find(".selected").removeClass("selected");
  3391. $this.addClass("selected");
  3392. selector.text($this.text());
  3393. var $input=$("select",box);
  3394. if($input.val()!=$this.attr("value")){
  3395. $("select",box).val($this.attr("value")).trigger("change");}});});},
  3396. combox:function(){
  3397. var _selectBox=[];
  3398. $.each(allSelectBox,function(i){
  3399. if($("#"+allSelectBox[i])[0]){
  3400. _selectBox.push(allSelectBox[i]);}else{
  3401. $("#op_"+allSelectBox[i]).remove();}});
  3402. allSelectBox=_selectBox;
  3403. return this.each(function(i){
  3404. var $this=$(this).removeClass("combox");
  3405. var name=$this.attr("name");
  3406. var value=$this.val();
  3407. var label=$("option[value="+value+"]",$this).text();
  3408. var ref=$this.attr("ref");
  3409. var refUrl=$this.attr("refUrl")||"";
  3410. var cid=$this.attr("id")||Math.round(Math.random()*10000000);
  3411. var select='<div class="combox"><div id="combox_'+cid+'" class="select"'+(ref?' ref="'+ref+'"':'')+'>';
  3412. select+='<a href="javascript:" class="'+$this.attr("class")+'" name="'+name+'" value="'+value+'">'+label+'</a></div></div>';
  3413. var options='<ul class="comboxop" id="op_combox_'+cid+'">';
  3414. $("option",$this).each(function(){
  3415. var option=$(this);
  3416. options+="<li><a class=\""+ (value==option[0].value?"selected":"") +"\" href=\"#\" value=\"" + option[0].value + "\">"+option[0].text+"</a></li>";});
  3417. options+="</ul>";
  3418. $("body").append(options);
  3419. $this.after(select);
  3420. $("div.select",$this.next()).comboxSelect().append($this);
  3421. if(ref&&refUrl){
  3422. function _onchange(event){
  3423. var $ref=$("#"+ref);
  3424. if($ref.size()==0)return false;
  3425. $.ajax({
  3426. type:'POST',dataType:"json",url:refUrl.replace("{value}",encodeURIComponent($this.attr("value"))),cache:false,
  3427. data:{},
  3428. success:function(json){
  3429. if(!json)return;
  3430. var html='';
  3431. $.each(json,function(i){
  3432. if(json[i]&&json[i].length>1){
  3433. html+='<option value="'+json[i][0]+'">'+json[i][1]+'</option>';}});
  3434. var $refCombox=$ref.parents("div.combox:first");
  3435. $ref.html(html).insertAfter($refCombox);
  3436. $refCombox.remove();
  3437. $ref.trigger("change").combox();},
  3438. error:DWZ.ajaxError});}
  3439. $this.unbind("change",_onchange).bind("change",_onchange);}});}});})(jQuery);(function($){
  3440. $.extend({
  3441. History:{
  3442. _hash:new Array(),
  3443. _cont:undefined,
  3444. _currentHash:"",
  3445. _callback:undefined,
  3446. init:function(cont,callback){
  3447. $.History._cont=cont;
  3448. $.History._callback=callback;
  3449. var current_hash=location.hash.replace(/\?.*$/,'');
  3450. $.History._currentHash=current_hash;
  3451. if($.browser.msie){
  3452. if($.History._currentHash==''){
  3453. $.History._currentHash='#';}
  3454. $("body").append('<iframe id="jQuery_history" style="display: none;" src="about:blank"></iframe>');
  3455. var ihistory=$("#jQuery_history")[0];
  3456. var iframe=ihistory.contentDocument||ihistory.contentWindow.document;
  3457. iframe.open();
  3458. iframe.close();
  3459. iframe.location.hash=current_hash;}
  3460. if($.isFunction(this._callback))
  3461. $.History._callback(current_hash.skipChar("#"));
  3462. setInterval($.History._historyCheck,100);},
  3463. _historyCheck:function(){
  3464. var current_hash="";
  3465. if($.browser.msie){
  3466. var ihistory=$("#jQuery_history")[0];
  3467. var iframe=ihistory.contentWindow;
  3468. current_hash=iframe.location.hash.skipChar("#").replace(/\?.*$/,'');}else{
  3469. current_hash=location.hash.skipChar('#').replace(/\?.*$/,'');}
  3470. if(current_hash!=$.History._currentHash){
  3471. $.History._currentHash=current_hash;
  3472. $.History.loadHistory(current_hash);}},
  3473. addHistory:function(hash,fun,args){
  3474. $.History._currentHash=hash;
  3475. var history=[hash,fun,args];
  3476. $.History._hash.push(history);
  3477. if($.browser.msie){
  3478. var ihistory=$("#jQuery_history")[0];
  3479. var iframe=ihistory.contentDocument||ihistory.contentWindow.document;
  3480. iframe.open();
  3481. iframe.close();
  3482. iframe.location.hash=hash.replace(/\?.*$/,'');
  3483. location.hash=hash.replace(/\?.*$/,'');}else{
  3484. location.hash=hash.replace(/\?.*$/,'');}},
  3485. loadHistory:function(hash){
  3486. if($.browser.msie){
  3487. location.hash=hash;}
  3488. for(var i=0;i<$.History._hash.length;i+=1){
  3489. if($.History._hash[i][0]==hash){
  3490. $.History._hash[i][1]($.History._hash[i][2]);
  3491. return;}}}}});})(jQuery);(function($){
  3492. $.printBox=function(rel){
  3493. var _printBoxId='printBox';
  3494. var $contentBox=rel?$('#'+rel):$("body"),
  3495. $printBox=$('#'+_printBoxId);
  3496. if($printBox.size()==0){
  3497. $printBox=$('<div id="'+_printBoxId+'"></div>').appendTo("body");}
  3498. $printBox.html($contentBox.html()).find("[layoutH]").height("auto");
  3499. window.print();}})(jQuery);