dom.js 128 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805
  1. // <script>
  2. _ie=(document.all!=null)?true:false
  3. _dom=(document.getElementById!=null)?true:false
  4. _isQuirksMode = (document.compatMode != 'CSS1Compat');
  5. _moz=_dom&&!_ie
  6. _show='visible'
  7. _hide='hidden'
  8. _hand=_ie?"hand":"pointer"
  9. _appVer=navigator.appVersion.toLowerCase();
  10. _mac=(_appVer.indexOf('macintosh')>=0)||(_appVer.indexOf('macos')>=0);
  11. _userAgent=navigator.userAgent?navigator.userAgent.toLowerCase():null
  12. _saf=_moz&&(_userAgent.indexOf("safari")>=0)
  13. _ctrl=0
  14. _shift=1
  15. _alt=2
  16. //_def_shortcut=_mac?"&#8984;":
  17. _ie6 = _ie&&(_appVer.indexOf("msie 5")<0)
  18. _small=(screen.height<=600)
  19. _curDoc=document
  20. _curWin=self
  21. _tooltipWin=self
  22. _tooltipDx=0
  23. _tooltipDy=0
  24. _codeWinName="_CW"
  25. _leftBtn=(_ie||_saf)?1:0
  26. _preloadArr=new Array
  27. _widgets=new Array
  28. _resizeW=_ie6?"col-resize":"E-resize"
  29. _resizeH=_ie6?"row-resize":"S-resize"
  30. _ddData=new Array
  31. _dontNeedEncoding=null;
  32. _thex=null;
  33. // ================================================================================
  34. // ================================================================================
  35. //
  36. // MANDATORY FUNCTIONS
  37. //
  38. // Must be called for the library to work
  39. //
  40. // IMPORTANT : must be used in a script tag in the doc header (not in loadCB for example)
  41. // ================================================================================
  42. // ================================================================================
  43. function initDom(skin,style,lang,curWin,codeUniqueName)
  44. // MUST be called after including dom.js
  45. // skin [String] skin path
  46. // lang [String] language code
  47. // curWin [Window - Optional] pointer on a window to redirect the interface
  48. // tooltipWin [Window - Optional] pointer on a window that displays drag & drop tooltips
  49. // codeUniqueName [String - Optional] must be set if curWin specfied - enter a unique keyword
  50. {
  51. _skin=skin;
  52. _lang=lang;
  53. _style=style;
  54. if (curWin)
  55. {
  56. _curWin=curWin
  57. _curDoc=curWin.document
  58. }
  59. _tooltipWin=_curWin
  60. if (codeUniqueName)
  61. _codeWinName="_CW"+codeUniqueName
  62. _curWin[_codeWinName]=self
  63. }
  64. function styleSheet()
  65. // MUST be called after initDom()
  66. // must be between scripts tags to avois sync problems
  67. // Include the default style sheet depending on the parameters of initDom()
  68. {
  69. includeCSS('style')
  70. //we use only one css file for all languages
  71. //switch(_lang)
  72. //{
  73. // case 'ja':
  74. // case 'ko':
  75. // case 'zh':
  76. // includeCSS('style_fe')
  77. // break;
  78. // default:
  79. // includeCSS('style')
  80. // break;
  81. //}
  82. }
  83. // ================================================================================
  84. function isLayerDisplayed(lyr)
  85. //check if the layer is displayed
  86. //and check its parents
  87. //if one parent is not displayed return false
  88. {
  89. var css=lyr?lyr.style:null
  90. if(css)
  91. {
  92. if(css.display == "none" || css.visibility=="hidden")
  93. return false
  94. else
  95. {
  96. var par=lyr.parentNode
  97. if(par!=null)
  98. return isLayerDisplayed(par)
  99. else
  100. return true
  101. }
  102. }
  103. else
  104. return true;
  105. }
  106. // ================================================================================
  107. function safeSetFocus(lyr)
  108. {
  109. if (lyr && lyr.focus && isLayerDisplayed(lyr))
  110. lyr.focus()
  111. }
  112. // ================================================================================
  113. // ================================================================================
  114. //
  115. // OBJECT newWidget (Constructor)
  116. //
  117. // Base Class for widgets
  118. //
  119. // ================================================================================
  120. // ================================================================================
  121. function newWidget(id)
  122. // CONSTRUCTOR
  123. // id [String] the id for DHTML processing
  124. {
  125. var o=new Object
  126. o.id=id
  127. o.layer=null
  128. o.css=null
  129. o.getHTML=Widget_getHTML
  130. o.beginHTML=Widget_getHTML
  131. o.endHTML=Widget_getHTML
  132. o.write=Widget_write
  133. o.begin=Widget_begin
  134. o.end=Widget_end
  135. o.init=Widget_init
  136. o.move=Widget_move
  137. o.resize=Widget_resize
  138. o.setBgColor=Widget_setBgColor
  139. o.show=Widget_show
  140. o.getWidth=Widget_getWidth
  141. o.getHeight=Widget_getHeight
  142. o.setHTML=Widget_setHTML
  143. o.setDisabled=Widget_setDisabled
  144. o.focus=Widget_focus
  145. o.setDisplay=Widget_setDisplay
  146. o.isDisplayed=Widget_isDisplayed
  147. o.appendHTML=Widget_appendHTML
  148. o.setTooltip=Widget_setTooltip
  149. o.initialized=Widget_initialized
  150. o.widx=_widgets.length
  151. _widgets[o.widx]=o
  152. return o
  153. }
  154. // ================================================================================
  155. function Widget_appendHTML()
  156. // Write the widget dynamically into the body
  157. {
  158. append(_curDoc.body,this.getHTML())
  159. }
  160. // ================================================================================
  161. function Widget_getHTML()
  162. // VIRTUAL Get the widget HTML
  163. // return [String] the HTML
  164. {
  165. return ''
  166. }
  167. // ================================================================================
  168. function Widget_write(i)
  169. // write the widget
  170. {
  171. _curDoc.write(this.getHTML(i))
  172. }
  173. // ================================================================================
  174. function Widget_begin()
  175. // for container widgets - write the HTML begin part
  176. {
  177. _curDoc.write(this.beginHTML())
  178. }
  179. // ================================================================================
  180. function Widget_end()
  181. // for container widgets - write the HTML begin part
  182. {
  183. _curDoc.write(this.endHTML())
  184. }
  185. // ================================================================================
  186. function Widget_init()
  187. // Inits the widget layer pointers
  188. {
  189. var o=this
  190. o.layer=getLayer(o.id)
  191. o.css=o.layer.style
  192. o.layer._widget=o.widx
  193. if (o.initialHTML)
  194. o.setHTML(o.initialHTML)
  195. }
  196. function Widget_move(x,y)
  197. // moves a widget
  198. // x [int optional] new abscissa
  199. // y [int optional] new ordinate
  200. {
  201. var c=this.css;if (x!=null){if (_moz) c.left=""+x+"px";else c.pixelLeft=x}if (y!=null){if (_moz) c.top=""+y+"px";else c.pixelTop=y}
  202. }
  203. // ================================================================================
  204. function Widget_focus()
  205. // Set the focus on the current widget
  206. {
  207. safeSetFocus(this.layer)
  208. }
  209. // ================================================================================
  210. function Widget_setBgColor(c)
  211. // Set the widget background color
  212. // c [String] HTML color code
  213. {
  214. this.css.backgroundColor=c
  215. }
  216. // ================================================================================
  217. function Widget_show(show)
  218. // Show/hide a widget (the widget layout always exists)
  219. // show [boolean]
  220. {
  221. this.css.visibility=show?_show:_hide
  222. }
  223. // ================================================================================
  224. function Widget_getWidth()
  225. // return [int] the widget width in pixels
  226. {
  227. return this.layer.offsetWidth
  228. }
  229. // ================================================================================
  230. function Widget_getHeight()
  231. // return [int] the widget height in pixels
  232. {
  233. return this.layer.offsetHeight
  234. }
  235. // ================================================================================
  236. function Widget_setHTML(s)
  237. // Set the widget HTML
  238. // s [String] the new HTML
  239. {
  240. var o=this
  241. if (o.layer)
  242. o.layer.innerHTML=s
  243. else
  244. o.initialHTML=s
  245. }
  246. // ================================================================================
  247. function Widget_setDisplay(d)
  248. // Show/hide a widget (the widget takes no space if d is false)
  249. // d [boolean]
  250. {
  251. if (this.css)
  252. this.css.display=d?"":"none"
  253. }
  254. // ================================================================================
  255. function Widget_isDisplayed()
  256. {
  257. if(this.css.display == "none")
  258. return false
  259. else
  260. return true
  261. }
  262. // ================================================================================
  263. function Widget_setDisabled(d)
  264. // Disable a widget (its becomes insensitive to key or mouse actions)
  265. // d [boolean]
  266. {
  267. if (this.layer)
  268. this.layer.disabled=d
  269. }
  270. // ================================================================================
  271. function Widget_resize(w,h)
  272. // Resize a widget
  273. // w [int optional] new width
  274. // h [int optional] new height
  275. {
  276. if (w!=null) this.css.width=''+(Math.max(0,w))+'px';if (h!=null) this.css.height=''+(Math.max(0,h))+'px';
  277. }
  278. // ================================================================================
  279. function Widget_setTooltip(tooltip)
  280. // Set the widget tooltip
  281. // tooltip [String]
  282. {
  283. this.layer.title=tooltip
  284. }
  285. // ================================================================================
  286. function Widget_initialized()
  287. // Return true if the widget is initialized
  288. {
  289. return this.layer!=null
  290. }
  291. // ================================================================================
  292. // ================================================================================
  293. //
  294. // OBJECT newGrabberWidget (Constructor)
  295. //
  296. // Class to add grabber for resizing zones
  297. //
  298. // ================================================================================
  299. // ================================================================================
  300. function newGrabberWidget(id,resizeCB,x,y,w,h,isHori,buttonCB,tooltip)
  301. // CONSTRUCTOR
  302. // id [String] the id for DHTML processing
  303. // resizeCB [Function] callback when grabber is moved
  304. // x [int] initial abscissa
  305. // y [int] initial ordinate
  306. // w [int] initial width
  307. // h [int] initial height
  308. // isHori [boolean] if true, moves horizontally, else vertically
  309. {
  310. o=newWidget(id)
  311. o.resizeCB=resizeCB
  312. o.x=x
  313. o.y=y
  314. o.w=w
  315. o.h=h
  316. o.dx=0
  317. o.dy=0
  318. o.min=null
  319. o.max=null
  320. o.isHori=isHori
  321. o.preloaded=new Image
  322. o.preloaded.src=_skin+"../resizepattern.gif"
  323. o.buttonCB=buttonCB
  324. o.allowGrab=true
  325. o.collapsed=false
  326. o.isFromButton=false
  327. o.showGrab=GrabberWidget_showGrab
  328. o.setCollapsed=GrabberWidget_setCollapsed
  329. o.tooltipButton=tooltip
  330. o.getHTML=GrabberWidget_getHTML
  331. o.enableGrab=GrabberWidget_enableGrab
  332. o.setMinMax=GrabberWidget_setMinMax
  333. if (window._allGrabbers==null)
  334. window._allGrabbers=new Array
  335. o.index=_allGrabbers.length
  336. _allGrabbers[o.index]=o
  337. o.buttonLyr=null
  338. o.setButtonImage=GrabberWidget_setButtonImage
  339. o.getImgOffset=GrabberWidget_getImgOffset
  340. return o
  341. }
  342. // ================================================================================
  343. function GrabberWidget_setCollapsed(collapsed,tooltip)
  344. {
  345. this.collapsed=collapsed
  346. this.setButtonImage(false,tooltip)
  347. }
  348. // ================================================================================
  349. function GrabberWidget_getImgOffset(isRollover)
  350. {
  351. // PRIVATE
  352. var o=this
  353. if (o.isHori)
  354. {
  355. o.dx=(o.collapsed?12:0)+(isRollover?6:0)
  356. o.dy=0
  357. }
  358. else
  359. {
  360. o.dy=(o.collapsed?12:0)+(isRollover?6:0)
  361. o.dx=0
  362. }
  363. }
  364. // ================================================================================
  365. function GrabberWidget_setButtonImage(isRollover,tooltip)
  366. {
  367. // PRIVATE
  368. var o=this
  369. o.getImgOffset(isRollover)
  370. o.tooltipButton=tooltip
  371. if (o.layer)
  372. {
  373. if (o.buttonLyr==null)
  374. o.buttonLyr=getLayer("grabImg_"+o.id)
  375. if (o.buttonLyr)
  376. {
  377. changeSimpleOffset(o.buttonLyr,o.dx,o.dy,null,tooltip)
  378. }
  379. }
  380. }
  381. // ================================================================================
  382. function GrabberWidget_enableGrab(bEnable)
  383. {
  384. var o=this
  385. o.allowGrab=bEnable
  386. if (o.css)
  387. o.css.cursor=o.allowGrab?(o.isHori?_resizeW:_resizeH):"default"
  388. }
  389. // ================================================================================
  390. function GrabberWidget_getHTML()
  391. // returns [String] widget HTML
  392. {
  393. var o=this,ho=o.isHori
  394. var cr=o.allowGrab?(ho?_resizeW:_resizeH):"default"
  395. var moveableCb='onselectstart="return false" ondragstart="return false" onmousedown="'+_codeWinName+'.GrabberWidget_down(event,\''+o.index+'\',this);return false;"'
  396. var imgG=_ie?('<img onselectstart="return false" ondragstart="return false" onmousedown="'+_codeWinName+'.eventCancelBubble(event)" border="0" hspace="0" vspace="0" src="'+_skin+'../transp.gif" id="modal_'+o.id+'" style="z-index:10000;display:none;position:absolute;top:0px;left:0px;width:1px;height:1px;cursor:'+cr+'">'):('<div onselectstart="return false" ondragstart="return false" onmousedown="'+_codeWinName+'.eventCancelBubble(event)" border="0" hspace="0" vspace="0" id="modal_'+o.id+'" style="z-index:10000;display:none;position:absolute;top:0px;left:0px;width:1px;height:1px;cursor:'+cr+'"></div>')
  397. var button=o.buttonCB?(_skin+(ho?"h":"v")+"grab.gif"):""
  398. if (button)
  399. {
  400. button=simpleImgOffset(button,ho?6:50,ho?50:6,o.dx,o.dy,"grabImg_"+o.id,'onmouseover="'+_codeWinName+'.GrabberWidget_buttonover(event,\''+o.index+'\',this);return false;" onmouseout="'+_codeWinName+'.GrabberWidget_buttonout(event,\''+o.index+'\',this);return false;" onmousedown="'+_codeWinName+'.GrabberWidget_button(event,\''+o.index+'\',this);return false;"',o.tooltipButton,'cursor:'+_hand+';')
  401. }
  402. return getBGIframe('grabIframe_'+o.id)+imgG+'<table cellpadding="0" cellspacing="0" border="0" '+moveableCb+' id="'+o.id+'" style="overflow:hidden;position:absolute;left:'+o.x+'px;top:'+o.y+'px;width:'+o.w+'px;height:'+o.h+'px;cursor:'+cr+'"><tr><td align="center" valign="middle">'+button+'</td></table>'
  403. }
  404. // ================================================================================
  405. function GrabberWidget_setMinMax(min,max)
  406. // Set the range in pixels
  407. // min [int] minimum value
  408. // min [int] maximum value
  409. {
  410. this.min=min
  411. this.max=max
  412. }
  413. // ================================================================================
  414. function GrabberWidget_button(e,index,lyr)
  415. // PRIVATE
  416. {
  417. var o=_allGrabbers[index]
  418. o.isFromButton=true
  419. lyr.onmouseup=eval('_curWin.'+_codeWinName+'.GrabberWidget_buttonup')
  420. }
  421. // ================================================================================
  422. function GrabberWidget_buttonover(e,index,lyr)
  423. // PRIVATE
  424. {
  425. var o=_allGrabbers[index]
  426. o.setButtonImage(true)
  427. }
  428. // ================================================================================
  429. function GrabberWidget_buttonout(e,index,lyr)
  430. // PRIVATE
  431. {
  432. var o=_allGrabbers[index]
  433. o.setButtonImage(false)
  434. }
  435. // ================================================================================
  436. function GrabberWidget_buttonup(e)
  437. // PRIVATE
  438. {
  439. GrabberWidget_up(e)
  440. }
  441. // ================================================================================
  442. function GrabberWidget_showGrab()
  443. {
  444. var o=this,mod=o.mod,ifr=o.iframe,stl=o.layer.style,st=mod.style
  445. ifr.setDisplay(true)
  446. }
  447. // ================================================================================
  448. function GrabberWidget_down(e,index,lyr)
  449. // PRIVATE
  450. {
  451. var o=_allGrabbers[index]
  452. window._theGrabber=o
  453. if (o.mod==null)
  454. {
  455. o.mod=getLayer('modal_'+o.id)
  456. o.iframe=newWidget('grabIframe_'+o.id)
  457. o.iframe.init()
  458. }
  459. o.mod.onmousemove=eval('_curWin.'+_codeWinName+'.GrabberWidget_move')
  460. o.mod.onmouseup=eval('_curWin.'+_codeWinName+'.GrabberWidget_up')
  461. o.grabStartPosx=parseInt(lyr.style.left)
  462. o.grabStartPosy=parseInt(lyr.style.top)
  463. o.grabStartx=eventGetX(e)
  464. o.grabStarty=eventGetY(e)
  465. var mod=o.mod,ifr=o.iframe,stl=o.layer.style,st=mod.style
  466. stl.backgroundImage='url(\''+_skin+'../resizepattern.gif\')'
  467. o.prevZ=stl.zIndex
  468. stl.zIndex=9999
  469. ifr.css.zIndex=9998
  470. st.width='100%'
  471. st.height='100%'
  472. mod.style.display="block"
  473. var p=getPos(o.layer)
  474. ifr.move(p.x,p.y)
  475. ifr.resize(o.getWidth(),o.getHeight())
  476. if (!o.isFromButton)
  477. o.showGrab()
  478. return false
  479. }
  480. // ================================================================================
  481. function GrabberWidget_move(e)
  482. // PRIVATE
  483. {
  484. var o=_theGrabber,lyr=o.layer,mod=o.mod
  485. if (o.isFromButton)
  486. {
  487. if (o.isHori)
  488. {
  489. var x = eventGetX(e), ox=o.grabStartx
  490. if ((x < ox - 3) || (x > ox + 3))
  491. o.isFromButton = false
  492. }
  493. else
  494. {
  495. var Y = eventGetY(e), oy=o.grabStarty
  496. if ((y < oy - 3) || (y > oy + 3))
  497. o.isFromButton = false
  498. }
  499. if (!o.isFromButton)
  500. o.showGrab()
  501. }
  502. if (!o.isFromButton)
  503. {
  504. if (o.allowGrab)
  505. {
  506. var x=o.isHori?Math.max(0,o.grabStartPosx-o.grabStartx+eventGetX(e)):null
  507. var y=o.isHori?null:Math.max(0,o.grabStartPosy-o.grabStarty+eventGetY(e))
  508. if (o.isHori)
  509. {
  510. if (o.min!=null) x=Math.max(x,o.min)
  511. if (o.max!=null) x=Math.min(x,o.max)
  512. }
  513. else
  514. {
  515. if (o.min!=null) y=Math.max(y,o.min)
  516. if (o.max!=null) y=Math.min(y,o.max)
  517. }
  518. eventCancelBubble(e)
  519. o.move(x,y)
  520. getPos(o.layer)
  521. if (o.buttonCB)
  522. {
  523. var bCss=o.buttonLyr.style
  524. if (bCss.display!="none")
  525. bCss.display="none"
  526. }
  527. o.iframe.move(x,y)
  528. }
  529. }
  530. }
  531. // ================================================================================
  532. function GrabberWidget_up(e)
  533. {
  534. var o=_theGrabber,lyr=o.layer,mod=o.mod,stl=lyr.style
  535. stl.backgroundImage=''
  536. stl.zIndex=o.prevZ
  537. var ifr=o.iframe
  538. ifr.move(-100,-100)
  539. ifr.resize(1,1)
  540. ifr.setDisplay(false)
  541. eventCancelBubble(e)
  542. var st=mod.style
  543. st.display="none"
  544. st.width='0px'
  545. st.height='0px'
  546. if (o.buttonCB)
  547. o.buttonLyr.style.display=""
  548. if (o&&(o.isFromButton))
  549. {
  550. if (o.buttonCB)
  551. o.buttonCB()
  552. o.isFromButton=false
  553. }
  554. if (o.allowGrab&&(!o.isFromButton))
  555. {
  556. if (o.resizeCB)
  557. o.resizeCB(parseInt(lyr.style.left),parseInt(lyr.style.top))
  558. }
  559. }
  560. // ================================================================================
  561. // ================================================================================
  562. //
  563. // OBJECT ButtonWidget (Constructor)
  564. //
  565. // Class for building push buttons
  566. //
  567. // ================================================================================
  568. // ================================================================================
  569. function newButtonWidget(id,label,cb,width,hlp,tooltip,tabIndex,margin,url,w,h,dx,dy,imgRight,disDx,disDy)
  570. // CONSTRUCTOR
  571. // id [String] button ID
  572. // label [String Optional] button label
  573. // w [int optional] : text zone minimal width
  574. // hlp OBSOLETE
  575. // tooltip [String Optional] button tooltip
  576. // tabIndex [int Optional] for 508/IE : tab index for keyboard navigation
  577. // url [String Optional] : the combined image url
  578. // w [int Optional] the visible image part width
  579. // dx [int Optional] the horizontal offset in image
  580. // dy [int Optional] the vertical offset in image
  581. // disDx : [int - optional] horizontal offset for disabled state
  582. // disDy : [int - optional] vertical offset for disabled state
  583. {
  584. var o=newWidget(id)
  585. o.label=label
  586. o.cb=cb
  587. o.width=width
  588. o.hlp=hlp
  589. o.tooltip=tooltip
  590. o.tabIndex=tabIndex
  591. o.isGray=false
  592. o.isDefault=false
  593. o.txt=null
  594. o.icn=null
  595. o.margin=margin?margin:0
  596. o.extraStyle=""
  597. if (url)
  598. {
  599. o.url=url
  600. o.w=w
  601. o.h=h
  602. o.dx=dx
  603. o.dy=dy
  604. o.disDx=(disDx!=null)?disDx:dx
  605. o.disDy=(disDy!=null)?disDy:dy
  606. o.imgRight=imgRight?true:false
  607. }
  608. o.getHTML=ButtonWidget_getHTML
  609. o.setDisabled=ButtonWidget_setDisabled
  610. o.setText=ButtonWidget_setText
  611. o.changeImg=ButtonWidget_changeImg
  612. o.oldInit=o.init
  613. o.init=ButtonWidget_init
  614. o.isDisabled=ButtonWidget_isDisabled
  615. o.setDefaultButton=ButtonWidget_setDefaultButton
  616. o.executeCB=ButtonWidget_executeCB
  617. o.setTooltip=ButtonWidget_setTooltip
  618. o.instIndex=ButtonWidget_currInst
  619. ButtonWidget_inst[ButtonWidget_currInst++]=o
  620. return o;
  621. }
  622. // ================================================================================
  623. ButtonWidget_inst=new Array
  624. ButtonWidget_currInst=0
  625. function ButtonWidget_getHTML()
  626. // returns [String] widget HTML
  627. {
  628. with (this)
  629. {
  630. var clk=_codeWinName+'.ButtonWidget_clickCB('+this.instIndex+');return false;"'
  631. var clcbs= 'onclick="'+clk+'" '
  632. if (_ie) clcbs+= 'ondblclick="'+clk+'" '
  633. //
  634. var isDefaultSty=(this.isDefault && !this.isGray);
  635. //add onkeydown for dialog default action (Enter)
  636. clcbs+= 'onkeydown=" return '+_codeWinName+'.ButtonWidget_keydownCB(event,'+this.instIndex+');" '
  637. var url1=_skin+"button.gif",addPar=' style="'+extraStyle+'cursor:'+_hand+';margin-left:'+margin+'px; margin-right:'+margin+'px; "'+clcbs+' ',tip=attr('title', tooltip),idText="theBttn"+id, idIcon="theBttnIcon"+id;
  638. var bg=backImgOffset(url1,0,isDefaultSty?105:42);
  639. var lnkB='<a '+attr('id',idText)+' '+tip+' '+attr('tabindex',tabIndex)+' href="javascript:void(0)" class="wizbutton">'
  640. var l=(label!=null)
  641. var im=(this.url?('<td align="'+(l?(this.imgRight?'right':'left'):'center')+'" style="'+bg+'" width="'+(!l&&(width!=null)?width+6:w+6)+'">'+(l?'':lnkB)+simpleImgOffset(url,w,h,this.isGray?disDs:dx,this.isGray?disDy:dy,idIcon,null,(l?'':tooltip),'cursor:'+_hand)+(l?'':'</a>')+'</td>'):'')
  642. // Justin... I've change the button left and right to use backImgOffset because IE would not hide the simpleImgOffset once it had been displayed in the cancel dialog.
  643. return '<table onmouseover="return true" '+attr('id',id)+' '+addPar+' border="0" cellspacing="0" cellpadding="0"><tr valign="middle">'+
  644. '<td height="21" width="5" style="' + backImgOffset(url1,0,isDefaultSty?63:0)+'"></td>'+
  645. (this.imgRight?'':im)+
  646. (l?('<td '+attr("width",width)+ attr('id',"theBttnCenterImg"+id)+' align="center" class="'+(this.isGray?'wizbuttongray':'wizbutton')+'" style="padding-left:3px;padding-right:3px;'+bg+'"><nobr>'+lnkB+label+'</a></nobr></td>'):'')+
  647. (this.imgRight?im:'')+
  648. '<td height="21" width="5" style="' + backImgOffset(url1,0,isDefaultSty?84:21)+'"></td></tr></table>';
  649. }
  650. }
  651. // ================================================================================
  652. function ButtonWidget_setDisabled(d)
  653. // Enable/Disable
  654. // s [boolean] if true disable the button
  655. // returns [void]
  656. {
  657. var o=this,newCur=d?'default':_hand
  658. o.isGray=d
  659. if (o.layer)
  660. {
  661. var newClassName=d?'wizbuttongray':'wizbutton'
  662. // Ensure the button state hasn't changed to avoid unnecessary processing
  663. // The text className is a safe way to do the test
  664. if (o.txt.className!=newClassName)
  665. {
  666. o.txt.className=newClassName
  667. o.txt.style.cursor=newCur
  668. o.css.cursor=newCur
  669. if(o.icn)
  670. {
  671. changeSimpleOffset(o.icn,o.isGray?o.disDx:o.dx,o.isGray?o.disDy:o.dy)
  672. o.icn.style.cursor=newCur
  673. }
  674. if(o.isDefault) //default button style
  675. {
  676. var isDefaultSty=!d,url=_skin+"button.gif";
  677. changeSimpleOffset(o.leftImg,0,isDefaultSty?63:0,url);
  678. changeOffset(o.centerImg,0,isDefaultSty?105:42,url);
  679. changeSimpleOffset(o.rightImg,0,isDefaultSty?84:21,url);
  680. }
  681. }
  682. }
  683. }
  684. // ================================================================================
  685. function ButtonWidget_setDefaultButton()
  686. {
  687. var o=this;
  688. if (o.layer)
  689. {
  690. var isDefaultSty = !o.isGray,url=_skin+"button.gif";
  691. changeSimpleOffset(o.leftImg,0,isDefaultSty?63:0,url);
  692. changeOffset(o.centerImg,0,isDefaultSty?105:42,url);
  693. changeSimpleOffset(o.rightImg,0,isDefaultSty?84:21,url);
  694. }
  695. o.isDefault=true;
  696. }
  697. // ================================================================================
  698. function ButtonWidget_isDisabled()
  699. {
  700. return this.isGray
  701. }
  702. // ================================================================================
  703. function ButtonWidget_setText(str)
  704. // Changes the button text
  705. // str [String] the new button text
  706. // returns [void]
  707. {
  708. this.txt.innerHTML=convStr(str)
  709. }
  710. function ButtonWidget_setTooltip(tooltip)
  711. // Set the widget tooltip
  712. // tooltip [String]
  713. {
  714. var o=this
  715. o.tooltip=tooltip
  716. o.layer.title=tooltip
  717. if (o.txt)
  718. o.txt.title=tooltip
  719. if (o.icn)
  720. o.icn.title=tooltip
  721. }
  722. // ================================================================================
  723. function ButtonWidget_init()
  724. // Inits the button
  725. // returns [void]
  726. {
  727. var o=this
  728. o.oldInit()
  729. o.txt=getLayer('theBttn'+this.id)
  730. o.icn=getLayer('theBttnIcon'+this.id)
  731. o.leftImg=getLayer('theBttnLeftImg'+this.id)
  732. o.centerImg=getLayer('theBttnCenterImg'+this.id)
  733. o.rightImg=getLayer('theBttnRightImg'+this.id)
  734. // reset if already initialized
  735. var newClassName=o.isGray?'wizbuttongray':'wizbutton'
  736. if (o.txt.className!=newClassName)
  737. {
  738. o.setDisabled(o.isGray)
  739. }
  740. }
  741. // ================================================================================
  742. function ButtonWidget_changeImg(dx,dy,disDx,disDy,url,tooltip)
  743. {
  744. var o=this
  745. if (url) o.url=url
  746. if (dx!=null) o.dx=dx
  747. if (dy!=null) o.dy=dy
  748. if (disDx!=null) o.disDx=disDx
  749. if (disDy!=null) o.disDy=disDy
  750. if (tooltip!=null) o.tooltip=tooltip
  751. if (o.icn)
  752. changeSimpleOffset(o.icn,o.isGray?o.disDx:o.dx,o.isGray?o.disDy:o.dy, o.url, o.tooltip)
  753. }
  754. // ================================================================================
  755. function ButtonWidget_clickCB(index)
  756. // PRIVATE internal click event handler
  757. {
  758. var btn=ButtonWidget_inst[index]
  759. if (btn && !btn.isGray)
  760. setTimeout("ButtonWidget_delayClickCB("+index+")",1)
  761. }
  762. // ================================================================================
  763. function ButtonWidget_delayClickCB(index)
  764. // PRIVATE internal click event handler
  765. {
  766. var btn=ButtonWidget_inst[index]
  767. btn.executeCB();
  768. /*
  769. if (btn.cb)
  770. {
  771. if (typeof btn.cb!="string")
  772. btn.cb()
  773. else
  774. eval(btn.cb)
  775. }*/
  776. }
  777. // ================================================================================
  778. function ButtonWidget_executeCB()
  779. // PRIVATE internal click event handler
  780. {
  781. var o=this
  782. if (o.cb)
  783. {
  784. if (typeof o.cb!="string")
  785. o.cb()
  786. else
  787. eval(o.cb)
  788. }
  789. }
  790. // ================================================================================
  791. function ButtonWidget_keydownCB(e,index)
  792. {
  793. var k=eventGetKey(e);
  794. var btn=ButtonWidget_inst[index]
  795. if(k == 13 && btn.cb )//enter
  796. {
  797. eventCancelBubble(e);
  798. }
  799. return true;
  800. }
  801. // ================================================================================
  802. // ================================================================================
  803. //
  804. // OBJECT ScrolledZoneWidget (Constructor)
  805. //
  806. // Base Class for widgets
  807. //
  808. // ================================================================================
  809. // ================================================================================
  810. function newScrolledZoneWidget(id,borderW,padding,w,h,bgClass)
  811. // id [String] the id for DHTML processing
  812. // borderW [int] widget border width
  813. // padding [int] widget padding
  814. // w [int] widget width, including borders
  815. // h [int] widget height, including borders
  816. // Return [ScrolledZoneWidget] the instance
  817. {
  818. var o=newWidget(id)
  819. o.borderW=borderW
  820. o.padding=padding
  821. o.w=w
  822. o.h=h
  823. o.oldResize=o.resize
  824. o.beginHTML=ScrolledZoneWidget_beginHTML
  825. o.endHTML=ScrolledZoneWidget_endHTML
  826. o.resize=ScrolledZoneWidget_resize
  827. o.bgClass = (bgClass)? bgClass : 'insetBorder'
  828. return o;
  829. }
  830. // ================================================================================
  831. function ScrolledZoneWidget_beginHTML()
  832. // Returns : [String] the HTML beginning block
  833. {
  834. var w=this.w,h=this.h;
  835. var ofs=_moz?2*(this.borderW+this.padding):0
  836. if (typeof(w)=="number")
  837. {
  838. if (_moz)
  839. w=Math.max(0,w-ofs)
  840. w=""+w+"px"
  841. }
  842. if (typeof(h)=="number")
  843. {
  844. if (_moz)
  845. h=Math.max(0,h-ofs)
  846. h=""+h+"px"
  847. }
  848. return '<div align="left" onselectstart="return false" class="' + this.bgClass + '" id="'+this.id+'" style="border-width:'+this.borderW+'px;padding:'+this.padding+'px;'+sty("width",w)+sty("height",h)+'overflow:auto">'
  849. }
  850. // ================================================================================
  851. function ScrolledZoneWidget_endHTML()
  852. // Returns : [String] the HTML ending block
  853. {
  854. return '</div>'
  855. }
  856. // ================================================================================
  857. function ScrolledZoneWidget_resize(w,h)
  858. // w [int] widget width, including borders
  859. // h [int] widget height, including borders
  860. // Returns [void]
  861. {
  862. if (_moz)
  863. {
  864. var ofs=2*(this.borderW+this.padding)
  865. if (w!=null) w=Math.max(0,w-ofs)
  866. if (h!=null) h=Math.max(0,h-ofs)
  867. }
  868. this.oldResize(w,h)
  869. }
  870. // ================================================================================
  871. // ================================================================================
  872. //
  873. // OBJECT newTooltipWidget (Constructor)
  874. //
  875. // A tooltip widget. Only one by window/frame
  876. //
  877. // ================================================================================
  878. // ================================================================================
  879. /*
  880. function newTooltipWidget(maxw,maxh)
  881. // Return [TooltipWidget] the instance
  882. {
  883. if (window._theGlobalTooltip!=null)
  884. return window._theGlobalTooltip
  885. var o=newWidget('theGobalTooltip')
  886. o.maxw=maxw
  887. o.maxh=maxh
  888. o.getPrivateHTML=TooltipWidget_getPrivateHTML
  889. o.init=TooltipWidget_init
  890. o.oldShow=o.show
  891. o.show=TooltipWidget_show
  892. o.hide=TooltipWidget_hide
  893. o.setPos=TooltipWidget_setPos
  894. o.inputs=null
  895. window._theGlobalTooltip=o
  896. o.eventWin=_curWin
  897. preloadImg(_skin+'../swap.gif')
  898. return o;
  899. }
  900. // ================================================================================
  901. function TooltipWidget_init()
  902. {
  903. //cancels the default init behaviour
  904. }
  905. // ================================================================================
  906. function TooltipWidget_getPrivateHTML()
  907. // Returns [String] the HTML
  908. {
  909. var o=this
  910. return getBGIframe('tipIframe_'+o.id)+'<div class="dragTooltip" id="'+o.id+'" style="visibility:hidden;z-index:10000;position:absolute;top:0px;left:0px,visibility:'+_hide+'"'+attr("width",o.w)+attr("height",o.h)+'></div>'+
  911. '<img width="11" height="11" border="0" hspace="0" vspace="0" src="'+_skin+'../swap.gif" id="swap_'+o.id+'" style="position:absolute;top:0px;left:0px;display:none;z-index:10000;">'
  912. }
  913. // ================================================================================
  914. function TooltipWidget_show(show,str,url,w,h,dx,dy,isHTML, e)
  915. // show/hide the drag & drop tooltip
  916. // show [boolean] true for showing the tooltip
  917. // str [String] the tooltip text
  918. // url [String] combined image url
  919. {
  920. var o=this
  921. oldWin=_curWin
  922. _curWin=_tooltipWin
  923. _curDoc=_tooltipWin.document
  924. // object not init yet, 2 cases
  925. if (o.layer==null)
  926. {
  927. o.layer=getLayer(o.id)
  928. // another instance hasn't written it's HTML yet
  929. if (o.layer==null)
  930. {
  931. targetApp(o.getPrivateHTML())
  932. o.layer=getLayer(o.id)
  933. }
  934. o.css=o.layer.style
  935. o.swapLayer=getLayer("swap_"+o.id)
  936. o.iframe=newWidget('tipIframe_'+o.id)
  937. o.iframe.init()
  938. }
  939. // hides combo boxes or restore
  940. //if (show) o.inputs=hideAllInputs()
  941. //else restoreAllInputs(o.inputs)
  942. dx=dx!=null?dx:0
  943. dy=dy!=null?dy:0
  944. if (show)
  945. {
  946. var s=null
  947. if (url)
  948. //s='<span style="margin-right:2px;width:'+w+'px;height:'+h+'px;overflow:hidden">'+img(url,null,null,'top','style="position:relative;top:-'+dy+'px;left:-'+dx+'px"')+'</span>'
  949. s=simpleImgOffset(url,w,h,dx,dy,null,null,null,"margin-right:4px;margin-left:0px;",'top')
  950. //o.resize(0,0)
  951. o.css.width=''
  952. o.css.height=''
  953. o.setHTML('<table border="0" cellspacing="0" cellpadding="0"><tr valign="middle">'+(s?'<td align="center">'+s+'</td>':'')+'<td class="dragTxt"><nobr>'+(isHTML?str:convStr(str))+'</nobr></td></tr></table>')
  954. o.setPos(null,e)
  955. if (o.getWidth()>o.maxw)
  956. o.resize(o.maxw)
  957. o.oldShow(show)
  958. o.iframe.setDisplay(true)
  959. }
  960. else
  961. {
  962. o.oldShow(false)
  963. o.setHTML('')
  964. o.move(0,0)
  965. o.swapLayer.style.display="none"
  966. o.iframe.setDisplay(false)
  967. }
  968. _curWin=oldWin
  969. _curDoc=_curWin.document
  970. }
  971. // ================================================================================
  972. function TooltipWidget_hide()
  973. {
  974. var o=this
  975. o.show(false)
  976. }
  977. // ================================================================================
  978. function TooltipWidget_setPos(shift,e)
  979. // Return [void]
  980. {
  981. var o=this
  982. if (o.layer==null)
  983. return
  984. if (e) {
  985. var x=absxpos(e), y=absypos(e)
  986. } else {
  987. var ew=o.eventWin,x=ew.event.x+_curDoc.body.scrollLeft,y=ew.event.y+_curDoc.body.scrollTop
  988. }
  989. x+=_tooltipDx
  990. y+=_tooltipDy
  991. o.move(x+27,y+10);
  992. o.iframe.move(x+27,y+10);
  993. o.iframe.resize(o.getWidth(),o.getHeight())
  994. var c=o.swapLayer.style;
  995. c.display=shift?"":"none"
  996. if (shift)
  997. {
  998. y+=18
  999. x+=14
  1000. if (_moz)
  1001. {
  1002. c.left=""+x+"px"
  1003. c.top=""+y+"px"
  1004. }
  1005. else
  1006. {
  1007. c.pixelLeft=x
  1008. c.pixelTop=y
  1009. }
  1010. }
  1011. }
  1012. // ================================================================================
  1013. function initTooltipWin(tooltipWin)
  1014. {
  1015. _tooltipWin=tooltipWin
  1016. }
  1017. // ================================================================================
  1018. function setTooltipOffset(dx,dy)
  1019. {
  1020. _tooltipDx=dx
  1021. _tooltipDy=dy
  1022. }
  1023. */
  1024. // ================================================================================
  1025. // ================================================================================
  1026. //
  1027. // OBJECT newComboWidget (Constructor)
  1028. //
  1029. // Combo box widget - based on SELECT tags
  1030. //
  1031. // ================================================================================
  1032. // ================================================================================
  1033. function newComboWidget(id,changeCB,noMargin,width,tooltip)
  1034. // id [String] the id for DHTML processing
  1035. // changeCB [Function] calback when selection is changed by the user
  1036. // noMargin [boolean - optional] default is false - no margin (else 10px left margin )
  1037. // width [int - optional] combo width (if not, auto width)
  1038. // tooltip [String - optional] combo tooltip for 508
  1039. // Return [ComboWidget] the widget instance
  1040. {
  1041. var o=newWidget(id)
  1042. o.tooltip=tooltip
  1043. o.size=1
  1044. o.getHTML=ComboWidget_getHTML
  1045. o.beginHTML=ComboWidget_beginHTML
  1046. o.endHTML=ComboWidget_endHTML
  1047. o.changeCB=changeCB
  1048. o.noMargin=noMargin
  1049. o.width=width==null?null:''+width+'px'
  1050. o.add=ComboWidget_add
  1051. o.del=ComboWidget_del
  1052. o.getSelection=ComboWidget_getSelection
  1053. o.select=ComboWidget_select
  1054. o.valueSelect=ComboWidget_valueSelect
  1055. o.getCount=ComboWidget_getCount
  1056. o.oldSetDisabled=o.setDisabled
  1057. o.setDisabled=ComboWidget_setDisabled
  1058. o.setUndefined=ComboWidget_setUndefined
  1059. o.delByID=ComboWidget_delByID
  1060. o.move=ComboWidget_move
  1061. o.findByValue=ComboWidget_findByValue
  1062. o.findByText=ComboWidget_findByText
  1063. o.getValue=ComboWidget_getValue
  1064. o.isGrayed=ComboWidget_isGrayed
  1065. o.isDisabled=false
  1066. o.multi=false
  1067. o.undef=false
  1068. o.isCombo=true
  1069. o.undefId=o.id+"__undef"
  1070. o.disabledId=o.id+"__disabled"
  1071. return o;
  1072. }
  1073. // ================================================================================
  1074. _extrCmbS=(_moz?'font-size:12px;':'')
  1075. function ComboWidget_beginHTML()
  1076. {
  1077. var o=this,_extrCmbS=((_moz&&!o.isCombo)?'font-size:12px;':'')
  1078. return '<select '+(o.multi?'multiple':'')+' '+(o.noMargin?'style="'+sty("width",o.width)+_extrCmbS+'"':'style="'+sty("width",o.width)+'margin-left:10px;'+_extrCmbS+'"')+' class="listinputs" '+attr('onchange',_codeWinName+'.ComboWidget_changeCB(event,this)')+attr('onclick',_codeWinName+'.ComboWidget_clickCB(event,this)')+attr('ondblclick',_codeWinName+'.ComboWidget_dblClickCB(event,this)')+attr('onkeyup',_codeWinName+'.ComboWidget_keyUpCB(event,this)')+attr('onkeydown',_codeWinName+'.ComboWidget_keyDownCB(event,this)')+attr('id',o.id)+attr('name',o.id)+attr('title',o.tooltip)+'size="'+o.size+'">'
  1079. }
  1080. // ================================================================================
  1081. function ComboWidget_endHTML()
  1082. {
  1083. return '</select>'
  1084. }
  1085. // ================================================================================
  1086. function ComboWidget_getHTML(inner)
  1087. {
  1088. return this.beginHTML()+(inner?inner:'')+this.endHTML()
  1089. }
  1090. // ================================================================================
  1091. function ComboWidget_add(s,val,sel,id,grayed)
  1092. {
  1093. var e=this.layer,opt=_curDoc.createElement('option');
  1094. // Add item
  1095. if (_ie)
  1096. e.options.add(opt);
  1097. else
  1098. e.appendChild(opt);
  1099. // Set text content
  1100. if (opt.innerText!=null)
  1101. opt.innerText=s;
  1102. else
  1103. opt.innerHTML=convStr(s);
  1104. // Set other attributes
  1105. opt.value=val;
  1106. if(id!=null)
  1107. opt.id=id;
  1108. if (sel)
  1109. opt.selected=true;
  1110. if (grayed)
  1111. {
  1112. opt.style.color='gray'
  1113. }
  1114. return opt;
  1115. }
  1116. // ================================================================================
  1117. function ComboWidget_move(delta)
  1118. {
  1119. var e=this.layer,i=e.selectedIndex,len=e.options.length-1,newI=i+delta
  1120. if ((i==-1)||(newI<0)||(newI>len))
  1121. return false
  1122. var oldOpt = e.options[i],newOpt = e.options[newI]
  1123. var oldVal=oldOpt.value,oldHTML=oldOpt.innerHTML,oldID=oldOpt.id,newID=newOpt.id,oldColor=oldOpt.style.color,newColor=newOpt.style.color
  1124. oldOpt.value=newOpt.value
  1125. oldOpt.innerHTML=newOpt.innerHTML
  1126. newOpt.id=null
  1127. oldOpt.id=newOpt.id
  1128. oldOpt.style.color=newColor
  1129. newOpt.value=oldVal
  1130. newOpt.innerHTML=oldHTML
  1131. newOpt.id=oldID
  1132. newOpt.style.color=oldColor
  1133. e.selectedIndex=newI
  1134. return true
  1135. }
  1136. // ================================================================================
  1137. function ComboWidget_getSelection()
  1138. {
  1139. var e=this.layer,i=e.selectedIndex;if (i<0) return null;var ret=new Object;ret.index=i;ret.value=e.options[i].value;ret.text=e.options[i].text;return ret
  1140. }
  1141. // ================================================================================
  1142. function ComboWidget_select(i)
  1143. {
  1144. var o=this,e=o.layer,len=e.options.length
  1145. if (i==null) e.selectedIndex=-1
  1146. if ((i<0)||(i>=len))
  1147. i=len-1
  1148. if (i>=0)
  1149. e.selectedIndex=i
  1150. o.setUndefined(false)
  1151. }
  1152. // ================================================================================
  1153. function ComboWidget_valueSelect(v)
  1154. {
  1155. var o=this,e=o.layer,opts=e.options,len=opts.length
  1156. for (var i=0;i<len;i++)
  1157. {
  1158. if (opts[i].value==v)
  1159. {
  1160. //e.selectedIndex=i
  1161. opts[i].selected=true
  1162. o.setUndefined(false)
  1163. break;
  1164. }
  1165. }
  1166. }
  1167. // ================================================================================
  1168. function ComboWidget_del(i)
  1169. {
  1170. var e=this.layer
  1171. if (i==null)
  1172. e.options.length=0
  1173. else
  1174. {
  1175. if (_ie) e.remove(i)
  1176. else e.options[i]=null
  1177. this.select(i)
  1178. }
  1179. }
  1180. // ================================================================================
  1181. function ComboWidget_changeCB(e,l)
  1182. // PRIVATE
  1183. {
  1184. var o=getWidget(l);if(o.changeCB) o.changeCB(e)
  1185. }
  1186. // ================================================================================
  1187. function ComboWidget_clickCB(e,l)
  1188. // PRIVATE
  1189. {
  1190. var o=getWidget(l);if(o.clickCB) o.clickCB(e)
  1191. }
  1192. // ================================================================================
  1193. function ComboWidget_dblClickCB(e,l)
  1194. // PRIVATE
  1195. {
  1196. var o=getWidget(l);if(o.dblClickCB) o.dblClickCB(e)
  1197. }
  1198. // ================================================================================
  1199. function ComboWidget_keyUpCB(e,l)
  1200. {
  1201. var o=getWidget(l);if(o.keyUpCB) o.keyUpCB(e)
  1202. }
  1203. // ================================================================================
  1204. function ComboWidget_keyDownCB(e,l)
  1205. {
  1206. var k=eventGetKey(e);
  1207. var o=getWidget(l);
  1208. //be careful ! usefull for dialog box close by Enter ou Escape keypressed
  1209. if(o.isCombo && (k==27 || k==13))//Escape ou Enter
  1210. {
  1211. eventCancelBubble(e);
  1212. }
  1213. else if(k==13 && o.keyUpCB) //Enter can be attached to an action in listwidget
  1214. {
  1215. eventCancelBubble(e);
  1216. }
  1217. }
  1218. // ================================================================================
  1219. function ComboWidget_getCount()
  1220. {
  1221. return this.layer.options.length
  1222. }
  1223. // ================================================================================
  1224. function ComboWidget_delByID(id)
  1225. // PRIVATE
  1226. {
  1227. var opt=getLayer(id)
  1228. if (opt!=null)
  1229. this.del(opt.index)
  1230. opt=null
  1231. }
  1232. // ================================================================================
  1233. function ComboWidget_setDisabled(d,addEmptyElt)
  1234. {
  1235. var o=this
  1236. o.oldSetDisabled(d);
  1237. o.isDisabled=d;
  1238. if (d==true)
  1239. {
  1240. var old=getLayer(o.disabledId)
  1241. if (old==null)
  1242. o.add('','',true,o.disabledId);
  1243. else
  1244. o.layer.selectedIndex=old.index
  1245. }
  1246. else
  1247. o.delByID(o.disabledId)
  1248. }
  1249. // ================================================================================
  1250. function ComboWidget_setUndefined(u)
  1251. {
  1252. var o=this
  1253. o.undef=u;
  1254. if (u==true)
  1255. {
  1256. var old=getLayer(o.undefId)
  1257. if (old==null)
  1258. o.add('','',true,o.undefId);
  1259. else
  1260. o.layer.selectedIndex=old.index
  1261. }
  1262. else
  1263. o.delByID(o.undefId)
  1264. }
  1265. // ================================================================================
  1266. function ComboWidget_findByValue(val)
  1267. //return the data if already exist else null
  1268. {
  1269. var o=this,e=o.layer,opts=e.options,len=opts.length
  1270. for (var i=0;i<len;i++)
  1271. {
  1272. if (opts[i].value==val)
  1273. {
  1274. var ret=new Object;
  1275. ret.index=i;
  1276. ret.value=e.options[i].value;
  1277. ret.text=e.options[i].text;
  1278. return ret
  1279. }
  1280. }
  1281. return null
  1282. }
  1283. // ================================================================================
  1284. function ComboWidget_findByText(txt)
  1285. //return the data if already exist else null
  1286. {
  1287. var o=this,e=o.layer,opts=e.options,len=opts.length
  1288. for (var i=0;i<len;i++)
  1289. {
  1290. if (opts[i].text==txt)
  1291. {
  1292. var ret=new Object;
  1293. ret.index=i;
  1294. ret.value=e.options[i].value;
  1295. ret.text=e.options[i].text;
  1296. return ret
  1297. }
  1298. }
  1299. return null
  1300. }
  1301. // ================================================================================
  1302. function ComboWidget_getValue(i)
  1303. //return the value at index i
  1304. {
  1305. var o=this,e=o.layer,opts=e.options,len=opts.length
  1306. if(i==null || i<0 || i>len) return null;
  1307. var ret=new Object;
  1308. ret.index=i;
  1309. ret.value=e.options[i].value;
  1310. return ret
  1311. }
  1312. // ================================================================================
  1313. function ComboWidget_isGrayed(i)
  1314. //return true is the option is gray
  1315. {
  1316. var o=this,e=o.layer,opts=e.options,len=opts.length
  1317. if(i==null || i<0 || i>len) return false;
  1318. return (e.options[i].style.color=="gray")
  1319. }
  1320. // ================================================================================
  1321. // ================================================================================
  1322. //
  1323. // OBJECT newListWidget (Constructor)
  1324. //
  1325. // List box widget - based on SELECT tags
  1326. //
  1327. // ================================================================================
  1328. // ================================================================================
  1329. function newListWidget(id,changeCB,multi,width,lines,tooltip,dblClickCB,keyUpCB,clickCB)
  1330. {
  1331. var o=newComboWidget(id,changeCB,true,width,tooltip)
  1332. o.clickCB=clickCB
  1333. o.dblClickCB=dblClickCB
  1334. o.keyUpCB=keyUpCB
  1335. o.size=lines
  1336. o.multi=multi
  1337. o.getMultiSelection=ListWidget_getMultiSelection
  1338. o.setUndefined=ListWidget_setUndefined
  1339. o.isUndefined=ListWidget_isUndefined
  1340. o.change=ListWidget_change
  1341. o.isCombo=false
  1342. return o;
  1343. }
  1344. // ================================================================================
  1345. function ListWidget_setUndefined(u)
  1346. {
  1347. var o=this
  1348. o.undef=u;
  1349. if (u==true)
  1350. {
  1351. o.layer.selectedIndex = -1
  1352. }
  1353. }
  1354. // ================================================================================
  1355. function ListWidget_isUndefined()
  1356. {
  1357. return (this.layer.selectedIndex == -1)
  1358. }
  1359. // ================================================================================
  1360. function ListWidget_getMultiSelection()
  1361. {
  1362. var e=this.layer,rets=new Array,len=e.options.length
  1363. for (var i=0;i<len;i++)
  1364. {
  1365. var opt=e.options[i]
  1366. if (opt.selected)
  1367. {
  1368. var ret=new Object;
  1369. ret.index=i;ret.value=opt.value;ret.text=opt.text;rets[rets.length]=ret
  1370. }
  1371. }
  1372. return rets
  1373. }
  1374. function ListWidget_change(multi,lines)
  1375. {
  1376. var o=this
  1377. if(multi!=null)
  1378. {
  1379. o.multi=multi
  1380. o.layer.multiple=multi
  1381. }
  1382. if(lines!=null)
  1383. {
  1384. o.size=lines
  1385. o.layer.size=lines
  1386. }
  1387. }
  1388. // ================================================================================
  1389. // ================================================================================
  1390. //
  1391. // OBJECT newInfoWidget (Constructor)
  1392. //
  1393. // List box widget - based on SELECT tags
  1394. //
  1395. // ================================================================================
  1396. // ================================================================================
  1397. function newInfoWidget(id,title,boldTitle,text,height)
  1398. {
  1399. var o=newWidget(id)
  1400. o.title=title?title:""
  1401. o.boldTitle=boldTitle?boldTitle:""
  1402. o.text=text?text:""
  1403. o.height=(height!=null)?height:55
  1404. o.getHTML=InfoWidget_getHTML
  1405. o.setText=InfoWidget_setText
  1406. o.setTitle=InfoWidget_setTitle
  1407. o.setTitleBold=InfoWidget_setTitleBold
  1408. o.oldResize=o.resize
  1409. o.resize=InfoWidget_resize
  1410. o.textLayer=null
  1411. return o
  1412. }
  1413. // ================================================================================
  1414. function InfoWidget_setText(text,isHTML)
  1415. {
  1416. var o=this
  1417. text=text?text:""
  1418. o.text=text
  1419. if (o.layer)
  1420. {
  1421. var l=o.textLayer
  1422. if (l==null)
  1423. l=o.textLayer=getLayer('infozone_'+o.id)
  1424. if (l) l.innerHTML=isHTML?text:convStr(text,false,true)
  1425. }
  1426. }
  1427. // ================================================================================
  1428. function InfoWidget_setTitle(text)
  1429. {
  1430. var o=this
  1431. text=text?text:""
  1432. o.title=text
  1433. if (o.layer)
  1434. {
  1435. var l=o.titleLayer
  1436. if (l==null)
  1437. l=o.titleLayer=getLayer('infotitle_'+o.id)
  1438. if (l) l.innerHTML=convStr(text)
  1439. }
  1440. }
  1441. // ================================================================================
  1442. function InfoWidget_setTitleBold(text)
  1443. {
  1444. var o=this
  1445. text=text?text:""
  1446. o.boldTitle=text
  1447. if (o.layer)
  1448. {
  1449. var l=o.titleLayerBold
  1450. if (l==null)
  1451. l=o.titleLayerBold=getLayer('infotitlebold_'+o.id)
  1452. if (l) l.innerHTML=convStr(text)
  1453. }
  1454. }
  1455. // ================================================================================
  1456. function InfoWidget_getHTML()
  1457. {
  1458. var o=this
  1459. return '<div class="dialogzone" align="left" style="overflow:hidden;'+sty("width",o.width)+sty("height",""+o.height+"px")+'" id="'+o.id+'">'+
  1460. '<nobr>'+img(_skin+'../help.gif',16,16,'top',null,_helpLab)+
  1461. '<span class="dialogzone" style="padding-left:5px" id="infotitle_'+o.id+'">'+convStr(o.title)+'</span><span style="padding-left:5px" class="dialogzonebold" id="infotitlebold_'+o.id+'">'+convStr(o.boldTitle)+'</span></nobr>'+
  1462. '<br>'+getSpace(1,2)+
  1463. '<div class="infozone" align="left" id="infozone_'+o.id+'" style="height:'+(o.height-18-(_moz?10:0))+'px;overflow'+(_ie?'-y':'')+':auto">'+convStr(o.text,false,true)+'</div>'+
  1464. '</div>'
  1465. }
  1466. // ================================================================================
  1467. function InfoWidget_resize(w,h)
  1468. {
  1469. var o=this;
  1470. if (w!=null) o.w=w
  1471. if (h!=null) o.h=h
  1472. o.oldResize(w,h)
  1473. if (o.layer)
  1474. {
  1475. var l=o.textLayer
  1476. if (l==null)
  1477. l=o.textLayer=getLayer('infozone_'+o.id)
  1478. if (l)
  1479. {
  1480. if (o.h!=null) l.style.height=""+Math.max(0, o.h-(_ie?18:28))+"px"
  1481. }
  1482. }
  1483. }
  1484. // ================================================================================
  1485. // ================================================================================
  1486. //
  1487. // OBJECT newCheckWidget (Constructor)
  1488. //
  1489. // Check box widget
  1490. //
  1491. // ================================================================================
  1492. // ================================================================================
  1493. function newCheckWidget(id,text,changeCB,bold,imgUrl,imgW,imgH,bconvtext)
  1494. {
  1495. var o=newWidget(id)
  1496. o.text=text
  1497. o.convText=bconvtext
  1498. o.changeCB=changeCB
  1499. o.idCheckbox='check_'+id
  1500. o.checkbox=null
  1501. o.kind='checkbox'
  1502. o.name=o.idCheckbox
  1503. o.bold=bold
  1504. o.imgUrl=imgUrl
  1505. o.imgW=imgW
  1506. o.imgH=imgH
  1507. o.getHTML=CheckWidget_getHTML
  1508. o.setText=CheckWidget_setText
  1509. o.parentInit=Widget_init
  1510. o.init=CheckWidget_init
  1511. o.check=CheckWidget_check
  1512. o.isChecked=CheckWidget_isChecked
  1513. o.setDisabled=CheckWidget_setDisabled
  1514. o.isDisabled=CheckWidget_isDisabled
  1515. o.uncheckOthers=CheckWidget_uncheckOthers
  1516. o.isIndeterminate=CheckWidget_isIndeterminate
  1517. o.setIndeterminate=CheckWidget_setIndeterminate
  1518. o.layerClass=('dialogzone'+(o.bold?'bold':''))
  1519. o.nobr=true
  1520. return o
  1521. }
  1522. // ================================================================================
  1523. function CheckWidget_getHTML()
  1524. {
  1525. var o=this,cls=o.layerClass;
  1526. return '<table border="0" onselectstart="return false" cellspacing="0" cellpadding="0" class="'+cls+'"'+attr('id',o.id)+'>' +
  1527. '<tr valign="middle">'+
  1528. '<td style="height:20px;width:21px"><input style="margin:'+(_moz?3:0)+'px" onclick="'+_codeWinName+'.CheckWidget_changeCB(event,this)" ' +
  1529. 'type="'+o.kind+'"'+attr('id',o.idCheckbox)+attr('name',o.name)+'>' +
  1530. '</td>'+
  1531. (o.imgUrl?'<td><label style="padding-left:2px" for="'+o.idCheckbox+'">'+img(o.imgUrl,o.imgW,o.imgH)+'</label></td>':'')+
  1532. '<td>'+(o.nobr?'<nobr>':'')+'<label style="padding-left:'+ (o.imgUrl?4:2) +'px" id="label_'+o.id+'" for="'+o.idCheckbox+'">'+(o.convText?convStr(o.text):o.text)+'</label>'+(o.nobr?'</nobr>':'')+'</td>'+
  1533. '</tr></table>'
  1534. }
  1535. // ================================================================================
  1536. function CheckWidget_setText(s)
  1537. // Set the check text
  1538. // s [String] the new text
  1539. {
  1540. var o=this
  1541. o.text=s
  1542. if (o.layer)
  1543. {
  1544. if (o.labelLyr==null)
  1545. o.labelLyr=getLayer('label_'+o.id)
  1546. o.labelLyr.innerHTML=o.convText?convStr(s):s
  1547. }
  1548. }
  1549. function CheckWidget_init()
  1550. {
  1551. this.parentInit()
  1552. this.checkbox=getLayer(this.idCheckbox)
  1553. }
  1554. // ================================================================================
  1555. function CheckWidget_check(c) {this.checkbox.checked=c;if(c)this.uncheckOthers()}
  1556. function CheckWidget_isChecked() {return this.checkbox.checked}
  1557. function CheckWidget_changeCB(e,l) {var o=getWidget(l);o.uncheckOthers();if(o.changeCB) o.changeCB(e)}
  1558. function CheckWidget_setDisabled(d) {this.checkbox.disabled=d;if(_moz) this.checkbox.className=(d?'dialogzone':'')}
  1559. function CheckWidget_isDisabled(){ return this.checkbox.disabled }
  1560. function CheckWidget_uncheckOthers() {}
  1561. function CheckWidget_isIndeterminate() {return this.checkbox.indeterminate}
  1562. function CheckWidget_setIndeterminate(b) {this.checkbox.indeterminate=b}
  1563. // ================================================================================
  1564. // ================================================================================
  1565. //
  1566. // OBJECT newRadioWidget (Constructor)
  1567. //
  1568. // Class for radio buttons
  1569. //
  1570. // ================================================================================
  1571. // ================================================================================
  1572. function newRadioWidget(id,group,text,changeCB,bold,imgUrl,imgW,imgH,bconvtext)
  1573. {
  1574. var o=newCheckWidget(id,text,changeCB,bold,imgUrl,imgW,imgH,bconvtext)
  1575. o.kind='radio'
  1576. o.name=group
  1577. if (_RadioWidget_groups[group]==null)
  1578. _RadioWidget_groups[group]=new Array
  1579. o.groupInstance=_RadioWidget_groups[group]
  1580. var g=o.groupInstance
  1581. o.groupIdx=g.length
  1582. g[g.length]=o
  1583. o.uncheckOthers=RadioWidget_uncheckOthers
  1584. return o;
  1585. }
  1586. // ================================================================================
  1587. var _RadioWidget_groups=new Array
  1588. function RadioWidget_uncheckOthers()
  1589. {
  1590. var g=this.groupInstance,idx=this.groupIdx,len=g.length
  1591. for (var i=0;i<len;i++)
  1592. {
  1593. if (i!=idx)
  1594. {
  1595. var c=g[i].checkbox
  1596. if(c)
  1597. c.checked=false
  1598. }
  1599. }
  1600. }
  1601. // ================================================================================
  1602. // ================================================================================
  1603. //
  1604. // OBJECT newIconNoTextCheckWidget (Constructor)
  1605. //
  1606. // Class for icon only checkbox
  1607. //
  1608. // ================================================================================
  1609. // ================================================================================
  1610. /*
  1611. function newIconNoTextCheckWidget(id,changeCB,imgUrl,imgW,imgH,tooltip)
  1612. {
  1613. var o=newWidget(id)
  1614. o.changeCB=changeCB
  1615. o.idCheckbox='check_'+id
  1616. o.checkbox=null
  1617. o.kind='checkbox'
  1618. o.name=o.idCheckbox
  1619. o.imgUrl=imgUrl
  1620. o.imgW=imgW
  1621. o.imgH=imgH
  1622. o.tooltip=(tooltip?tooltip:"")
  1623. o.getHTML=IconNoTextCheckWidget_getHTML
  1624. o.parentInit=Widget_init
  1625. o.init=CheckWidget_init
  1626. o.check=CheckWidget_check
  1627. o.isChecked=CheckWidget_isChecked
  1628. o.setDisabled=CheckWidget_setDisabled
  1629. o.uncheckOthers=CheckWidget_uncheckOthers
  1630. return o
  1631. }
  1632. // ================================================================================
  1633. function IconNoTextCheckWidget_getHTML()
  1634. {
  1635. var o=this
  1636. return '<table border="0" onselectstart="return false" cellspacing="0" cellpadding="0" title= "'+ convStr(o.tooltip) + '" ' + attr('id',o.id) +'>' +
  1637. '<tr>'+
  1638. '<td align="center"><label style="padding-left:2px" for="'+o.idCheckbox+'">'+img(o.imgUrl,o.imgW,o.imgH, null, null, convStr(o.tooltip))+'</label></td>'+
  1639. '</tr>'+
  1640. '<tr>'+
  1641. '<td align="center"><input style="margin:'+(_moz?3:0)+'px" onclick="'+_codeWinName+'.CheckWidget_changeCB(event,this)" ' +
  1642. 'type="'+o.kind+'"'+attr('id',o.idCheckbox)+attr('name',o.name)+'>' +
  1643. '</td>'+
  1644. '</tr></table>'
  1645. }
  1646. // ================================================================================
  1647. // ================================================================================
  1648. //
  1649. // OBJECT newIconNoTextCheckWidget (Constructor)
  1650. //
  1651. // Class for icon only radio button
  1652. //
  1653. // ================================================================================
  1654. // ================================================================================
  1655. function newIconNoTextRadioWidget(id,group,changeCB,imgUrl,imgW,imgH,tooltip)
  1656. {
  1657. var tip = tooltip?tooltip:""
  1658. var o=newIconNoTextCheckWidget(id,changeCB,imgUrl,imgW,imgH,tip)
  1659. o.kind='radio'
  1660. o.name=group
  1661. if (_RadioWidget_groups[group]==null)
  1662. _RadioWidget_groups[group]=new Array
  1663. o.groupInstance=_RadioWidget_groups[group]
  1664. var g=o.groupInstance
  1665. o.groupIdx=g.length
  1666. g[g.length]=o
  1667. o.uncheckOthers=RadioWidget_uncheckOthers
  1668. return o;
  1669. }
  1670. */
  1671. // ================================================================================
  1672. // ================================================================================
  1673. //
  1674. // OBJECT newTextFieldWidget (Constructor)
  1675. //
  1676. // Text field widget
  1677. //
  1678. // ================================================================================
  1679. // ================================================================================
  1680. function newTextFieldWidget(id,changeCB,maxChar,keyUpCB,enterCB,noMargin,tooltip,width,focusCB,blurCB)
  1681. {
  1682. var o=newWidget(id)
  1683. o.tooltip=tooltip
  1684. o.changeCB=changeCB
  1685. o.maxChar=maxChar
  1686. o.keyUpCB=keyUpCB
  1687. o.enterCB=enterCB
  1688. o.noMargin=noMargin
  1689. o.width=width==null?null:''+width+'px'
  1690. o.focusCB=focusCB
  1691. o.blurCB=blurCB
  1692. o.disabled=false
  1693. o.getHTML=TextFieldWidget_getHTML
  1694. o.getValue=TextFieldWidget_getValue
  1695. o.setValue=TextFieldWidget_setValue
  1696. o.intValue=TextFieldWidget_intValue
  1697. o.intPosValue=TextFieldWidget_intPosValue
  1698. o.select=TextFieldWidget_select
  1699. o.setDisabled=TextFieldWidget_setDisabled
  1700. o.beforeChange=null
  1701. o.wInit=o.init
  1702. o.init=TextFieldWidget_init
  1703. o.oldValue=""
  1704. o.helpTxt=''
  1705. o.isHelpTxt=false
  1706. o.setHelpTxt=TextFieldWidget_setHelpTxt
  1707. o.eraseHelpTxt=TextFieldWidget_eraseHelpTxt
  1708. o.enterCancelBubble=true
  1709. return o
  1710. }
  1711. // ================================================================================
  1712. function TextFieldWidget_setDisabled(d)
  1713. {
  1714. var o=this
  1715. o.disabled=d
  1716. if (o.layer)
  1717. o.layer.disabled=d
  1718. }
  1719. // ================================================================================
  1720. function TextFieldWidget_init()
  1721. {
  1722. var o=this
  1723. o.wInit()
  1724. o.layer.value=""+ (o.oldValue != "")?o.oldValue : "";
  1725. if(o.helpTxt && !o.oldValue)
  1726. o.setHelpTxt(o.helpTxt);
  1727. }
  1728. // ================================================================================
  1729. function TextFieldWidget_getHTML()
  1730. {
  1731. var o=this
  1732. return '<input'+(o.disabled?' disabled':'')+' oncontextmenu="event.cancelBubble=true;return true" style="'+sty("width",this.width)+(_moz?'margin-top:1px;margin-bottom:1px;padding-left:2px;padding-right:2px;':'')+(_isQuirksMode? 'height:18px;' : 'height:14px;') + 'margin-left:'+(this.noMargin?0:10)+'px" onfocus="'+_codeWinName+'.TextFieldWidget_focus(this)" onblur="'+_codeWinName+'.TextFieldWidget_blur(this)" onchange="'+_codeWinName+'.TextFieldWidget_changeCB(event,this)" onkeydown=" return '+_codeWinName+'.TextFieldWidget_keyDownCB(event,this);" onkeyup=" return '+_codeWinName+'.TextFieldWidget_keyUpCB(event,this);" onkeypress=" return '+_codeWinName+'.TextFieldWidget_keyPressCB(event,this);" type="text" '+attr('maxLength',this.maxChar)+' ondragstart="event.cancelBubble=true;return true" onselectstart="event.cancelBubble=true;return true" class="textinputs" id="'+this.id+'" name="'+this.id+'"'+attr('title',this.tooltip)+' value="">'
  1733. }
  1734. // ================================================================================
  1735. function TextFieldWidget_getValue()
  1736. {
  1737. var o=this
  1738. if (o.isHelpTxt) {
  1739. return ''
  1740. }
  1741. else
  1742. {
  1743. return o.layer ? o.layer.value : o.oldValue
  1744. }
  1745. }
  1746. // ================================================================================
  1747. function TextFieldWidget_setValue(s)
  1748. {
  1749. var o=this
  1750. if (o.layer) {
  1751. o.eraseHelpTxt()
  1752. o.layer.value=''+s
  1753. } else {
  1754. o.oldValue=s
  1755. }
  1756. }
  1757. // ================================================================================
  1758. function TextFieldWidget_changeCB(e,l)
  1759. // PRIVATE
  1760. {
  1761. var o=getWidget(l)
  1762. o.eraseHelpTxt()
  1763. if(o.beforeChange)
  1764. o.beforeChange()
  1765. if(o.changeCB)
  1766. o.changeCB(e)
  1767. }
  1768. // ================================================================================
  1769. function TextFieldWidget_keyPressCB(e,l)
  1770. // PRIVATE
  1771. {
  1772. var o=getWidget(l)
  1773. if (eventGetKey(e)==13)
  1774. {
  1775. // Only non-IME enter key press will come here
  1776. o.enterKeyPressed = true;
  1777. return false;
  1778. }
  1779. else
  1780. {
  1781. o.enterKeyPressed = false;
  1782. }
  1783. return true
  1784. }
  1785. // ================================================================================
  1786. function TextFieldWidget_keyUpCB(e,l)
  1787. // PRIVATE
  1788. {
  1789. var o=getWidget(l)
  1790. o.eraseHelpTxt()
  1791. if (eventGetKey(e)==13 && o.enterKeyPressed) // Ignore the IME enter key up
  1792. {
  1793. if (o.beforeChange)
  1794. o.beforeChange()
  1795. if (o.enterCB)
  1796. {
  1797. if (o.enterCancelBubble)
  1798. eventCancelBubble(e)
  1799. o.enterCB(e)
  1800. }
  1801. return false
  1802. }
  1803. else if(o.keyUpCB)
  1804. {
  1805. o.keyUpCB(e)
  1806. }
  1807. o.enterKeyPressed = false;
  1808. return true
  1809. }
  1810. // ================================================================================
  1811. function TextFieldWidget_keyDownCB(e,l)
  1812. // PRIVATE
  1813. {
  1814. var o=getWidget(l)
  1815. o.eraseHelpTxt()
  1816. o.enterKeyPressed = false;
  1817. if (eventGetKey(e)==13)
  1818. {
  1819. return true
  1820. }
  1821. else if (eventGetKey(e)==8)//back space
  1822. {
  1823. eventCancelBubble(e);
  1824. }
  1825. return true;
  1826. }
  1827. // ================================================================================
  1828. function TextFieldWidget_eraseHelpTxt()
  1829. // PRIVATE
  1830. {
  1831. var o=this
  1832. if (o.isHelpTxt) o.layer.value= ""
  1833. o.isHelpTxt = false
  1834. o.layer.style.color="black"
  1835. }
  1836. // ================================================================================
  1837. function TextFieldWidget_focus(l)
  1838. // PRIVATE
  1839. {
  1840. var o=getWidget(l)
  1841. o.eraseHelpTxt()
  1842. if (o.focusCB)
  1843. o.focusCB()
  1844. }
  1845. // ================================================================================
  1846. function TextFieldWidget_blur(l)
  1847. // PRIVATE
  1848. {
  1849. var o=getWidget(l)
  1850. if(o.beforeChange)
  1851. o.beforeChange()
  1852. if (o.blurCB)
  1853. o.blurCB()
  1854. }
  1855. // ================================================================================
  1856. function TextFieldWidget_intValue(nanValue)
  1857. {
  1858. var n=parseInt(this.getValue())
  1859. return isNaN(n)?nanValue:n
  1860. }
  1861. // ================================================================================
  1862. function TextFieldWidget_intPosValue(nanValue)
  1863. {
  1864. var n=this.intValue(nanValue)
  1865. return (n<0)?nanValue:n
  1866. }
  1867. // ================================================================================
  1868. function TextFieldWidget_select()
  1869. {
  1870. this.layer.select()
  1871. }
  1872. // ================================================================================
  1873. function TextFieldWidget_setHelpTxt(h)
  1874. {
  1875. var o=this
  1876. o.helpTxt=h
  1877. if (o.layer && (o.layer.value == ""))
  1878. {
  1879. o.isHelpTxt=true
  1880. o.layer.value=h
  1881. o.layer.style.color="#808080"
  1882. }
  1883. }
  1884. // ================================================================================
  1885. // ================================================================================
  1886. //
  1887. // OBJECT newIntFieldWidget (Constructor)
  1888. //
  1889. // Text field widget that handles integer numeric values
  1890. //
  1891. // ================================================================================
  1892. // ================================================================================
  1893. function newIntFieldWidget(id,changeCB,maxChar,keyUpCB,enterCB,noMargin,tooltip,width,customCheckCB)
  1894. {
  1895. var o=newTextFieldWidget(id,changeCB,maxChar,keyUpCB,enterCB,noMargin,tooltip,width)
  1896. o.min=-Number.MAX_VALUE
  1897. o.max=Number.MAX_VALUE
  1898. o.customCheckCB=customCheckCB // Returns a boolean
  1899. o.setMin=IntFieldWidget_setMin
  1900. o.setMax=IntFieldWidget_setMax
  1901. o.setValue=IntFieldWidget_setValue
  1902. o.beforeChange=IntFieldWidget_checkChangeCB
  1903. o.value=''
  1904. return o
  1905. }
  1906. // ================================================================================
  1907. function IntFieldWidget_setMin(min)
  1908. {
  1909. if (!isNaN(min))
  1910. this.min=min
  1911. }
  1912. // ================================================================================
  1913. function IntFieldWidget_setMax(max)
  1914. {
  1915. if (!isNaN(max))
  1916. this.max=max
  1917. }
  1918. // ================================================================================
  1919. function IntFieldWidget_setValue(s)
  1920. {
  1921. var o=this,l=o.layer
  1922. s = '' + s
  1923. if (s =='')
  1924. {
  1925. if (l)
  1926. l.value= ''
  1927. o.oldValue = ''
  1928. return
  1929. }
  1930. var n=parseInt(s)
  1931. value = ''
  1932. if (!isNaN(n) && (n >= o.min) && (n <= o.max) && ((o.customCheckCB==null) || o.customCheckCB(n))) {
  1933. value = n
  1934. o.oldValue = value
  1935. } else {
  1936. if (o.oldValue)
  1937. value = o.oldValue
  1938. }
  1939. if (l)
  1940. l.value= '' + value
  1941. }
  1942. // ================================================================================
  1943. function IntFieldWidget_checkChangeCB()
  1944. {
  1945. var o=this
  1946. o.setValue(o.layer.value)
  1947. }
  1948. // ================================================================================
  1949. // ================================================================================
  1950. //
  1951. // OBJECT newFloatFieldWidget (Constructor)
  1952. //
  1953. // Text field widget that handles floating point numeric values
  1954. //
  1955. // ================================================================================
  1956. // ================================================================================
  1957. /*
  1958. function newFloatFieldWidget(id,changeCB,maxChar,keyUpCB,enterCB,noMargin,tooltip,width,customCheckCB)
  1959. {
  1960. var o=newIntFieldWidget(id,changeCB,maxChar,keyUpCB,enterCB,noMargin,tooltip,width)
  1961. o.setValue=FloatFieldWidget_setValue
  1962. o.customCheckCB=customCheckCB // Returns a boolean
  1963. o.setPrecision=FloatFieldWidget_setPrecision
  1964. o.toPrecision=FloatFieldWidget_toPrecision
  1965. o.setSeparator=FloatFieldWidget_setSeparator
  1966. o.beforeChange=FloatFieldWidget_checkChangeCB
  1967. o.precision=10 // default precision !!is it enough?
  1968. o.sep='.' // default separator
  1969. return o
  1970. }
  1971. // ================================================================================
  1972. function FloatFieldWidget_setValue(s)
  1973. {
  1974. var o=this,l=o.layer
  1975. s = '' + s
  1976. if (s =='')
  1977. {
  1978. if (l)
  1979. l.value= ''
  1980. o.oldValue = ''
  1981. return
  1982. }
  1983. var n=parseFloat(s)
  1984. value = ''
  1985. if (!isNaN(n) && (n >= o.min) && (n <= o.max) && ((o.customCheckCB==null) || o.customCheckCB(n))) {
  1986. value = '' + o.toPrecision(n)
  1987. o.oldValue = value
  1988. } else {
  1989. if (o.oldValue)
  1990. value = o.oldValue
  1991. }
  1992. if (l)
  1993. l.value = value
  1994. }
  1995. // ================================================================================
  1996. function FloatFieldWidget_toPrecision(n)
  1997. {
  1998. var o=this
  1999. n = '' + n
  2000. var nAr = n.split(o.sep)
  2001. if (nAr.length == 1) return nAr[0]
  2002. var dec = (nAr[1].length >= o.precision)? nAr[1].substr(0, o.precision) : nAr[1]
  2003. return nAr[0] + o.sep + dec
  2004. }
  2005. // ================================================================================
  2006. function FloatFieldWidget_checkChangeCB()
  2007. {
  2008. var o=this
  2009. o.setValue(o.layer.value)
  2010. }
  2011. // ================================================================================
  2012. function FloatFieldWidget_setPrecision(p)
  2013. {
  2014. this.precision=p
  2015. }
  2016. // ================================================================================
  2017. function FloatFieldWidget_setSeparator(s)
  2018. {
  2019. this.sep=s
  2020. }
  2021. // ================================================================================
  2022. // ================================================================================
  2023. //
  2024. // OBJECT newTextAreaWidget (Constructor)
  2025. //
  2026. // Text Area widget
  2027. //
  2028. // ================================================================================
  2029. // ================================================================================
  2030. function newTextAreaWidget(id,rows,cols,tooltip,changeCB,enterCB,cancelCB)
  2031. {
  2032. var o=newWidget(id)
  2033. o.rows=rows
  2034. o.cols=cols
  2035. o.allowCR=true
  2036. o.tooltip=tooltip
  2037. o.changeCB=changeCB
  2038. o.enterCB=enterCB
  2039. o.cancelCB=cancelCB
  2040. o.getHTML=TextAreaWidget_getHTML
  2041. o.getValue=TextAreaWidget_getValue
  2042. o.setValue=TextAreaWidget_setValue
  2043. o.resize=TextAreaWidget_resize
  2044. o.wInit=o.init
  2045. o.init=TextAreaWidget_init
  2046. o.oldValue=""
  2047. if ((o.rows!=null)&&!_ie&&!_saf)
  2048. o.rows--
  2049. return o
  2050. }
  2051. // ================================================================================
  2052. function TextAreaWidget_init()
  2053. {
  2054. var o=this
  2055. o.wInit()
  2056. o.layer.value=""+o.oldValue
  2057. }
  2058. // ================================================================================
  2059. function TextAreaWidget_getHTML()
  2060. {
  2061. return '<textarea oncontextmenu="event.cancelBubble=true;return true" id="'+this.id+'" '+attr('title',this.tooltip)+ 'rows="'+this.rows+'" cols="'+this.cols+'" class="textinputs" value="" onkeydown="return '+_codeWinName+'.TextAreaWidget_keyDownCB(event,this)" ondragstart="event.cancelBubble=true;return true" onselectstart="event.cancelBubble=true;return true" ></textarea>'
  2062. }
  2063. // ================================================================================
  2064. function TextAreaWidget_getValue()
  2065. {
  2066. return this.layer.value
  2067. }
  2068. // ================================================================================
  2069. function TextAreaWidget_setValue(s)
  2070. {
  2071. if (this.layer)
  2072. this.layer.value=''+s
  2073. else
  2074. this.oldValue=s
  2075. }
  2076. // ================================================================================
  2077. function TextAreaWidget_resize(lines,cols)
  2078. {
  2079. var o=this
  2080. if(lines && lines >0) o.layer.rows=lines
  2081. if(cols && cols>0) o.layer.cols=cols
  2082. }
  2083. // ================================================================================
  2084. function TextAreaWidget_keyDownCB(e,l)
  2085. {
  2086. var key = eventGetKey(e),o=getWidget(l)
  2087. if (key==13)//enter
  2088. {
  2089. if (o.enterCB)
  2090. {
  2091. eventCancelBubble(e)
  2092. o.enterCB(e)
  2093. }
  2094. else if (o.allowCR)
  2095. {
  2096. eventCancelBubble(e);
  2097. //change in textarea
  2098. setTimeout("TextAreaWidget_delayedChangeCB("+key+","+o.widx+")",1)
  2099. }
  2100. return o.allowCR;
  2101. }
  2102. else if(key==27)//escape
  2103. {
  2104. if(o.cancelCB)
  2105. return o.cancelCB(e)
  2106. else
  2107. return true;
  2108. }
  2109. else if(key == 8)// back space
  2110. {
  2111. eventCancelBubble(e);
  2112. //change in textarea
  2113. setTimeout("TextAreaWidget_delayedChangeCB("+key+","+o.widx+")",1)
  2114. return true;
  2115. }
  2116. else
  2117. {
  2118. //setTimeout to be sure that the key is writen in the textarea
  2119. //we do not use the keyup event because of rapid keyboard pression
  2120. setTimeout("TextAreaWidget_delayedChangeCB("+key+","+o.widx+")",1)
  2121. return true;
  2122. }
  2123. }
  2124. // ================================================================================
  2125. function TextAreaWidget_delayedChangeCB(key,widx)
  2126. {
  2127. var o=_widgets[widx]
  2128. if (o.changeCB)
  2129. o.changeCB(key)
  2130. }
  2131. */
  2132. // ================================================================================
  2133. // ================================================================================
  2134. //
  2135. // OBJECT newFrameZoneWidget (Constructor)
  2136. //
  2137. // Text field widget that handles floating point numeric values
  2138. //
  2139. // ================================================================================
  2140. // ================================================================================
  2141. function newFrameZoneWidget(id,w,h,reverse)
  2142. {
  2143. var o=newWidget(id)
  2144. o.w=(w!=null)?""+Math.max(0,w-10)+"px":null
  2145. o.h=(h!=null)?""+Math.max(0,h-10)+"px":null
  2146. o.reverse=(reverse!=null)?reverse:false
  2147. o.cont=null
  2148. o.beginHTML=FrameZoneWidget_beginHTML
  2149. o.endHTML=FrameZoneWidget_endHTML
  2150. o.oldResize=o.resize
  2151. o.resize=FrameZoneWidget_resize
  2152. return o
  2153. }
  2154. // ================================================================================
  2155. function FrameZoneWidget_resize(w,h)
  2156. {
  2157. var o=this
  2158. var d=o.layer.display!="none"
  2159. if (d&_moz&&!_saf)
  2160. o.setDisplay(false)
  2161. o.oldResize(w,h)
  2162. if (d&_moz&&!_saf)
  2163. o.setDisplay(true)
  2164. }
  2165. // ================================================================================
  2166. function FrameZoneWidget_beginHTML()
  2167. {
  2168. var o=this
  2169. return '<table style="'+sty("width",o.w)+sty("height",o.h)+'" id="'+o.id+'" cellspacing="0" cellpadding="0" border="0"><tbody>'+
  2170. '<tr height="5">'+
  2171. '<td width="5">'+imgOffset(_skin+'dialogframe.gif',5,5,o.reverse?10:0,0)+'</td>'+
  2172. '<td style="'+backImgOffset(_skin+"dialogframetopbottom.gif",0,o.reverse?10:0)+'"></td>'+
  2173. '<td width="5">'+imgOffset(_skin+'dialogframe.gif',5,5,o.reverse?15:5,0)+'</td>'+
  2174. '</tr>'+
  2175. '<tr><td style="'+backImgOffset(_skin+"dialogframeleftright.gif",o.reverse?10:0,0)+'"></td><td valign="top" class="dialogzone" id="frame_cont_'+o.id+'">'
  2176. }
  2177. // ================================================================================
  2178. function FrameZoneWidget_endHTML()
  2179. {
  2180. var o=this
  2181. return '</td><td style="'+backImgOffset(_skin+"dialogframeleftright.gif",o.reverse?15:5,0)+'"></td></tr>'+
  2182. '<tr height="5">'+
  2183. '<td>'+imgOffset(_skin+'dialogframe.gif',5,5,o.reverse?10:0,5)+'</td>'+
  2184. '<td style="'+backImgOffset(_skin+"dialogframetopbottom.gif",0,o.reverse?15:5)+'"></td>'+
  2185. '<td>'+imgOffset(_skin+'dialogframe.gif',5,5,o.reverse?15:5,5)+'</td>'+
  2186. '</tr>'+
  2187. '</tbody></table>'
  2188. }
  2189. // ================================================================================
  2190. // ================================================================================
  2191. //
  2192. // OBJECT newBOColor (Constructor)
  2193. //
  2194. // Color object
  2195. //
  2196. // ================================================================================
  2197. // ================================================================================
  2198. /*
  2199. function newBOColor(r,g,b)
  2200. {
  2201. var o=new Object;
  2202. if (r && (g==null) && (b==null))
  2203. {
  2204. s = r.split(",")
  2205. o.r=parseInt(s[0])
  2206. o.g=parseInt(s[1])
  2207. o.b=parseInt(s[2])
  2208. }
  2209. else
  2210. {
  2211. o.r=r
  2212. o.g=g
  2213. o.b=b
  2214. }
  2215. o.set=BOColor_set
  2216. o.getCopy=BOColor_getCopy
  2217. o.getStringDef=BOColor_getStringDef
  2218. o.getStyleColor=BOColor_getStyleColor
  2219. return o;
  2220. }
  2221. // ================================================================================
  2222. function BOColor_getStringDef()
  2223. {
  2224. var o=this
  2225. return ""+o.r+","+o.g+","+o.b
  2226. }
  2227. // ================================================================================
  2228. function BOColor_getCopy()
  2229. {
  2230. var f=this
  2231. var o=newBOColor(f.r,f.g,f.b)
  2232. return o;
  2233. }
  2234. // ================================================================================
  2235. function BOColor_set(r,g,b)
  2236. {
  2237. this.r=r
  2238. this.g=g
  2239. this.b=b
  2240. }
  2241. // ================================================================================
  2242. function BOColor_getStyleColor()
  2243. {
  2244. var o=this
  2245. // if undefined
  2246. if (o.r == -1 || o.r == null) return null;
  2247. if (o.g == -1 || o.g == null) return null;
  2248. if (o.b == -1 || o.b == null) return null;
  2249. return "rgb(" + o.r + "," + o.g + "," + o.b + ")"
  2250. }
  2251. // ================================================================================
  2252. // ================================================================================
  2253. //
  2254. // PRIVATE OBJECT newDragDropData (Constructor)
  2255. //
  2256. // Generic object fo Drag and drop support.
  2257. //
  2258. // ================================================================================
  2259. // ================================================================================
  2260. function newDragDropData(widget,dragStartCB,dragCB,dragEndCB,acceptDropCB,leaveDropCB,dropCB)
  2261. // void dragStartCB (source,layer)
  2262. // void dragCB (source,layer, shift)
  2263. // void dragEndCB (source,layer)
  2264. // boolean acceptDropCB (source, target, ctrl, shift, layer, enter)
  2265. // void leaveDropCB (source, target, ctrl, shift, layer)
  2266. // void dropCB (source, target, ctrl, shift, layer)
  2267. {
  2268. var o=new Object
  2269. o.widget=widget
  2270. o.dragStartCB=dragStartCB
  2271. o.dragCB=dragCB
  2272. o.dragEndCB=dragEndCB
  2273. o.acceptDropCB=acceptDropCB
  2274. o.leaveDropCB=leaveDropCB
  2275. o.dropCB=dropCB
  2276. o.attachCallbacks=DragDropData_attachCallbacks
  2277. o.id=_ddData.length
  2278. _ddData[o.id]=o
  2279. return o
  2280. }
  2281. // ================================================================================
  2282. function DragDropData_attachCallbacks(lyr,onlyDrop)
  2283. {
  2284. if (_ie)
  2285. {
  2286. onlyDrop=(onlyDrop==null)?false:onlyDrop
  2287. if (!onlyDrop)
  2288. {
  2289. lyr.ondragstart=DDD_dragStart
  2290. lyr.ondragend=DDD_dragEnd
  2291. }
  2292. lyr.ondrop=DDD_drop
  2293. lyr.ondragleave=DDD_dragLeave
  2294. lyr.ondragover=DDD_dragOver
  2295. lyr.ondrag=DDD_drag
  2296. lyr._dragDropData=this.id
  2297. }
  2298. }
  2299. // ================================================================================
  2300. function DDD_dragStart()
  2301. {
  2302. var e=_curWin.event,dt=e.dataTransfer
  2303. dt.effectAllowed='copyMove'
  2304. dt.dropEffect=_curWin.event.ctrlKey?'copy':'move'
  2305. var o=_ddData[this._dragDropData]
  2306. o.dragStartCB(o.widget,this)
  2307. window._globalDDD=o.widget
  2308. e.cancelBubble=true
  2309. }
  2310. // ================================================================================
  2311. function DDD_drag()
  2312. {
  2313. var e=_curWin.event,dt=e.dataTransfer
  2314. dt.dropEffect=e.ctrlKey?'copy':'move'
  2315. var o=_ddData[this._dragDropData]
  2316. o.dragCB(o.widget,this,e.ctrlKey?false:e.shiftKey)
  2317. e.cancelBubble=true
  2318. }
  2319. // ================================================================================
  2320. function DDD_dragEnd()
  2321. {
  2322. var o=_ddData[this._dragDropData]
  2323. o.dragEndCB(o.widget,this)
  2324. window._globalDDD=null
  2325. }
  2326. // ================================================================================
  2327. function DDD_dragEnter()
  2328. {
  2329. DDD_dragOverEnter(this,true)
  2330. }
  2331. // ================================================================================
  2332. function DDD_dragOver()
  2333. {
  2334. DDD_dragOverEnter(this,false)
  2335. }
  2336. // ================================================================================
  2337. function DDD_dragOverEnter(layer,isEnter)
  2338. {
  2339. var o=_ddData[layer._dragDropData],e=_curWin.event
  2340. e.dataTransfer.dropEffect=e.ctrlKey?'copy':'move'
  2341. var o=_ddData[layer._dragDropData];
  2342. if (o.acceptDropCB(window._globalDDD,o.widget,e.ctrlKey,e.ctrlKey?false:e.shiftKey,layer,isEnter))
  2343. e.returnValue=false
  2344. e.cancelBubble=true
  2345. }
  2346. // ================================================================================
  2347. function DDD_dragLeave()
  2348. {
  2349. var o=_ddData[this._dragDropData],e=_curWin.event
  2350. o.leaveDropCB(window._globalDDD,o.widget,e.ctrlKey,e.ctrlKey?false:e.shiftKey,this)
  2351. }
  2352. // ================================================================================
  2353. function DDD_drop()
  2354. {
  2355. var o=_ddData[this._dragDropData],e=_curWin.event
  2356. o.dropCB(window._globalDDD,o.widget,e.ctrlKey,e.ctrlKey?false:e.shiftKey,this)
  2357. window._globalDDD=null
  2358. e.cancelBubble=true
  2359. }
  2360. */
  2361. // ================================================================================
  2362. // ================================================================================
  2363. //
  2364. // GLOBAL FUNCTIONS : ARRAYS
  2365. //
  2366. // Dynamic array management
  2367. //
  2368. // ================================================================================
  2369. // ================================================================================
  2370. function arrayAdd(obj,fieldName,item,idx)
  2371. {
  2372. var array=obj[fieldName],len=array.length
  2373. if ((idx==null)||(typeof idx!="number")) idx=-1
  2374. if ((idx<0)||(idx>len)) idx=len
  2375. if (idx!=len)
  2376. {
  2377. var end=array.slice(idx)
  2378. array.length=idx+1
  2379. array[idx]=item
  2380. array=array.concat(end)
  2381. }
  2382. else array[idx]=item
  2383. obj[fieldName]=array
  2384. return idx
  2385. }
  2386. // ================================================================================
  2387. function arrayRemove(obj,fieldName,idx)
  2388. {
  2389. var array=obj[fieldName],last=array.length-1
  2390. if (idx==null)
  2391. {
  2392. array.length=0
  2393. obj[fieldName]=array
  2394. return -1
  2395. }
  2396. if ((idx<0)||(idx>last)) return -1
  2397. if (idx==last) array.length=last
  2398. else
  2399. {
  2400. var end=array.slice(idx+1)
  2401. array.length=idx
  2402. array=array.concat(end)
  2403. }
  2404. obj[fieldName]=array
  2405. return idx
  2406. }
  2407. // ================================================================================
  2408. function arrayMove(obj,fieldName,i,j)
  2409. {
  2410. var array=obj[fieldName],len=array.length
  2411. if ((i<0)||(i>=len)||(j<0)||(j>=len)) return false
  2412. var old=array[i]
  2413. arrayRemove(obj,fieldName,i)
  2414. arrayAdd(obj,fieldName,old,j)
  2415. return true;
  2416. }
  2417. // ================================================================================
  2418. function arrayGetCopy(arr)
  2419. {
  2420. var o=new Array,len=arr.length;
  2421. for (var i=0;i<len;i++)
  2422. o[i]=arr[i]
  2423. return o;
  2424. }
  2425. // ================================================================================
  2426. function arrayFind(obj,fieldName,v,subfield)
  2427. //return the index of value in array
  2428. {
  2429. var array=obj[fieldName],len=array.length;
  2430. for (var i=0;i<len;i++)
  2431. {
  2432. if(subfield)
  2433. {
  2434. if (array[i][subfield] == v) return i;
  2435. }
  2436. else
  2437. if(array[i]==v) return i;
  2438. }
  2439. return -1;
  2440. }
  2441. // ================================================================================
  2442. // ================================================================================
  2443. //
  2444. // GLOBAL FUNCTIONS : FRAMES
  2445. //
  2446. // Frame functions
  2447. //
  2448. // ================================================================================
  2449. // ================================================================================
  2450. function getFrame(name,par)
  2451. {
  2452. if (par==null) par=self
  2453. var frames=par.frames,w=eval("frames."+name)
  2454. if (w==null) return w
  2455. var l=frames.length
  2456. for (var i=0;i<l;i++)
  2457. {
  2458. w=frames[i]
  2459. try {
  2460. if (w.name==name)
  2461. return w
  2462. } catch (exc) {
  2463. // keep on
  2464. }
  2465. }
  2466. return null
  2467. }
  2468. // ================================================================================
  2469. function frameNav(name,url,fillHistory,par,noRefreshDrillBar)
  2470. // par [window optional]
  2471. {
  2472. var fr=null
  2473. if (noRefreshDrillBar & name=="Report")
  2474. {
  2475. var topfs=getTopFrameset();
  2476. fr=topfs.getReportFrame()
  2477. } else {
  2478. fr=getFrame(name,par)
  2479. }
  2480. if (fr) {
  2481. var l=fr.location
  2482. if (fillHistory)
  2483. l.href=url
  2484. else
  2485. l.replace(url)
  2486. } else {
  2487. var lay = document.getElementById(name)
  2488. if (lay)
  2489. lay.src=url;
  2490. }
  2491. }
  2492. // ================================================================================
  2493. /*
  2494. function genericIframeNav(url,fillHistory)
  2495. {
  2496. var l = getDynamicBGIFrameLayer()
  2497. if (fillHistory)
  2498. {
  2499. l.href=url
  2500. } else {
  2501. l.replace(url)
  2502. }
  2503. }
  2504. */
  2505. // ================================================================================
  2506. function frameGetUrl(win)
  2507. {
  2508. return win.location.href
  2509. }
  2510. // ================================================================================
  2511. function frameReload(win)
  2512. {
  2513. var loc=win.location
  2514. loc.replace(loc.href)
  2515. }
  2516. // ================================================================================
  2517. function setTopFrameset()
  2518. // Marks the current window as a "top frameset"
  2519. // returns [void]
  2520. {
  2521. _curWin._topfs="topfs"
  2522. }
  2523. // ================================================================================
  2524. function getTopFrameset(f)
  2525. // get int the parents window the one marked as "top frameset"
  2526. // returns [window] the top frameset, or null if not
  2527. {
  2528. if(f == null)
  2529. f = self
  2530. if(f._topfs=="topfs")
  2531. {
  2532. return f;
  2533. }
  2534. else
  2535. {
  2536. if(f!= top)
  2537. return getTopFrameset(f.parent)
  2538. else
  2539. return null;
  2540. }
  2541. }
  2542. // ================================================================================
  2543. // ================================================================================
  2544. //
  2545. // GLOBAL FUNCTIONS : UTILITY FUNCTIONS
  2546. //
  2547. // Frame functions
  2548. //
  2549. // ================================================================================
  2550. // ================================================================================
  2551. function convStr(s,nbsp,br)
  2552. {
  2553. s=""+s
  2554. var ret=s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")
  2555. if (nbsp)
  2556. ret=ret.replace(/ /g,"&nbsp;")
  2557. if (br)
  2558. ret=ret.replace(/\n/g,"<br>")
  2559. return ret
  2560. }
  2561. // ================================================================================
  2562. function escapeCR(s)
  2563. {
  2564. s=""+s
  2565. var ret=s.replace(/\r/g,"").replace(/\n/g,"\\n");
  2566. return ret
  2567. }
  2568. // ================================================================================
  2569. function addDblClickCB(l,cb)
  2570. // Adds a function double click event handler. fixes a Netscape bug
  2571. // l [layer] the layer
  2572. // cb [Function] the double click function handler
  2573. {
  2574. if (l.addEventListener && !_saf) {// ADAPT00521043 for Safari : Bug 7790: ondblclick doesn't fire when attached with addEventListener
  2575. l.addEventListener("dblclick",cb,false)
  2576. } else {
  2577. l.ondblclick=cb
  2578. }
  2579. }
  2580. // ================================================================================
  2581. function img(src,w,h,align,att,alt)
  2582. // get the HTML of an image
  2583. // src [String] the combined image url
  2584. // w [int] the width
  2585. // h [int] the height
  2586. // align [String optional] image alignment
  2587. // att [String optional] optional attributes (do no use style & alt & align attribute)
  2588. // alt [String optional] image tooltip
  2589. {
  2590. att=(att?att:'')
  2591. if (alt==null) alt=''
  2592. return '<img'+attr('width',w)+attr('height',h)+attr('src', src)+attr('alt',alt)+attr("align", align)+' border="0" hspace="0" vspace="0" '+(att?att:'')+'>'
  2593. }
  2594. // ================================================================================
  2595. function imgOffset(url,w,h,dx,dy,id,att,alt,st,align)
  2596. // get the HTML of an image that display only a part of a bigger one
  2597. // url [String] the combined image url
  2598. // w [int] the VISIBLE width
  2599. // h [int] the VISIBLE height
  2600. // dx [int] the horizontal offset in combined image
  2601. // dy [int] the vertical offset in combined image
  2602. // id [String optional] the DOM id
  2603. // att [String optional] optional attributes (do no use style & alt & align attribute)
  2604. // alt [String optional] image tooltip
  2605. // st [String optional] optional style attributes
  2606. // align [String optional] image alignment
  2607. {
  2608. return img(_skin+'../transp.gif',w,h,align,
  2609. (att?att:'') +' '+attr('id',id)+' style="float:left;'+backImgOffset(url,dx,dy)+(st?st:'')+'"',
  2610. alt)
  2611. }
  2612. // ================================================================================
  2613. function simpleImgOffset(url,w,h,dx,dy,id,att,alt,st,align)
  2614. // get the HTML of an image that display only a part of a bigger one
  2615. // url [String] the combined image url
  2616. // w [int] the VISIBLE width
  2617. // h [int] the VISIBLE height
  2618. // dx [int] the horizontal offset in combined image
  2619. // dy [int] the vertical offset in combined image
  2620. // id [String optional] the DOM id
  2621. // att [String optional] optional attributes (do no use style & alt & align attribute)
  2622. // alt [String optional] image tooltip
  2623. // st [String optional] optional style attributes
  2624. // align [String optional] optional style attributes
  2625. {
  2626. if (_ie)
  2627. {
  2628. if (dx==null) dx=0
  2629. if (dy==null) dy=0
  2630. return '<div '+(att?att:'')+' '+attr("id",id)+' style="position:relative;padding:0px;width:'+w+'px;height:'+h+'px;overflow:hidden;'+(st?st:'')+'">'+img(url,null,null,(align?align:'top'),'style="margin:0px;position:relative;top:'+(-dy)+'px;left:'+(-dx)+'px"',alt)+'</div>'
  2631. }
  2632. else
  2633. return imgOffset(url,w,h,dx,dy,id,att,alt,st,align)
  2634. }
  2635. // ================================================================================
  2636. function changeSimpleOffset(lyr,dx,dy,url,alt)
  2637. // Generate a background image with a given offset
  2638. // ONLY APPLIES TO HTML GENRATED BY simpleImgOffset !!
  2639. // url [String] the combined image url
  2640. // dx [int] the horizontal offset in combined image
  2641. // dy [int] the vertical offset in combined image
  2642. {
  2643. if (_ie)
  2644. {
  2645. lyr=lyr.childNodes[0]
  2646. var st=lyr.style
  2647. if ((url!=null)&&(url!=lyr.src))
  2648. lyr.src=url
  2649. if (dx!=null)
  2650. st.left=""+(-dx)+"px"
  2651. if (dy!=null)
  2652. st.top=""+(-dy)+"px"
  2653. if (alt!=null)
  2654. {
  2655. lyr.title=alt
  2656. lyr.alt = alt;
  2657. }
  2658. }
  2659. else
  2660. changeOffset(lyr,dx,dy,url,alt)
  2661. }
  2662. // ================================================================================
  2663. function backImgOffset(url,dx,dy)
  2664. // Generate a background image with a given offset
  2665. // url [String] the combined image url
  2666. // dx [int] the horizontal offset in combined image
  2667. // dy [int] the vertical offset in combined image
  2668. {
  2669. return 'background-image:url(\''+url+'\');background-position:'+(-dx)+'px '+(-dy)+'px;'
  2670. }
  2671. // ================================================================================
  2672. function changeOffset(lyr,dx,dy,url,alt)
  2673. // Change the offset in backgroung image (and eventually the image)
  2674. // lyr [layer] the layer
  2675. // dx [int] the horizontal offset in combined image
  2676. // dy [int] the vertical offset in combined image
  2677. // url [String - Optional] the combined image url
  2678. {
  2679. var st=lyr.style
  2680. if (st)
  2681. {
  2682. if ((dx!=null)&&(dy!=null))
  2683. st.backgroundPosition=''+(-dx)+'px '+(-dy)+'px'
  2684. if (url)
  2685. st.backgroundImage='url(\''+url+'\')'
  2686. }
  2687. if(alt) lyr.title=alt
  2688. }
  2689. // ================================================================================
  2690. function includeScript(url)
  2691. // Include a script
  2692. {
  2693. document.write('<scr'+'ipt language="javascript" charset="UTF-8" src="'+url+'"><\/scr'+'ipt>')
  2694. }
  2695. // ================================================================================
  2696. function includeCSS(css,noskin)
  2697. // Include the CSS related to the current skin
  2698. // css [String] file name with no extension
  2699. // noskin [boolean optional] if true, search in the parent folder
  2700. {
  2701. if(typeof(_style) == 'string' && _style != "")
  2702. {
  2703. var url=""
  2704. if( noskin )
  2705. url=_style+'../'+css
  2706. else
  2707. url=_style+css
  2708. url+='.css'
  2709. _curDoc.write('<li'+'nk rel="stylesheet" type="text/css" href="'+url+'">')
  2710. }
  2711. }
  2712. // ================================================================================
  2713. function getLayer(id)
  2714. // Get a layer from its ID
  2715. // id [String] the id
  2716. {
  2717. return _curDoc.getElementById(id)
  2718. }
  2719. // ================================================================================
  2720. function setLayerTransp(lyr,percent)
  2721. // lyr [Object] : the layer
  2722. // percent [number] : the opacity 0 .. 100
  2723. {
  2724. if (_ie)
  2725. lyr.style.filter=(percent==null) ? "" : "progid:DXImageTransform.Microsoft.Alpha( style=0,opacity="+percent+")"
  2726. else
  2727. lyr.style.MozOpacity=(percent==null) ? 1 : percent/100
  2728. }
  2729. // ================================================================================
  2730. function getPos(el,relTo)
  2731. // Get the layer position in pixels
  2732. // returns an object with (x,y) int fields
  2733. {
  2734. relTo = relTo?relTo:null
  2735. for (var lx=0,ly=0;(el!=null)&&(el!=relTo);
  2736. lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
  2737. return {x:lx,y:ly}
  2738. }
  2739. // ================================================================================
  2740. // Gets the position of el relativeto relTo
  2741. // it fixes the cases where Safari with doctype fails
  2742. function getPos2(el,relTo) {
  2743. var relTo = relTo?relTo:null
  2744. var posX = 0;
  2745. var posY = 0;
  2746. while(el.parentNode || el.offsetParent) {
  2747. if(el.offsetParent) {
  2748. posX +=el.offsetLeft;
  2749. posY += el.offsetTop;
  2750. el = el.offsetParent;
  2751. }
  2752. else if(el.parentNode) {
  2753. if(el.style) {
  2754. if(el.style.left) {
  2755. posX += el.style.left;
  2756. }
  2757. if(el.style.top) {
  2758. posY += el.style.top;
  2759. }
  2760. }
  2761. el = el.parentNode;
  2762. }
  2763. else {
  2764. break;
  2765. }
  2766. }
  2767. if(relTo) {
  2768. relToCord = getPos2(relTo);
  2769. posX -= relToCord.x;
  2770. posY -= relToCord.y;
  2771. }
  2772. return {x:posX,y:posY};
  2773. }
  2774. // ================================================================================
  2775. function getPosScrolled(el,relTo)
  2776. // Get the layer position in pixels
  2777. // returns an object with (x,y) int fields
  2778. {
  2779. relTo = relTo?relTo:null
  2780. if (_ie)
  2781. {
  2782. for (var lx=0,ly=0;(el!=null)&&(el!=relTo);
  2783. lx+=el.offsetLeft-el.scrollLeft,ly+=el.offsetTop-el.scrollTop,el=el.offsetParent);
  2784. }
  2785. else
  2786. {
  2787. var oldEl=el
  2788. for (var lx=0,ly=0;(el!=null)&&(el!=relTo);
  2789. lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
  2790. for (el=oldEl;(el!=null)&&(el!=relTo);el=el.parentNode)
  2791. {
  2792. if (el.scrollLeft!=null)
  2793. {
  2794. lx-=el.scrollLeft
  2795. ly-=el.scrollTop
  2796. }
  2797. }
  2798. }
  2799. lx+=getScrollX()
  2800. ly+=getScrollY()
  2801. return {x:lx,y:ly}
  2802. }
  2803. // ================================================================================
  2804. function getWidget(layer)
  2805. // Apply only with layers generated by widgets
  2806. // layer [layer] the layer
  2807. // return [Widget] the widget (or null)
  2808. {
  2809. if (layer==null)
  2810. return null
  2811. var w=layer._widget
  2812. if (w!=null)
  2813. return _widgets[w]
  2814. else
  2815. return getWidget(layer.parentNode)
  2816. }
  2817. // ================================================================================
  2818. function getWidgetFromID(id)
  2819. // Retrieve a widget from its id
  2820. // id [string] the id of the widget
  2821. // return [Widget] the widget (or null)
  2822. {
  2823. if (id==null)
  2824. return null
  2825. var l=getLayer(id)
  2826. return getWidget(l)
  2827. }
  2828. // ================================================================================
  2829. function attr(key,val)
  2830. // writes an HTML attribute (if val null, do nothing)
  2831. // key [String] the attribute name
  2832. // value [String or null] the attribute value
  2833. // returs [String]
  2834. {
  2835. return (val!=null?' '+key+'="'+val+'" ':'')
  2836. }
  2837. // ================================================================================
  2838. function sty(key,val)
  2839. // writes style value (if val null, do nothing)
  2840. // key [String] the style name
  2841. // value [String or null] the attribute value
  2842. // returs [String]
  2843. {
  2844. return (val!=null?key+':'+val+';' :'')
  2845. }
  2846. // ================================================================================
  2847. function getSep(marg,solid)
  2848. // get the HTML for a 3D look horizontal separator
  2849. // marg [int optional] left & right margin
  2850. // solid [boolean optional] solid look
  2851. {
  2852. if (marg==null)marg=0;var spc=marg>0?'<td width="'+marg+'">'+getSpace(marg,1)+'</td>':''; return '<table style="margin-top:5px;margin-bottom:5px;" width="100%" cellspacing="0" cellpadding="0"><tr>'+spc+'<td background="'+_skin+'sep'+(solid?'_solid':'')+'.gif" class="smalltxt"><img alt="" src="'+_skin+'../transp.gif" width="10" height="2"></td>'+spc+'</tr></table>'
  2853. }
  2854. // ================================================================================
  2855. function writeSep(marg,solid)
  2856. // writes a 3D look horizontal separator
  2857. // marg [int optional] left & right margin
  2858. // solid [boolean optional] solid look
  2859. {
  2860. _curDoc.write(getSep(marg,solid))
  2861. }
  2862. // ================================================================================
  2863. function getSpace(w,h)
  2864. // Return the HTML for forcing a space
  2865. // Return [String]
  2866. {
  2867. return '<table height="'+h+'" border="0" cellspacing="0" cellpadding="0"><tr><td>'+img(_skin+'../transp.gif',w,h)+'</td></tr></table>'
  2868. }
  2869. // ================================================================================
  2870. function writeSpace(w,h)
  2871. // write the HTML for forcing a space
  2872. // Return [void]
  2873. {
  2874. _curDoc.write(getSpace(w,h))
  2875. }
  2876. // ================================================================================
  2877. function documentWidth(win)
  2878. // Gets the document(page) width
  2879. // return [int]
  2880. {
  2881. var win=win?win:_curWin;
  2882. var width = Math.max(document.body.clientWidth,document.documentElement.clientWidth);
  2883. width = Math.max(width,document.body.scrollWidth);
  2884. return width;
  2885. }
  2886. // ================================================================================
  2887. function documentHeight(win)
  2888. // Gets the document(page) height
  2889. // return [int]
  2890. {
  2891. var win=win?win:_curWin;
  2892. var height = Math.max(document.body.clientHeight,document.documentElement.clientHeight);
  2893. height = Math.max(height,document.body.scrollHeight);
  2894. return height;
  2895. }
  2896. // ================================================================================
  2897. function winWidth(win)
  2898. // Gets the window width
  2899. // return [int]
  2900. {
  2901. var width;
  2902. var win=win?win:_curWin;
  2903. if(_ie)
  2904. {
  2905. if(_isQuirksMode)
  2906. {
  2907. width = win.document.body.clientWidth;
  2908. }
  2909. else
  2910. {
  2911. width = win.document.documentElement.clientWidth;
  2912. }
  2913. }
  2914. else
  2915. {
  2916. width = win.innerWidth;
  2917. }
  2918. return width;
  2919. }
  2920. // ================================================================================
  2921. function winHeight(win)
  2922. // Gets the window height
  2923. // return [int]
  2924. {
  2925. var win=win?win:_curWin;
  2926. var height;
  2927. if(_ie)
  2928. {
  2929. if(_isQuirksMode)
  2930. {
  2931. height = document.body.clientHeight;
  2932. }
  2933. else
  2934. {
  2935. height = document.documentElement.clientHeight;
  2936. }
  2937. }
  2938. else
  2939. {
  2940. height = win.innerHeight;
  2941. }
  2942. return height;
  2943. }
  2944. // ================================================================================
  2945. function getScrollX(win)
  2946. // Return [int] the scrolling horizontal value in pixels
  2947. {
  2948. var scrollLeft = 0;
  2949. var win=win?win:_curWin;
  2950. if(typeof(win.scrollX ) == 'number') {
  2951. scrollLeft = win.scrollX;
  2952. }
  2953. else {
  2954. scrollLeft = Math.max(win.document.body.scrollLeft,win.document.documentElement.scrollLeft);
  2955. }
  2956. return scrollLeft;
  2957. }
  2958. // ================================================================================
  2959. function getScrollY(win)
  2960. // Get the X scroll position in pixels
  2961. // returns an int
  2962. {
  2963. var scrollTop = 0;
  2964. var win=win?win:_curWin;
  2965. if(typeof(win.scrollY ) == 'number') {
  2966. scrollTop = window.scrollY;
  2967. }
  2968. else {
  2969. scrollTop = Math.max(win.document.body.scrollTop,win.document.documentElement.scrollTop);
  2970. }
  2971. return scrollTop;
  2972. }
  2973. // ================================================================================
  2974. function winScrollTo(x, y, win)
  2975. // Scroll to the x, y position in pixels
  2976. // takes 2 int
  2977. {
  2978. win=win?win:_curWin
  2979. win.scrollTo(x,y)
  2980. /*/if (_ie) {
  2981. win.document.body.scrollLeft = x
  2982. win.document.body.scrollTop = y
  2983. } else {
  2984. win.scrollTo(x,y)
  2985. }*/
  2986. }
  2987. // ================================================================================
  2988. function eventGetKey(e,win)
  2989. // Get the event key code
  2990. // e [event]
  2991. {
  2992. win=win?win:_curWin
  2993. //return _ie?win.event.keyCode:e.which
  2994. return _ie?win.event.keyCode:e.keyCode
  2995. }
  2996. // ================================================================================
  2997. function eventGetX(e)
  2998. // Get the event mouse abscissa
  2999. // e [event]
  3000. {
  3001. return _ie?_curWin.event.clientX: e.clientX ? e.clientX : e.pageX;
  3002. }
  3003. // ================================================================================
  3004. function eventGetY(e)
  3005. // Get the event mouse ordinate
  3006. // e [event]
  3007. {
  3008. return _ie?_curWin.event.clientY: e.clientY ? e.clientY : e.pageY;
  3009. }
  3010. // ================================================================================
  3011. function xpos(o,e,doc,zoom)
  3012. {
  3013. if ((zoom==null)||(!_ie))
  3014. zoom=1;
  3015. return ((e.clientX/zoom)-getPos(o).x)+getScrollX();
  3016. }
  3017. // ================================================================================
  3018. function ypos(o,e,doc,zoom)
  3019. {
  3020. if ((zoom==null)||(!_ie))
  3021. zoom=1
  3022. return ((e.clientY/zoom)-getPos(o).y)+(_ie?doc.body.scrollTop:0)
  3023. }
  3024. // ================================================================================
  3025. function absxpos(e,zoom)
  3026. {
  3027. if ((zoom==null)||(!_ie)) {
  3028. return e.clientX
  3029. } else {
  3030. return e.clientX/zoom
  3031. }
  3032. }
  3033. // ================================================================================
  3034. function absypos(e,zoom)
  3035. {
  3036. if ((zoom==null)||(!_ie)) {
  3037. return e.clientY
  3038. } else {
  3039. return e.clientY/zoom
  3040. }
  3041. }
  3042. // ================================================================================
  3043. function eventCancelBubble(e,win)
  3044. // Cancels event bubbling
  3045. // e [event]
  3046. {
  3047. win=win?win:_curWin
  3048. var ev =_ie? win.event : e;
  3049. if(ev) {
  3050. ev.cancelBubble = true;
  3051. if(ev.stopPropagation) ev.stopPropagation();
  3052. }
  3053. }
  3054. // ================================================================================
  3055. function isHidden(lyr)
  3056. // Test if a layer is hidden
  3057. // lyr [layer]
  3058. // return [boolean]
  3059. {
  3060. if ((lyr==null)||(lyr.tagName=="BODY")) return false;var sty=lyr.style;if ((sty==null)||(sty.visibility==_hide)||(sty.display=='none')) return true;return isHidden(lyr.parentNode)
  3061. }
  3062. // ================================================================================
  3063. function opt(val,txt,sel)
  3064. // get an option tag
  3065. // val [String] the option value
  3066. // txt [String] the option text
  3067. // sel [boolean optional] set it selected
  3068. // return [String]
  3069. {
  3070. return '<option value="'+val+'" '+(sel?'selected':'')+'>'+convStr(''+txt)+'</option>'
  3071. }
  3072. // ================================================================================
  3073. function lnk(inner,clickCB,cls,id,att,dblClickCB)
  3074. // writes a A link tag
  3075. // inner [String] inner HTML
  3076. // clickCB [String] click callback
  3077. // cls [String] CSS class
  3078. // id [String] tag ID
  3079. // dblClickCB [String] double click callback
  3080. {
  3081. if (clickCB==null)
  3082. clickCB="return false"
  3083. att=att?att:'';return '<a'+attr('class',cls)+attr('id',id)+attr('href','javascript:void(0)')+attr('onclick',clickCB)+attr('ondblclick',dblClickCB)+att+'>'+inner +'</a>'
  3084. }
  3085. // ================================================================================
  3086. _oldErrHandler=null
  3087. function localErrHandler()
  3088. {
  3089. return true
  3090. }
  3091. // ================================================================================
  3092. function canScanFrames(w)
  3093. // PRIVATE
  3094. {
  3095. //_excludeFromFrameScan variable is set by a frame that does not want to
  3096. // be scaned, when the frame is used to download document for instance.
  3097. var ex=true,d=null
  3098. if (_moz)
  3099. {
  3100. _oldErrHandler=window.onerror
  3101. window.onerror=localErrHandler
  3102. }
  3103. try
  3104. {
  3105. d=w.document
  3106. //if ((d!=null&&(typeof(d)).toLowerCase()!="unknown"))
  3107. //ex=(w._excludeFromFrameScan==true)?w._excludeFromFrameScan:false
  3108. ex=false
  3109. }
  3110. catch(expt)
  3111. {
  3112. }
  3113. if (_moz)
  3114. window.onerror=_oldErrHandler
  3115. return (!ex&&(d!=null))
  3116. }
  3117. // ================================================================================
  3118. function restoreAllInputs(win,level)
  3119. // restore inputs
  3120. {
  3121. if (_ie&&_curWin._inptStackLevel!=null)
  3122. {
  3123. win=win?win:_curWin
  3124. //_excludeFromFrameScan variable is set by a frame that does not want to
  3125. // be scaned, when the frame is used to download document for instance.
  3126. if (canScanFrames(win))
  3127. {
  3128. if (level==null)
  3129. level=--_curWin._inptStackLevel
  3130. var b=win.document.body,arr=b?b.getElementsByTagName("SELECT"):null,len=arr?arr.length:0
  3131. for (var i=0;i<len;i++)
  3132. {
  3133. var inpt=arr[i]
  3134. if (inpt._boHideLevel==level)
  3135. {
  3136. inpt.style.visibility=inpt._boOldVis
  3137. inpt._boHideLevel=null
  3138. }
  3139. }
  3140. // Process sub frames
  3141. var frames=win.frames,flen=frames.length
  3142. for (var k=0;k<flen;k++)
  3143. restoreAllInputs(frames[k],level)
  3144. }
  3145. }
  3146. }
  3147. // ================================================================================
  3148. function hideAllInputs(x,y,w,h,win,level)
  3149. // Hide all inputs. If parameters passed, only in the specified rectangle
  3150. // x [int optional] the rectangle abscissa
  3151. // y [int optional] the rectangle ordinate
  3152. // w [int optional] the rectangle width
  3153. // h [int optional] the rectangle height
  3154. {
  3155. if (_ie)
  3156. {
  3157. win=win?win:_curWin
  3158. //_excludeFromFrameScan variable is set by a frame that does not want to
  3159. // be scaned, when the frame is used to download document for instance.
  3160. if (canScanFrames(win))
  3161. {
  3162. var b=win.document.body,arr=b?b.getElementsByTagName("SELECT"):null,len=arr?arr.length:0
  3163. if (level==null)
  3164. {
  3165. if (_curWin._inptStackLevel==null)
  3166. _curWin._inptStackLevel=0
  3167. level=_curWin._inptStackLevel++
  3168. }
  3169. for (var i=0;i<len;i++)
  3170. {
  3171. var inpt=arr[i],css=inpt.style;
  3172. var inter=(x==null)||isLayerIntersectRect(inpt,x,y,w,h)
  3173. if (!isHidden(inpt)&&inter)
  3174. {
  3175. inpt._boHideLevel=level
  3176. inpt._boOldVis=css.visibility
  3177. css.visibility=_hide
  3178. }
  3179. }
  3180. // Process sub frames
  3181. var frames=win.frames,flen=frames.length
  3182. for (var k=0;k<flen;k++)
  3183. hideAllInputs(null,null,null,null,frames[k],level)
  3184. }
  3185. }
  3186. }
  3187. // ================================================================================
  3188. function getBGIframe(id)
  3189. {
  3190. return '<iframe id="'+id+'" name="'+id+'" style="display:none;left:0px;position:absolute;top:0px" src="' + _skin + '../../empty.html' + '" frameBorder="0" scrolling="no"></iframe>'
  3191. }
  3192. function getDynamicBGIFrameLayer()
  3193. {
  3194. var recycle=false
  3195. if (_curWin.BGIFramePool)
  3196. {
  3197. BGIFrames = _curWin.BGIFramePool.split(",")
  3198. BGIFCount = BGIFrames.length
  3199. for (var id = 0; id < BGIFCount; id++) {
  3200. if (BGIFrames[id] != "1") {
  3201. recycle=true
  3202. break
  3203. }
  3204. }
  3205. } else {
  3206. id = 0
  3207. BGIFrames = new Array
  3208. }
  3209. BGIFrames[id] = "1"
  3210. _curWin.BGIFramePool = BGIFrames.join(",")
  3211. if (!recycle) {
  3212. targetApp(getBGIframe("BGIFramePool_" + id))
  3213. }
  3214. return getLayer("BGIFramePool_" + id)
  3215. }
  3216. function holdBGIFrame(layerId) {
  3217. var l = getLayer(layerId)
  3218. if (l) {
  3219. l.style.display=""
  3220. }
  3221. id = parseInt(layerId.split('_')[1])
  3222. BGIFrames = _curWin.BGIFramePool.split(",")
  3223. BGIFrames[id]=1
  3224. _curWin.BGIFramePool = BGIFrames.join(",")
  3225. }
  3226. function releaseBGIFrame(layerId) {
  3227. var l = getLayer(layerId)
  3228. if (l) {
  3229. l.style.display="none"
  3230. }
  3231. id = parseInt(layerId.split('_')[1])
  3232. BGIFrames = _curWin.BGIFramePool.split(",")
  3233. BGIFrames[id]=0
  3234. _curWin.BGIFramePool = BGIFrames.join(",")
  3235. }
  3236. // ================================================================================
  3237. // ================================================================================
  3238. function append(e,s,c)
  3239. // inserts HTML BEFORE the end of a given layer
  3240. // e [layer] the layer
  3241. // s [String] the HTML
  3242. // c curDoc
  3243. {
  3244. if (_ie)
  3245. e.insertAdjacentHTML("BeforeEnd",s)
  3246. else
  3247. {
  3248. var curDoc = c?c:_curDoc
  3249. var r=curDoc.createRange()
  3250. r.setStartBefore(e)
  3251. var frag=r.createContextualFragment(s)
  3252. e.appendChild(frag)
  3253. }
  3254. }
  3255. // ================================================================================
  3256. function append2(e,s,c)
  3257. // fixes IE's problem of appending elements to an element that hasn't been completely loaded
  3258. // inserts HTML BEFORE the end of a given layer
  3259. // e [layer] the layer
  3260. // s [String] the HTML
  3261. // c curDoc
  3262. {
  3263. if (_ie)
  3264. e.insertAdjacentHTML("afterBegin",s)
  3265. else
  3266. {
  3267. var curDoc = c?c:_curDoc
  3268. var r=curDoc.createRange()
  3269. r.setStartBefore(e)
  3270. var frag=r.createContextualFragment(s)
  3271. e.appendChild(frag)
  3272. }
  3273. }
  3274. // ================================================================================
  3275. function insBefore(e,s,c)
  3276. // inserts HTML AFTER the end of a given layer
  3277. // e [layer] the layer
  3278. // s [String] the HTML
  3279. {
  3280. if (_ie)
  3281. e.insertAdjacentHTML("BeforeBegin",s)
  3282. else
  3283. {
  3284. var curDoc = c?c:_curDoc
  3285. var r=_curDoc.createRange()
  3286. r.setEndBefore(e)
  3287. var frag=r.createContextualFragment(s)
  3288. e.parentNode.insertBefore(frag,e)
  3289. }
  3290. }
  3291. // ================================================================================
  3292. function insBefore2(e,s,c)
  3293. // Fixes Safari's problem of inserting HTML string before an element
  3294. // inserts HTML AFTER the end of a given layer
  3295. // e [layer] the layer
  3296. // s [String] the HTML
  3297. {
  3298. if (_ie)
  3299. e.insertAdjacentHTML("BeforeBegin",s)
  3300. else
  3301. {
  3302. var curDoc = c?c:_curDoc
  3303. var r=_curDoc.createRange()
  3304. r.setStartBefore(e)
  3305. var frag=r.createContextualFragment(s)
  3306. e.parentNode.insertBefore(frag,e)
  3307. }
  3308. }
  3309. // ================================================================================
  3310. function targetApp(s)
  3311. // Add HTML code at the end of the body
  3312. // s [String] the HTML
  3313. {
  3314. append(_curDoc.body,s)
  3315. }
  3316. // ================================================================================
  3317. function getBasePath()
  3318. // Get the url path of the document WITHOUT the page name
  3319. // Return [String] the path
  3320. {
  3321. var url=document.location.href,last1= url.lastIndexOf('?');if (last1>=0) url=url.slice(0,last1);var last = url.lastIndexOf('/');return (last>=0)?url.slice(0,last+1):url
  3322. }
  3323. // ================================================================================
  3324. function isLayerIntersectRect(l,x1,y1,w,h)
  3325. // Test if a layer intersection with a rectangle if non empty
  3326. // l [layer]
  3327. // x1 [int optional] the rectangle abscissa
  3328. // y1 [int optional] the rectangle ordinate
  3329. // w [int optional] the rectangle width
  3330. // h [int optional] the rectangle height
  3331. {
  3332. var xl1=getPos(l).x,yl1=getPos(l).y,xl2=xl1+l.offsetWidth,yl2=yl1+l.offsetHeight,x2=x1+w,y2=y1+h
  3333. return ((x1>xl1)||(x2>xl1))&&((x1<xl2)||(x2<xl2)) && ((y1>yl1)||(y2>yl1))&&((y1<yl2)||(y2<yl2))
  3334. }
  3335. // ================================================================================
  3336. function preloadImg(url)
  3337. // preload an image
  3338. // url [String] the image URL
  3339. {
  3340. var img=_preloadArr[_preloadArr.length]=new Image;img.src=url
  3341. }
  3342. // ================================================================================
  3343. function convURL(str)
  3344. {
  3345. if (_dontNeedEncoding == null)
  3346. {
  3347. //first time call for this page, generates "static" variables
  3348. _dontNeedEncoding = new Array(256);
  3349. for (var i = 0 ; i < 256 ; i++) _dontNeedEncoding[i] = false;
  3350. for (var i = (new String('a')).charCodeAt(0); i <= (new String('z')).charCodeAt(0); i++) _dontNeedEncoding[i] = true;
  3351. for (var i = (new String('A')).charCodeAt(0); i <= (new String('Z')).charCodeAt(0); i++) _dontNeedEncoding[i] = true;
  3352. for (var i = (new String('0')).charCodeAt(0); i <= (new String('9')).charCodeAt(0); i++) _dontNeedEncoding[i] = true;
  3353. _dontNeedEncoding[(new String(' ')).charCodeAt(0)] = true; /* encoding a space to a + is done in the encode() method */
  3354. _dontNeedEncoding[(new String('-')).charCodeAt(0)] = true;
  3355. _dontNeedEncoding[(new String('_')).charCodeAt(0)] = true;
  3356. _dontNeedEncoding[(new String('.')).charCodeAt(0)] = true;
  3357. _dontNeedEncoding[(new String('*')).charCodeAt(0)] = true;
  3358. _thex = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
  3359. }
  3360. var encstr = "";
  3361. for (var i = 0 ; i < str.length ; i++) encstr += URLEncodeUTF8Char(str.charAt(i));
  3362. return encstr;
  3363. }
  3364. // ================================================================================
  3365. function URLEncodeUTF8Char(c)
  3366. {
  3367. var unicodeval = c.charCodeAt(0);
  3368. if (unicodeval < 128)
  3369. {
  3370. //first case should generate a simple byte with high bit at 0 (7 bit ASCII US)
  3371. if (_dontNeedEncoding[unicodeval]) return (c == ' ' ? '+' : c);
  3372. else return ("%" + _thex[unicodeval >> 4] + _thex[unicodeval & 15]);
  3373. }
  3374. else if (unicodeval < 2048)
  3375. {
  3376. //on 2 bytes 110xxxxx 10xxxxxx
  3377. return ("%" + _thex[(unicodeval >> 10) | 12]
  3378. + _thex[(unicodeval >> 6) & 15]
  3379. + "%" + _thex[(unicodeval >> 4) & 3 | 8]
  3380. + _thex[unicodeval & 15]);
  3381. }
  3382. else
  3383. {
  3384. //on 3 bytes 1110xxxx 10xxxxxx 10xxxxxx
  3385. return ("%" + _thex[14]
  3386. + _thex[unicodeval >> 12]
  3387. + "%" + _thex[(unicodeval >> 10) & 3 | 8]
  3388. + _thex[(unicodeval >> 6) & 15]
  3389. + "%" + _thex[(unicodeval >> 4) & 3 | 8]
  3390. + _thex[unicodeval & 15]);
  3391. }
  3392. }
  3393. // ================================================================================
  3394. function encString(s)
  3395. // encString() allows to serialize collections of
  3396. // string with beginnig by "[", terminated with "]"
  3397. // and using "," as separator.
  3398. // s [String] the string to encode
  3399. // return [String] the encoded string
  3400. {
  3401. var res=''
  3402. if (s!=null)
  3403. {
  3404. var len=s.length
  3405. for (var i=0;i<len;i++)
  3406. {
  3407. var c=s.charAt(i)
  3408. switch (c)
  3409. {
  3410. case '$': res+='$3'; break
  3411. case ',': res+='$4'; break
  3412. case '[': res+='$5'; break
  3413. case ']': res+='$6'; break
  3414. default: res+=c; break
  3415. }
  3416. }
  3417. }
  3418. return res
  3419. }
  3420. // ================================================================================
  3421. function enc()
  3422. // Encode several values
  3423. // Variable number of parameters
  3424. {
  3425. var args=enc.arguments,len=args.length,s='['
  3426. if (len>0) s+=args[0]
  3427. for (var i=1;i<len;i++) s+=','+args[i]
  3428. return s+']'
  3429. }
  3430. // ================================================================================
  3431. //remove space caracters around a string
  3432. function remSpaceAround(s)
  3433. {
  3434. var len = s.length;
  3435. if(len<=0) return "";
  3436. var start=0,end=len
  3437. var c=s.substr(start,1);
  3438. while (c==' ' && start<len)
  3439. {
  3440. start++
  3441. c=s.substr(start,1);
  3442. }
  3443. if(start<len)
  3444. {
  3445. c=s.substr(end-1,1);
  3446. while (c==' ')
  3447. {
  3448. end--
  3449. c=s.substr(end-1,1);
  3450. }
  3451. }
  3452. var sub = s.substring(start,end);
  3453. // alert(sub.length +"-"+sub)
  3454. return sub
  3455. }
  3456. // ================================================================================
  3457. function getArrows(upCb,downCB,hori,newNode,newNodeCB)
  3458. // OBSOLETE
  3459. // Get the HTML String for move buttons if a list
  3460. // upCb [String] : callback string when pushing the up (rep left if hori == true) button
  3461. // downCb [String] : callback string when pushing the down (rep right if hori == true) button
  3462. // hori [Boolean - optional, default is false] : if true, display left & right arrows. Else display top & bottom arrows.
  3463. // Return [String] the HTML
  3464. {
  3465. if (hori==null) hori=false;
  3466. var s=''
  3467. if (hori) s+='<nobr>'
  3468. s+=lnk(img(_skin+(hori?'left.gif':'up.gif'),12,12,'top',null,hori?"_LEFT ARROW":"_UP ARROW"),upCb,null,null,null,(_moz?null:upCb))
  3469. s+=(hori?'':img(_skin+'../transp.gif',1,5)+'<br>')
  3470. s+=lnk(img(_skin+(hori?'right.gif':'down.gif'),hori?11:12,hori?12:11,'top',null,hori?"_RIGHT ARROW":"_LEFT ARROW"),downCB,null,null,null,(_moz?null:downCB))
  3471. if (newNode)
  3472. {
  3473. s+=img(_skin+'../transp.gif',1,5)+'<br>'
  3474. s+=lnk(img(_skin+('node.gif'),12,12,'top',null,"_NEW NODE"),newNodeCB,null,null,null,(_moz?null:newNodeCB))
  3475. }
  3476. if (hori) s+='</nobr>'
  3477. return s
  3478. }
  3479. // ================================================================================
  3480. // ================================================================================
  3481. //
  3482. // OBJECT newBlockWhileWait (Constructor)
  3483. //
  3484. // Class for dialog box
  3485. //
  3486. // ================================================================================
  3487. // ================================================================================
  3488. _staticUnicBlockWhileWaitWidgetID = "staticUnicBlockWhileWaitWidgetID"
  3489. function hideBlockWhileWaitWidget()
  3490. {
  3491. var lyr=getLayer(_staticUnicBlockWhileWaitWidgetID)
  3492. if (lyr)
  3493. lyr.style.display="none"
  3494. }
  3495. function newBlockWhileWaitWidget(urlImg)
  3496. // Return [TooltipWidget] the instance
  3497. {
  3498. if (window._BlockWhileWaitWidget!=null)
  3499. return window._BlockWhileWaitWidget
  3500. var o=newWidget(_staticUnicBlockWhileWaitWidgetID)
  3501. o.getPrivateHTML=BlockWhileWaitWidget_getPrivateHTML
  3502. o.init=BlockWhileWaitWidget_init
  3503. o.show=BlockWhileWaitWidget_show
  3504. window._BlockWhileWaitWidget=o
  3505. return o
  3506. }
  3507. // ================================================================================
  3508. function BlockWhileWaitWidget_init()
  3509. {
  3510. //cancels the default init behaviour
  3511. }
  3512. // ================================================================================
  3513. function BlockWhileWaitWidget_getPrivateHTML()
  3514. // Returns [String] the HTML
  3515. {
  3516. return '<div id="'+ this.id+'" onselectstart="return false" ondragstart="return false" onmousedown="'+_codeWinName+'.eventCancelBubble(event)" border="0" hspace="0" vspace="0" style="background-image:url('+_skin+'../transp.gif);z-index:5000;cursor:wait;position:absolute;top:0px;left:0px;width:100%;height:100%"></div>'
  3517. }
  3518. // ================================================================================
  3519. function BlockWhileWaitWidget_show(show)
  3520. // show [boolean] true for showing the tooltip
  3521. {
  3522. var o=this
  3523. // object not init yet, 2 cases
  3524. if (o.layer==null)
  3525. {
  3526. o.layer=getLayer(o.id)
  3527. // another instance hasn't written it's HTML yet
  3528. if (o.layer==null)
  3529. {
  3530. targetApp(o.getPrivateHTML())
  3531. o.layer=getLayer(o.id)
  3532. o.css=o.layer.style
  3533. }
  3534. else
  3535. { // convenient use of css property
  3536. o.css=o.layer.style
  3537. }
  3538. }
  3539. o.setDisplay(show)
  3540. }
  3541. /*
  3542. // ================================================================================
  3543. // like Request.QueryString function
  3544. // ================================================================================
  3545. function RObj(ea){var LS="";var QS=new Object();var un="undefined";var f="function";var n="number";var r="string";var e1="ERROR:Index out of range in\r\nRequest.QueryString";var e2="ERROR:Wrong number of arguments or invalid property assignment\r\nRequest.QueryString";var e3="ERROR:Object doesn't support this property or method\r\nRequest.QueryString.Key";
  3546. function Err(arg){if(ea)alert("Request Object:\r\n"+arg)};
  3547. function URID(t){var d="";if(t){for(var i=0;i<t.length;++i){var c=t.charAt(i);d+=(c=="+"?" ":c);};};return unescape(d);};
  3548. function OL(o){var l=0;for(var i in o){if(typeof(o[i])!=f) l++;};return l;};
  3549. function AK(key){var auk=true;for(var u in QS){if(typeof(QS[u])!=f&&u.toString().toLowerCase()==key.toLowerCase()){auk=false;return u;}};if(auk){QS[key]=new Object();QS[key].toString=function(){return TS(QS[key])};QS[key].Count=function(){return OL(QS[key])};QS[key].Count.toString=function(){return OL(QS[key]).toString()};QS[key].Item=function(e){if(typeof(e)==un) return QS[key];else {if(typeof(e)==n){var a=QS[key][Math.ceil(e)];if(typeof(a)==un) Err(e1+"(\""+key+"\").Item("+e+")");return a;}else Err("ERROR:Expecting numeric input in\r\nRequest.QueryString(\""+key+"\").Item(\""+e+"\")");}};QS[key].Item.toString=function(e){if(typeof(e)==un) return QS[key].toString();else {var a=QS[key][e];if(typeof(a)==un) Err(e1+"(\""+key+"\").Item("+e+")");return a.toString();};};QS[key].Key=function(e){var t=typeof(e);if(t==r){var a=QS[key][e];return(typeof(a)!=un&&a&&a.toString()?e:"");}else Err(e3+"("+(e?e:"")+")");};QS[key].Key.toString=function(){return un};};return key};
  3550. function AVTK(key,val){if(key!=""){var key=AK(key);var l=OL(QS[key]);QS[key][l+1]=val;}};
  3551. function TS(o){var s="";for(var i in o){var ty=typeof(o[i]);if(ty=="object") s+=TS(o[i]);else if(ty!=f) s+=o[i]+", ";};var l=s.length;if(l>1)return(s.substring(0,l-2));return(s==""?un:s);};
  3552. function KM(k,o){var k=k.toLowerCase();for(var u in o){if(typeof(o[u])!=f&&u.toString().toLowerCase()==k) return u;};}if(window.location&&window.location.search){LS=window.location.search;var l=LS.length;if(l>0){LS=LS.substring(1,l);var preAmpAt=0;var ampAt=-1;var eqAt=-1;var k=0;var skip=false;for(var i=0;i<l;++i){var c=LS.charAt(i);if(LS.charAt(preAmpAt)=="="||(preAmpAt==0&&i==0&&c=="=")) skip=true;if(c=="="&&eqAt==-1&&!skip) eqAt=i;if(c=="&"&&ampAt==-1){if(eqAt!=-1) ampAt=i;if(skip) preAmpAt=i+1;skip=false;};if(ampAt>eqAt){AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,ampAt)));preAmpAt=ampAt+1;eqAt=ampAt=-1;++k;};};if(LS.charAt(preAmpAt)!="="&&(preAmpAt!=0||i!=0||c!="=")){if(preAmpAt!=l){if(eqAt!=-1) AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,l)));else if(preAmpAt!=l-1) AVTK(URID(LS.substring(preAmpAt,l)),"");};if(l==1) AVTK(LS.substring(0,1),"");};};};var TC=OL(QS);if(!TC) TC=0;QS.toString=function(){return LS.toString()};QS.Count=function(){return(TC?TC:0)};QS.Count.toString=function(){return(TC?TC.toString():"0")};QS.Item=function(e){if(typeof(e)==un) return LS;else {if(typeof(e)==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])!=f&&++c==e) return QS[i];};Err(e1+"().Item("+e+")");}else return QS[KM(e,QS)];};return un;};QS.Item.toString=function(){return LS.toString()};QS.Key=function(e){var t=typeof(e);if(t==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])!=f&&++c==e) return i;}}else if(t==r){var e=KM(e,QS);var a=QS[e];return(typeof(a)!=un&&a&&a.toString()?e:"");}else Err(e2+"().Key("+(e?e:"")+")");Err(e1+"().Item("+e+")");};QS.Key.toString=function(){Err(e2+"().Key");};this.QueryString=function(k){if(typeof(k)==un) return QS;else {var k=KM(k,QS);if(typeof(QS[k])==un){t=new Object();t.Count=function(){return 0};t.Count.toString=function(){return "0"};t.toString=function(){return un};t.Item=function(e){return un};t.Item.toString=function(){return un};t.Key=function(e){Err(e3+"("+(e?e:"")+")");};t.Key.toString=function(){return un};return t;}if(typeof(k)==n) return QS.Item(k);else return QS[k];}};this.QueryString.toString=function(){return LS.toString();};this.QueryString.Count=function(){return(TC?TC:0)};this.QueryString.Count.toString=function(){return(TC?TC.toString():"0")};this.QueryString.Item=function(e){if(typeof(e)==un) return LS.toString();else {if(typeof(e)==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])!=f&&++c==e) return QS[i];};Err(e1+".Item("+e+")");}else return QS[KM(e,QS)];}if(typeof(e)==(n)) Err(e1+".Item("+e+")");return un;};this.QueryString.Item.toString=function(){return LS.toString()};this.QueryString.Key=function(e){var t=typeof(e);if(t==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])=="object"&&(++c==e)){return i;}}}else if(t==r){var e=KM(e,QS);var a=QS[e];return(typeof(a)!=un&&a&&a.toString()?e:"");}else Err(e2+".Key("+(e?e:"")+")");Err(e1+".Item("+e+")");};this.QueryString.Key.toString=function(){Err(e2+".Key");};this.Version=1.2;this.Author="Andrew Urquhart (www.andrewu.co.uk)";};var Request=new RObj(false);
  3553. */
  3554. var regLang= /^[a-zA-Z]{2}$|^[a-zA-Z]{2}_[a-zA-Z]{2}$/, regIntPos=/^\d+$/, regYes=/^yes$/, regPath=/^[\w|\/|:|.|-]+$/, regAlphanumDot=/^\w+\.+\w+$/, regAlphanumDotEx=/^\w+\.*\w+\.*\w+$/
  3555. var paramRegs = new Array()
  3556. paramRegs["ID"]=regAlphanumDot
  3557. paramRegs["allTableCells"]=regYes
  3558. paramRegs["gotoPivot"]=regYes
  3559. paramRegs["reportIndex"]=regIntPos
  3560. paramRegs["fromLPane"]=regYes
  3561. paramRegs["skin"]=regPath
  3562. paramRegs["lang"]=regLang
  3563. paramRegs["noGrabber"]=regYes
  3564. paramRegs["isFormulaEdit"]=regYes
  3565. paramRegs["fromQuery"]=regYes
  3566. paramRegs["isFromHyperlinkEditor"]=regYes
  3567. paramRegs["iAction"]=regIntPos
  3568. paramRegs["callback"]=regAlphanumDotEx
  3569. paramRegs["callbackin"]=regAlphanumDotEx
  3570. paramRegs["callbackout"]=regAlphanumDotEx
  3571. function requestQueryString(win, par){
  3572. params = win.location.search.substr(1).split("&")
  3573. for(i=0;i<params.length;i++){
  3574. var param = params[i].split("="), key = param[0], val = param[1]
  3575. if (key == par){
  3576. var reg = new RegExp(paramRegs[key])
  3577. if ((val == "") || (reg.test(val))) {
  3578. return val
  3579. } else {
  3580. //alert("bad param error, val=" + val + ", key=" + key)
  3581. // the following code is not library independant at all...
  3582. var tpfs = getTopFrameset()
  3583. if (tpfs != null) {
  3584. tpfs._dontCloseDoc=true
  3585. tpfs.document.location.replace(tpfs._root+"html/badparamserror.html");
  3586. } else {
  3587. tpfs=getTopFrameset(window.opener)
  3588. if (tpfs != null)
  3589. {
  3590. document.location.replace(tpfs._skin+"../../../html/badparamserror.html");
  3591. }
  3592. }
  3593. }
  3594. }
  3595. }
  3596. }
  3597. // ================================================================================
  3598. // Manipulating String function
  3599. // ================================================================================
  3600. function trim(strString) {
  3601. if (strString != null) {
  3602. var iLength = strString.length;
  3603. //Left side
  3604. var i;
  3605. for (i=0; i<iLength; i++) {
  3606. if (strString.charAt(i) != " ") {
  3607. break;
  3608. }
  3609. }
  3610. strString = strString.substring(i);
  3611. iLength = strString.length;
  3612. //Right Side
  3613. for (i=iLength; i>0; i--) {
  3614. if (strString.charAt(i-1) != " ") {
  3615. break;
  3616. }
  3617. }
  3618. strString = strString.substring(0,i);
  3619. }
  3620. return strString;
  3621. }
  3622. function startsWithIgnoreCase(strString, strToFind) {
  3623. var blnRet = false;
  3624. if (strToFind != null) {
  3625. var strVar = strString.substring(0, strToFind.length);
  3626. if (strVar.toLowerCase() == strToFind.toLowerCase()) {
  3627. blnRet = true;
  3628. }
  3629. }
  3630. return blnRet;
  3631. }
  3632. function endsWithIgnoreCase(strString, strToFind) {
  3633. var blnRet = false;
  3634. if (strToFind != null) {
  3635. var iRight = strString.length- strToFind.length;
  3636. if (iRight >= 0) {
  3637. var strVar = strString.substring(iRight);
  3638. if (strVar.toLowerCase() == strToFind.toLowerCase()) {
  3639. blnRet = true;
  3640. }
  3641. }
  3642. }
  3643. return blnRet;
  3644. }
  3645. // ================================================================================
  3646. function isTextInput(ev)
  3647. {
  3648. var source = _ie?ev.srcElement:ev.target;
  3649. var isText=false;
  3650. if(source.tagName=="TEXTAREA")
  3651. isText=true
  3652. if((source.tagName=="INPUT") && (source.type.toLowerCase()=="text"))
  3653. isText=true
  3654. return isText;
  3655. }
  3656. function isTextArea(ev)
  3657. {
  3658. var source = _ie?ev.srcElement:ev.target;
  3659. if(source.tagName=="TEXTAREA")
  3660. return true;
  3661. else
  3662. return false;
  3663. }
  3664. // function shrink text, used for tooltip, because a too long tooltip flickers ADAPT00465457
  3665. // max n chars ?
  3666. function shrinkTooltip(t,n)
  3667. {
  3668. var n = n?n:360
  3669. return (t.length < n)? t : (t.substring(0,n) + "...")
  3670. }
  3671. // ================================================================================
  3672. // ================================================================================
  3673. //
  3674. // Functions to format a date
  3675. //
  3676. // ================================================================================
  3677. // ================================================================================
  3678. function setDateValue(strDateValue, strInputFormat)
  3679. {
  3680. var strRet = ",,";
  3681. var strYear = "";
  3682. var strMonth = "";
  3683. var strDay = "";
  3684. //Get separator
  3685. var length = strInputFormat.length;
  3686. var sep = "";
  3687. for (var i=0; i<length; i++)
  3688. {
  3689. var c = strInputFormat.charAt(i);
  3690. switch(c)
  3691. {
  3692. case "/":
  3693. case "-":
  3694. case ".":
  3695. case ",":
  3696. case "\"": sep = c; break;
  3697. }
  3698. if (sep != "") break;
  3699. }
  3700. if (sep != "")
  3701. {
  3702. var arrInputFormat = strInputFormat.split(sep);
  3703. var arrDateValue = strDateValue.split(sep);
  3704. for (var i=0; i<arrDateValue.length; i++)
  3705. {
  3706. if (arrInputFormat[i] != null && typeof(arrInputFormat[i]) != "undefined")
  3707. {
  3708. //Year
  3709. if (arrInputFormat[i].indexOf('y')>=0)
  3710. {
  3711. var iPosA = arrInputFormat[i].indexOf('y');
  3712. var iPosB = arrInputFormat[i].lastIndexOf('y');
  3713. if (iPosB>=0)
  3714. {
  3715. strYear = arrInputFormat[i].substring(iPosA, iPosB + 1);
  3716. if (strYear.length >= arrDateValue[i].length) strYear = arrDateValue[i];
  3717. else
  3718. {
  3719. iPosB = iPosA;
  3720. for (var j=iPosA; j<arrDateValue[i].length; j++)
  3721. {
  3722. var c = arrDateValue[i].charAt(j);
  3723. if (c < '0' || c > '9') break;
  3724. else iPosB = j + 1;
  3725. }
  3726. strYear = arrDateValue[i].substring(iPosA, iPosB);
  3727. if (strYear.length <= 2)
  3728. {
  3729. var iYear = parseInt(strYear);
  3730. if (iYear>=70) iYear += 1900;
  3731. else iYear += 2000;
  3732. strYear = iYear.toString();
  3733. }
  3734. }
  3735. }
  3736. else
  3737. {
  3738. return strRet;
  3739. }
  3740. }
  3741. //Month
  3742. else if (arrInputFormat[i].indexOf('M')>=0)
  3743. {
  3744. var iPosA = arrInputFormat[i].indexOf('M');
  3745. var iPosB = arrInputFormat[i].lastIndexOf('M');
  3746. if (iPosB>=0)
  3747. {
  3748. strMonth = arrInputFormat[i].substring(iPosA, iPosB + 1);
  3749. if (strMonth.length >= arrDateValue[i].length) strMonth = arrDateValue[i];
  3750. else
  3751. {
  3752. iPosB = iPosA;
  3753. for (var j=iPosA; j<arrDateValue[i].length; j++)
  3754. {
  3755. var c = arrDateValue[i].charAt(j);
  3756. if (c < '0' || c > '9') break;
  3757. else iPosB = j + 1;
  3758. }
  3759. strMonth = arrDateValue[i].substring(iPosA, iPosB);
  3760. }
  3761. }
  3762. else
  3763. {
  3764. return strRet;
  3765. }
  3766. }
  3767. //Day
  3768. else if (arrInputFormat[i].indexOf('d')>=0)
  3769. {
  3770. var iPosA = arrInputFormat[i].indexOf('d');
  3771. var iPosB = arrInputFormat[i].lastIndexOf('d');
  3772. if (iPosB>=0)
  3773. {
  3774. strDay = arrInputFormat[i].substring(iPosA, iPosB + 1);
  3775. if (strDay.length >= arrDateValue[i].length) strDay = arrDateValue[i];
  3776. else {
  3777. iPosB = iPosA;
  3778. for (var j=iPosA; j<arrDateValue[i].length; j++)
  3779. {
  3780. var c = arrDateValue[i].charAt(j);
  3781. if (c < '0' || c > '9') break;
  3782. else iPosB = j + 1;
  3783. }
  3784. strDay = arrDateValue[i].substring(iPosA, iPosB);
  3785. }
  3786. }
  3787. else
  3788. {
  3789. return strRet;
  3790. }
  3791. }
  3792. }
  3793. }
  3794. if (strMonth != "" && strDay != "" && strYear != "" && !(isNaN(strMonth) || isNaN(strDay) || isNaN(strYear)))
  3795. {
  3796. //Set Date
  3797. strRet = strMonth + ',' + strDay + ',' + strYear;
  3798. }
  3799. }
  3800. return strRet;
  3801. }
  3802. // ================================================================================
  3803. function LZ(x) {
  3804. return(x<0||x>9?"":"0")+x
  3805. }
  3806. // ================================================================================
  3807. function formatDate(date,format)
  3808. {
  3809. var format=format+"";
  3810. var result="";
  3811. var i_format=0;
  3812. var c="";
  3813. var token="";
  3814. var y=date.getFullYear()+"";
  3815. var M=date.getMonth()+1;
  3816. var d=date.getDate();
  3817. var E=date.getDay();
  3818. var H=date.getHours();
  3819. var m=date.getMinutes();
  3820. var s=date.getSeconds();
  3821. var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
  3822. // Convert real date parts into formatted versions
  3823. var value=new Object();
  3824. if (y.length==2) {
  3825. if (y-0>=70) y=""+(y-0+1900);
  3826. else y=""+(y-0+2000);
  3827. }
  3828. value["y"]=""+y;
  3829. value["yyyy"]=y;
  3830. value["yy"]=y.substring(2,4);
  3831. value["M"]=M;
  3832. value["MM"]=LZ(M);
  3833. value["MMM"]=_month[M-1];
  3834. value["NNN"]=_month[M+11];
  3835. value["d"]=d;
  3836. value["dd"]=LZ(d);
  3837. value["E"]=_day[E+7];
  3838. value["EE"]=_day[E];
  3839. value["H"]=H;
  3840. value["HH"]=LZ(H);
  3841. if (H==0){value["h"]=12;}
  3842. else if (H>12){value["h"]=H-12;}
  3843. else {value["h"]=H;}
  3844. value["hh"]=LZ(value["h"]);
  3845. if (H>11){value["K"]=H-12;} else {value["K"]=H;}
  3846. value["k"]=H+1;
  3847. value["KK"]=LZ(value["K"]);
  3848. value["kk"]=LZ(value["k"]);
  3849. if (H > 11) { value["a"]=_PM; value["aa"]=_PM;; }
  3850. else { value["a"]=_AM; value["aa"]=_AM; }
  3851. value["m"]=m;
  3852. value["mm"]=LZ(m);
  3853. value["s"]=s;
  3854. value["ss"]=LZ(s);
  3855. while (i_format < format.length) {
  3856. c=format.charAt(i_format);
  3857. token="";
  3858. while ((format.charAt(i_format)==c) && (i_format < format.length)) {
  3859. token += format.charAt(i_format++);
  3860. }
  3861. if (value[token] != null) { result=result + value[token]; }
  3862. else { result=result + token; }
  3863. }
  3864. return result;
  3865. }
  3866. // ================================================================================
  3867. // ================================================================================
  3868. //
  3869. // Search Widget
  3870. //
  3871. // ================================================================================
  3872. // ================================================================================
  3873. function newSearchWidget(id,w,searchCB,helpText)
  3874. {
  3875. var o=newWidget(id)
  3876. o.bMatchCase = false;
  3877. o.searchField = newTextFieldWidget(id+"_searchVal",null,50,SearchWidget_keyUpCB,SearchWidget_searchCB,true,_lovSearchFieldLab,w?(w-40):null);
  3878. o.searchField.par = o;
  3879. o.searchField.setHelpTxt(helpText?helpText:_lovSearchFieldLab);
  3880. o.searchIcn = newIconMenuWidget(id+"_searchIcn",_skin+'../lov.gif',SearchWidget_searchCB,null,_lovSearchLab,16,16,0,0,0,0)
  3881. o.searchIcn.par = o
  3882. o.searchMenu = o.searchIcn.getMenu()
  3883. o.normal = o.searchMenu.addCheck(id+"normal",_lovNormalLab,SearchWidget_normalClickCB)
  3884. o.matchCase = o.searchMenu.addCheck(id+"matchCase",_lovMatchCase,SearchWidget_matchCaseClickCB)
  3885. o.oldInit = o.init
  3886. o.searchCB = searchCB
  3887. o.init = SearchWidget_init
  3888. o.getHTML = SearchWidget_getHTML
  3889. o.setCaseSensitive = SearchWidget_setCaseSensitive
  3890. o.isCaseSensitive = SearchWidget_isCaseSensitive
  3891. o.updateMatchCase = SearchWidget_updateMatchCase
  3892. o.getSearchValue = SearchWidget_getSearchValue;
  3893. o.setSearchValue = SearchWidget_setSearchValue;
  3894. o.resize = SearchWidget_resize;
  3895. return o;
  3896. }
  3897. function SearchWidget_getHTML()
  3898. {
  3899. var o=this, s =''
  3900. s= '<table id="'+o.id+'" border="0" cellspacing="0" cellpadding="0"><tbody>' +
  3901. '<tr>' +
  3902. '<td>' + o.searchField.getHTML() + '</td>' +
  3903. '<td>' + o.searchIcn.getHTML() + '</td>' +
  3904. '</tr>' +
  3905. '</tbody></table>';
  3906. return s
  3907. }
  3908. function SearchWidget_resize(w,h)
  3909. {
  3910. var o = this
  3911. o.searchField.resize(w-40,h);
  3912. }
  3913. function SearchWidget_init()
  3914. {
  3915. var o=this
  3916. o.oldInit();
  3917. o.searchField.init()
  3918. o.searchIcn.init()
  3919. o.searchIcn.setDisabled((o.searchField.getValue()=='')) // Disabled if no value set on loading widget
  3920. o.updateMatchCase(o.bMatchCase)
  3921. }
  3922. // function isCaseSensitive
  3923. // indicates if the option is checked
  3924. function SearchWidget_isCaseSensitive()
  3925. // return [boolean] true if the option is checked
  3926. {
  3927. return this.bMatchCase;
  3928. }
  3929. // function setCaseSensitive
  3930. // check or uncheck the match case checkbox
  3931. // update the icon
  3932. function SearchWidget_setCaseSensitive(b)
  3933. // b [boolean] used as is
  3934. {
  3935. var o=this
  3936. if(o.bMatchCase!=b)
  3937. {
  3938. o.updateMatchCase(b);
  3939. o.bMatchCase=b;
  3940. }
  3941. }
  3942. function SearchWidget_updateMatchCase(b)
  3943. {
  3944. var o=this
  3945. o.normal.check(!b)
  3946. o.matchCase.check(b)
  3947. if (b)
  3948. o.searchIcn.icon.changeImg(55,0) // match case icon
  3949. else
  3950. o.searchIcn.icon.changeImg(0,0) // normal icon
  3951. }
  3952. function SearchWidget_normalClickCB()
  3953. {
  3954. var o=this.par.parIcon.par
  3955. if(o.bMatchCase)
  3956. o.bMatchCase=false;
  3957. o.updateMatchCase(o.bMatchCase);
  3958. }
  3959. function SearchWidget_matchCaseClickCB()
  3960. {
  3961. var o=this.par.parIcon.par
  3962. if(!o.bMatchCase)
  3963. o.bMatchCase=true;
  3964. o.updateMatchCase(o.bMatchCase);
  3965. }
  3966. function SearchWidget_keyUpCB()
  3967. {
  3968. var p=this.par
  3969. p.searchIcn.setDisabled((this.getValue()==''))
  3970. }
  3971. function SearchWidget_searchCB()
  3972. {
  3973. var p=this.par;
  3974. if (p.searchCB != null)
  3975. p.searchCB();
  3976. }
  3977. // getSearchValue()
  3978. // Return the value inserted in the search text field
  3979. function SearchWidget_getSearchValue()
  3980. // return a string with the value entered in the search field
  3981. {
  3982. var o=this;
  3983. return o.searchField.getValue();
  3984. }
  3985. // setSearchValue(s)
  3986. // Set the value of the search text field
  3987. function SearchWidget_setSearchValue(s)
  3988. // s [String] string that will be displayed in the textfield
  3989. {
  3990. var o=this;
  3991. o.searchField.setValue(s);
  3992. }
  3993. // ================================================================================
  3994. // ================================================================================
  3995. //
  3996. // OBJECT ToggleButtonWidget (Constructor)
  3997. //
  3998. // Class for building push buttons
  3999. //
  4000. // ================================================================================
  4001. // ================================================================================
  4002. /*
  4003. function newToggleButtonWidget(id,label,cb,width,hlp,tooltip,tabIndex,margin,url,w,h,dx,dy,imgRight,disDx,disDy,togX,togY)
  4004. {
  4005. // CONSTRUCTOR
  4006. // id [String] button ID
  4007. // label [String Optional] button label
  4008. // w [int optional] : text zone minimal width
  4009. // hlp OBSOLETE
  4010. // tooltip [String Optional] button tooltip
  4011. // tabIndex [int Optional] for 508/IE : tab index for keyboard navigation
  4012. // url [String Optional] : the combined image url
  4013. // w [int Optional] the visible image part width
  4014. // dx [int Optional] the horizontal offset in image
  4015. // dy [int Optional] the vertical offset in image
  4016. // disDx : [int - optional] horizontal offset for disabled state
  4017. // disDy : [int - optional] vertical offset for disabled state
  4018. var o=newButtonWidget(id,label,cb,width,hlp,tooltip,tabIndex,margin,url,w,h,dx,dy,imgRight,disDx,disDy)
  4019. o.togX = togX
  4020. o.togY = togY
  4021. o.checked=false
  4022. o.executeCB=ToggleButtonWidget_executeCB
  4023. o.check=ToggleButtonWidget_check
  4024. o.isChecked=ToggleButtonWidget_isChecked
  4025. o.init=ButtonWidget_init
  4026. return o
  4027. }
  4028. // ================================================================================
  4029. function ToggleButtonWidget_executeCB()
  4030. // PRIVATE internal click event handler
  4031. {
  4032. var o=this
  4033. o.check(!o.checked) // toggle
  4034. if (o.cb)
  4035. {
  4036. if (typeof o.cb!="string")
  4037. o.cb()
  4038. else
  4039. eval(o.cb)
  4040. }
  4041. }
  4042. function ToggleButtonWidget_check(checked)
  4043. // check or uncheck an icon check widget
  4044. // check : [boolean] specified if the check icon must be checked or not
  4045. {
  4046. var o=this
  4047. if (o.checked != checked)
  4048. {
  4049. o.checked=checked
  4050. if (o.checked)
  4051. {
  4052. changeSimpleOffset(o.icn,o.togX,o.togY,o.url)
  4053. } else {
  4054. changeSimpleOffset(o.icn,o.dx,o.dy,o.url);
  4055. }
  4056. }
  4057. if (o.checked&&o.beforeClickCB)
  4058. {
  4059. if (o.layer)
  4060. o.beforeClickCB()
  4061. }
  4062. }
  4063. // ================================================================================
  4064. function ToggleButtonWidget_isChecked()
  4065. // return true if checked
  4066. {
  4067. return this.checked
  4068. }
  4069. */