////////////////////////////////////////////////////////// // // // COPYRIGHT 2007 MENTASOLUTIONS ALL RIGHTS RESERVED // // utilisation de ce script sans autorisation interdite // // // ////////////////////////////////////////////////////////// //Gestionaire de fenêtres 'virtuelles' //necessite d'avoir chargé les script ajaxTools var IE = document.all?true:false; if (typeof(document.arrayOpenedWindoz)=="undefined"){ document.arrayOpenedWindoz=new Array(); } if (typeof(overClose)=="undefined"){ var overClose=0; } function Windoz(pURLContent,pCaption,pWidth,pHeight,pTop,pLeft,pPositionType,pTitre,pWaitBeforeFill,pLoadJS){ if(typeof(pLoadJS)=="undefined" || pLoadJS==null){ pLoadJS=false; }if(typeof(pWaitBeforeFill)=="undefined" || pWaitBeforeFill==null){ pWaitBeforeFill=false; } if(typeof(pPositionType)=="undefined" || pPositionType==null){ pPositionType="absolute"; } if(typeof(pTitre)=="undefined" || pTitre==null){ pTitre=""; } this._titre=pTitre; if(typeof(pCaption)=="undefined" || pCaption==null){ pCaption=true; } this._caption=pCaption; if(typeof(pWidth)=="undefined" || pWidth==null){ this._width=""; }else{ this._width='width="'+pWidth+'"'; } if(typeof(pHeight)=="undefined" || pHeight==null){ this._height=""; }else{ this._height='height="'+pHeight+'"'; } if(typeof(pTop)=="undefined" || pTop==null){ this._top=false; }else{ this._top=pTop; } if(typeof(pLeft)=="undefined" || pLeft==null){ this._left=false; }else{ this._left=pLeft; } if(AlreadyOpened(pURLContent)==false){ this.JSUrl=""; currentMaxZIndex=document.arrayOpenedWindoz.length+1000;//uniquement utilisé pour le nom this._name="WDZ_"+currentMaxZIndex; this.URLContent=pURLContent; var urlArray=this.URLContent.split("?"); if(urlArray.length>1)urlArray.pop(); urlArray=(urlArray[0]).split("."); urlArray.pop(); urlArray.push("js"); this.JSUrl=urlArray.join("."); this._div = document.createElement('div'); this._div.setAttribute('id', this._name); var totalCSSText=""; totalCSSText = "position:"+pPositionType+";"; if(this._caption!=true)totalCSSText=totalCSSText+"width:"+pWidth+";"; if(this._caption!=true && pHeight=='100%'&&document.getElementById('_master_div')!=null)totalCSSText=totalCSSText+"height:"+document.getElementById('_master_div').offsetHeight+";"; this._div.style.cssText =totalCSSText; this._div.WDZObject=this; this._div._objParent=this; document.body.appendChild(this._div); arrayOpenedWindozPush(this);//ajoute l'ojet créé au tableau de suivi if(pWaitBeforeFill==false)this.Fill();//rempli le div de l'objet this._livestate="living"; this.WipedUp=function(){ } } } Windoz.prototype.Fill=function(pURL,pFixLocation){ if(typeof(pFixLocation)!="undefined" && pFixLocation==1){ this._top=document.getElementById(this._name).style.top; this._left=document.getElementById(this._name).style.left; } if(typeof(pURL)!="undefined" && pURL!="" && pURL!=null){ this.URLContent=pURL; } if(this._caption==true && document.getElementById(this._name).innerHTML==""){ document.getElementById(this._name).innerHTML='
 '+this._titre+'  
';} if(this._caption!=true && document.getElementById(this._name).innerHTML==""){ document.getElementById(this._name).innerHTML='
'; } var aBox=new AjaxBox('GET',this.URLContent,this._name+"_container",'',"document.getElementById('"+this._name+"').WDZObject.Show();"); aBox.XHRGET(); } Windoz.prototype.Collapse=function(){ if(document.getElementById(this._name+'_container').style.display=="none"){ document.getElementById(this._name+'_container').style.display="block"; document.getElementById('span_titre_'+this._name).style.position="absolute"; document.getElementById("imgClpse"+this._name).src="/commun/images/collapse.png"; }else{ document.getElementById('span_titre_'+this._name).style.position=""; document.getElementById(this._name+'_container').style.display="none"; document.getElementById("imgClpse"+this._name).src="/commun/images/expend.png"; } } Windoz.prototype.SetTitle=function(pText){ this._titre=pText; document.getElementById("span_titre_"+this._name).innerHTML=pText; } Windoz.prototype.WipeUp=function(){ this._div.style.overflow="hidden"; this._div.style.height=this._div.offsetHeight+"px"; this._div.height=this._div.offsetHeight; this.sizeTimer=setTimeout('document.getElementById("'+this._name+'").WDZObject.ResizeWindoz(0,-20)',10); } Windoz.prototype.ResizeWindoz=function (pDeltaWidth,pDeltaHeight){ curDiv=this._div; if((curDiv.height+pDeltaHeight)<0){;pDeltaHeight=(-1);}; if((curDiv.height+pDeltaHeight)>0){ curDiv.style.height=(curDiv.height+pDeltaHeight)+"px"; curDiv.height=(curDiv.height+pDeltaHeight); if(curDiv.height!=0){this.sizeTimer=setTimeout('document.getElementById("'+this._name+'").WDZObject.ResizeWindoz(0,-20)',10);} }else{ curDiv.style.visibility="hidden"; curDiv.style.overflow="inherit"; this.WipedUp(); } } Windoz.prototype.Show=function(pTitre){ if(document.elementToHideDuringWindoz!=null){ document.elementToHideDuringWindoz.style.display="none"; document.elementToHideDuringWindozLEFTPOS=document.elementToHideDuringWindoz.style.left; document.elementToHideDuringWindoz.style.left=-5000}; CentreElement(this._name); if(this._top!=false)document.getElementById(this._name).style.top=this._top; if(this._left)document.getElementById(this._name).style.left=this._left; document.getElementById(this._name).style.display="block"; document.getElementById(this._name).style.visibility="visible"; if(typeof(pTitre)!="undefined" && pTitre!=null)this.SetTitle(pTitre); this.OnShown(); LoadScript(this.JSUrl); } Windoz.prototype.Hide=function(){ if(this._livestate!="dead"&&document.getElementById(this._name)!=null){ this.BeforeClose(); eltToDelete=document.getElementById(this._name); document.onmousemove=null; document.onmousedown=null; delete oldX; delete oldY; eltToDelete.style.visibility="hidden"; DelWindozFromArrayOpened(this,true); document.body.removeChild(eltToDelete);// elimine l'element div du body OrganiZindex(); overClose=0; this.OnClose(); this._livestate="dead"; NullObj(this); document.onmouseup=null; } } Windoz.prototype.Move=function() { if(overClose==0){ SendToTop(this); document.currentMovedWindozName=this._name; document.onmouseup=function(){ document.onmousemove=null; delete oldX; delete oldY; reg=new RegExp("(px)", "g"); if((document.getElementById(document.currentMovedWindozName).style.top.replace(reg,"") - document.body.scrollTop)<0)document.getElementById(document.currentMovedWindozName).style.top=0; }; document.onmousemove=function(e){ if (IE) { // grab the x-y pos.s if browser is IE curX = event.clientX + document.body.scrollLeft; curY = event.clientY + document.body.scrollTop; } else { // grab the x-y pos.s if browser is NS curX = e.pageX; curY = e.pageY; } if(typeof(oldX)=="undefined" || typeof(oldY)=="undefined"){ oldX=curX; oldY=curY; } deltaX=curX-oldX; deltaY=curY-oldY; reg=new RegExp("(px)", "g"); curDivX=document.getElementById(document.currentMovedWindozName).style.left.replace(reg,""); curDivX=parseInt(curDivX); curDivY=document.getElementById(document.currentMovedWindozName).style.top.replace(reg,""); curDivY=parseInt(curDivY); document.getElementById(document.currentMovedWindozName).style.left=curDivX+deltaX+"px"; document.getElementById(document.currentMovedWindozName).style.top=curDivY+deltaY+"px"; oldX = curX; oldY = curY; return true; } } } Windoz.prototype.BeforeClose=function(){ } Windoz.prototype.OnClose=function(){ } Windoz.prototype.OnShown=function(){ } function arrayOpenedWindozPush(pObj){ document.arrayOpenedWindoz.push(pObj); OrganiZindex(); //Showdocument.arrayOpenedWindoz(" --add"); } function arrayOpenedWindozSplice(pObj,pPos){ document.arrayOpenedWindoz.splice(pObj,pPos); OrganiZindex(); //Showdocument.arrayOpenedWindoz(" --del"); } function ShowarrayOpenedWindoz(pComment){ document.getElementById('arrayOpenedWindozInspector').innerHTML=""; Stamp = new Date(); html=Stamp.getSeconds(); for(t=0;t"; } document.getElementById('arrayOpenedWindozInspector').innerHTML=html; } function DelWindozFromArrayOpened(pWindoz,pHideElmtToHide){ if(typeof(pHideElmtToHide)=="undefined")pHideElmtToHide=false; for(w=0;w