/************************************************************************** ** Projet : OUTIL_EXTRACTION ** Nom du fichier : selection.inc.js ** Créé le : Par : ** Contenu : Fichier contenant les fonctions de gestion des outils de sélection sur la carte ** ** ** Modifications : ** numéro : auteur : date : objet : le : ** ** ***************************************************************************/ /* Configuration */ var browser = null ; var selectionDivId = 'cadreVide' ; var zoomCarreeDivId = 'zoomboxIn' ; var zoomDivId = 'zoombox' ; var visualisationDivId = 'visualisation' ; var infoDivId = 'cadre_info' ; var infoBulleDivId = 'infoTrav'; var nbreOutil = 14; var nbrNavoutil = 8; var idCarte = 'selectionVectLayer'; var carte = null; var vectLayer = null; var iDelta = 20; //décalage lors du déplacement par zoom slide // Initialisation des variables attributs de la carte var cartex = 0; var cartey = 0; var cartew = 0; var carteh = 0; var cartepanx = 0; var cartepany = 0; // Initialisation des coordonnées de deplacement d'une station var pointFinalx = 0; var pointFinaly = 0; var pointInitialex = 0; var pointInitialey = 0; // Initialisation des variables d'état de la carte var carte_lockmap = false ; var carte_dragging = false ; var carteZoomBox = null; var carte_state = 'zoomin'; // Initialisation des div de manipulation de la carte var visualisationDiv = null ; var selectionDiv = null; var divImage = null ; var cadreVideDiv = null; var divCarreZoom = null; var divInfo = null; var divInfoBulle = null; //Initialisation variables coordonnées de zoomin var pointZoomInitialX = 0 ; var pointZoomInitialY = 0 ; var pointZoomFinalX = 0 ; var pointZoomFinalY = 0 ; var pointZoomInitialXcarree = 0; var pointZoomInitialYcarree = 0; var bActionCur = 0 ; /********variables zoom ref********/ var cadreRefClassId = 'cadreRef'; var refImgId = 'refMapImg'; var refDivId = 'refmap'; var drag_begin = false ; var cadreRefClass = null; var refImage = null; var refDiv = null; var wCadreRef = 0; var hCadreRef = 0; var wRef = 0; var hRef = 0; var xRef = 0; var yRef = 0; var wimgRef = 0; var himgRef = 0; var croix = false ; var cadreRefCroix = null ; var openDiv = true ; /*************fin****************/ var imageClassId = 'cadreImageClass' ; var imageClass = null ; var yRefClass = 0 ; var xRefClass = 0 ; var dragClass_begin = false ; /* Variables curseur */ var zoominCursor = "images/cursor/zoomin.cur"; var zoomoutCursor = "images/cursor/zoomout.cur"; var panCursor = "images/cursor/pan.cur"; helpCursor = "images/cursor/help.cur"; /* ----- */ //var xhrRedraw = null; var tempsDernierClick = null; var dernierClick = null; var tempsEntreDeuxClics = 50; var tmo = null; var cartemouseDown = false; tmr = window.setTimeout("",500); var checkInfo = false; var prevCurseur = 'default'; var prevCarte_state = 'zoomin'; var xprev = 0; var yprev = 0; var couche = null; var champ = null; var compt = 0; var deplStationMouve = 0; var tempshow = false; var wmax = 135; var wmin = 0; var vitRed = 4; // vitesse de transition lors de la réduction ou de l'agrandissemnt, en % var DurRed = 10; // dur?entre deux appels de la fonction, en ms var bInfo = false; function activateToolTip(){ bToolTip = true;} function preloadImages() { var d=document; if(d.images){ if(!d.p) d.p=new Array(); var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i=4) { var retour = new Array(); posx = (navigator.appName == 'Netscape')? e.layerX : event.offsetX; posy = (navigator.appName == 'Netscape')? e.layerY : event.offsetY; retour.push(posx); retour.push(posy); return retour; } } function desactiveToolTip(){ divInfoBulle.style.display = 'none'; } function area_MouseOver() { /*if(arguments[0] && arguments[1]){ ShowTip(event,arguments[0],arguments[1]); } */ mapDiv = document.getElementById("visualisation"); carteClick(mapDiv,false); setInfoCursor(); } function toolTipStat(parTexte,pointZoomMouveX, pointZoomMouveY){ if(parTexte != ''){ var divLeft = parseInt(cartex+pointZoomMouveX+20); divInfoBulle.style.left = parseInt(cartex+pointZoomMouveX+20)+"px"; divInfoBulle.style.top = parseInt(cartey+pointZoomMouveY+20)+"px"; divInfoBulle.style.width = 150+"px"; divInfoBulle.innerHTML = parTexte ; if(parseInt(divInfoBulle.style.left)+parseInt(divInfoBulle.style.width) > parseInt(visualisationDiv.style.width)){ var diff = parseInt(divInfoBulle.style.left)+parseInt(divInfoBulle.style.width) - parseInt(visualisationDiv.style.width); divInfoBulle.style.left = (parseInt(cartex+pointZoomMouveX+20) - diff) +"px"; } if(parseInt(divInfoBulle.style.top)+parseInt(divInfoBulle.style.height) > parseInt(visualisationDiv.style.height)){ var diff = parseInt(divInfoBulle.style.top)+parseInt(divInfoBulle.style.height) - parseInt(visualisationDiv.style.height); divInfoBulle.style.top = (parseInt(cartex+pointZoomMouveX+20) - diff) +"px"; } divInfoBulle.style.display = 'block'; }else { divInfoBulle.style.left = "0px"; divInfoBulle.style.top = "0px"; divInfoBulle.innerHTML = '' ; divInfoBulle.style.display = 'none'; } } function area_MouseOut(){ //if(arguments[0]) HideTip(arguments[0]) ; mapDiv = document.getElementById("visualisation"); carteClick(mapDiv,true); setCursor(); } function carte_MouseDown(e) { if(document.getElementById('admin').style.display == 'block') document.getElementById('mapImg').useMap = ''; mousEvent = getMousePosition(e); if (document.all){ e=window.event ; e.pageX = mousEvent[0]; e.pageY = mousEvent[1]; }else { e.x= mousEvent[0]; e.y= mousEvent[1]; } divImage = id2element('mapImg'); cartepanleft = divImage.style.left; cartepantop = divImage.style.top; cartepanx = mousEvent[0]; cartepany = mousEvent[1]; cartemouseDown = true; if (carte_lockmap){ return true; } carte_dragging = true; if (carte_state == 'avantSuppr'){ getClick(mousEvent[0],mousEvent[1]); } if (carte_state == 'zoomout'){ bActionCur = 1 ; getClick(e); cartemouseDown = false; carte_dragging = false; }else if (carte_state == 'zoompan') { bActionCur = 1 ; desactiveToolTip(); divImage = id2element('mapImg'); visualisationDiv = id2element('visualisation'); visualisationDiv.style.display ="none"; selectionDiv.innerHTML =""; divImageSel = document.getElementById("mapImgSel"); divImageSel.className="dragme"; selectionDiv.style.display = "block" ; visualisationDiv.style.display = "none" ; }else if(carte_state == 'zoomin'){ pointZoomInitialX = mousEvent[0]; pointZoomInitialY = mousEvent[1]; pointZoomInitialXcarree = cartex+pointZoomInitialX; pointZoomInitialYcarree = cartey+pointZoomInitialY; divCarreZoom.style.width = 1+"px"; divCarreZoom.style.height = 1+"px"; divCarreZoom.style.left =pointZoomInitialXcarree+"px"; divCarreZoom.style.top =pointZoomInitialYcarree+"px"; divCarreZoom.style.display = "block"; }else if (carte_state == 'measure') { bActionCur = 1 ; if (vectLayer.xCoords.length > 0){ vectLayer.displayMeasure(e,cartew,carteh,extent.join('+')); }else { vectLayer.initMesure(e); } }else if (carte_state == 'selp' || carte_state == 'saisie'){ bActionCur = 1 ; desactiveToolTip(); vectLayer.growPolyArea(e); id2Elt('mapImg').ondblclick = function() { vectLayer.stopPolyArea(e); } }else if (carte_state == 'seldot') { vectLayer.startCircle(e); vectLayer.stopDot(cartew,carteh,extent.join('+')); }else if (carte_state == 'selc') { vectLayer.startCircle(e); }else if (carte_state == 'selof') { bActionCur = 1; desactiveToolTip(); vectLayer.growPolySelof(e); id2Elt('mapImg').ondblclick = function() { vectLayer.buildStrGeoCoords(); } }else if (carte_state == 'query') { /// envoie la requete pour l'information getInfoLayer(e); }else if(carte_state == 'avantDepl'){ if(compt == 0 ){ pointInitialex = mousEvent[0]; pointInitialey = mousEvent[1]; infostat_depl(pointInitialex,pointInitialey); compt = 1 ; }else if(compt == 1){ pointFinalx = mousEvent[0]; pointFinaly = mousEvent[1]; station_deplacement(pointInitialex,pointInitialey,pointFinalx,pointFinaly); pointFinalx = 0; pointFinaly = 0; pointInitialex = 0; pointInitialey = 0; compt = 0 ; deplStationMouve = 0 ; } } return false; } var tmr ="" ; function Map_MouseMove(e) { //tmr = null ; if (document.all){ e=window.event ; exOriginal = e.pageX ; eyOriginal = e.pageY ; }else { exOriginal = e.x ; eyOriginal = e.y ; } mousEvent = getMousePosition(e); if (document.all){ e=window.event ; e.pageX = mousEvent[0]; e.pageY = mousEvent[1]; }else { e.x= mousEvent[0]; e.y= mousEvent[1]; } bInfo = false; desactiveToolTip(); ////////////////////////////////////////////////////////////////// /*window.clearTimeout(tmr); tmr = window.setTimeout("desactiveToolTip()",1000);*/ if(!carte_dragging ){ if(echelleCur < 12500){ if(verifMouveOver(e)){ window.clearTimeout(tmr); strURL = "showInfoBulle("+mousEvent[0]+","+mousEvent[1]+")"; //strURL = "alert('blabla')"; tmr = window.setTimeout(strURL,500); } } } setCursor(); ///////////////////////////////////////////////////////////////// if (carte_lockmap) { return true; } if (carte_dragging) { document.getElementById('mapImg').useMap = ''; desactiveToolTip(); if(carte_state == 'zoompan'){ divImageSel = id2element('mapImgSel'); divImageSel.style.left =cartepanleft + mousEvent[0]-cartepanx; divImageSel.style.top =cartepantop + mousEvent[1]-cartepany; } if (carte_state == 'selc'){ vectLayer.growCircle(e,cartew,carteh,extent.join('+')); } else if(carte_state == 'zoomin'){ paramPointZoomMouveX = mousEvent[0] ; paramPointZoomMouveY = mousEvent[1] ; if((pointZoomInitialX-paramPointZoomMouveX > 0) && (pointZoomInitialY-paramPointZoomMouveY > 0)){ divCarreZoom.style.left = parseInt(cartex+paramPointZoomMouveX)+"px"; divCarreZoom.style.top = parseInt(cartey+paramPointZoomMouveY)+"px"; divCarreZoom.style.width = Math.abs(paramPointZoomMouveX - pointZoomInitialX); divCarreZoom.style.height = Math.abs(paramPointZoomMouveY - pointZoomInitialY); }else startZoomBox(paramPointZoomMouveX, paramPointZoomMouveY) ; }else if(carte_state =='adminClass'){ desactiveToolTip(); //if(dragClass_begin){ //mousEvent = getImageClassPosition(e); pointx = mousEvent[0]; pointy = mousEvent[1]; wImgClass = parseInt(imageClass.style.width); hImgClass = parseInt(imageClass.style.height); Imgminx = parseInt(pointx-(wImgClass/2)); Imgminy = parseInt(pointy-(hImgClass/2)); newleft = deltax+Imgminx; newtop = deltay+Imgminy; newrigth = newleft+wImgClass; newbottom = newtop+hImgClass; if(newleft>deltax && newtop>deltay && newrigth<(deltax+cartew) && newbottom<(deltay+carteh)) { imageClass.style.left =newleft; imageClass.style.top =newtop; } // return false; //} //return true ; } return false; }else { /*if(carte_state == 'query'){ //if(mousEvent[0]> 0 && mousEvent[0] 0 && mousEvent[1] 0){ if (browser == "Internet Explorer"){ e.pageX = exOriginal; e.pageY = eyOriginal; //e.y = mousEvent[1]; }else { e.x= exOriginal; e.y= eyOriginal; } vectLayer.growPolyTempArea(e); // trace les lignes quand le souris bouge } } else if(carte_state == 'selof'){ if (vectLayer.xCoords.length > 0){ if (browser == "Internet Explorer"){ e.pageX = exOriginal; e.pageY = eyOriginal; //e.y = mousEvent[1]; }else { e.x= exOriginal; e.y= eyOriginal; } vectLayer.growPolyTempSelof(e); // trace les lignes quand le souris bouge } } return true; } return false ; } function Map_MouseUp(e) { if(document.getElementById('admin').style.display == 'none' ){ document.getElementById('mapImg').useMap = '#carte'; } mousEvent = getMousePosition(e); if (document.all){ e=window.event ; e.pageX = mousEvent[0]; e.pageY = mousEvent[1]; }else { e.x= mousEvent[0]; e.y= mousEvent[1]; } if (!carte_dragging)return true; if (carte_lockmap)return true; carte_dragging = false; if (carte_state == 'zoompan') { if ((cartepanx == mousEvent[0]) && (cartepany == mousEvent[1])) { map_pan(mousEvent[0],mousEvent[1]); } else{ map_pan(Math.round(cartew/2)-(mousEvent[0]-cartepanx),Math.round(carteh/2)-(mousEvent[1]-cartepany)); } selectionDiv.style.display = "block" ; visualisationDiv.style.display = "none" ; }else if(carte_state == 'zoomin'){ pointZoomFinalX = mousEvent[0]; pointZoomFinalY = mousEvent[1]; divCarreZoom.style.display = "none" ; visualisationDiv.style.display = "block" ; zoomrectangle() ; }else if(carte_state == 'deplStation'){ pointFinalx = mousEvent[0]; pointFinaly = mousEvent[1]; station_deplacement(pointInitialex,pointInitialey,pointFinalx,pointFinaly); pointFinalx = 0; pointFinaly = 0; pointInitialex = 0; pointInitialey = 0; }else if (carte_state =='selc'){ vectLayer.stopCircle(e,cartew,carteh,extent.join('+')); }else if (carte_state == 'selp'){ if (vectLayer.verifDoubleClicArea()){ vectLayer.stopPolyArea(e); } }else if(carte_state == 'adminClass'){ inputX = document.getElementById('positionX'); inputY = document.getElementById('positionY'); inputY.value = parseInt(getTop(imageClass) - cartey +7); inputX.value = parseInt(getLeft(imageClass) - cartex +7); } return false; } function selByPoint(parX,parY) { if(touche_ctrl) { var typeSel = 2; }else { var typeSel = 1; } var listRadio = document.getElementsByName('selection'); for(var i =0 ;i 0 ){ LargCadRef = LargCadRef-diffLeft; newLeft = newLeft+diffLeft; } if(diffTop > 0 ){ HautCadRef = HautCadRef-diffTop; newTop = newTop+diffTop; } if(diffRigth < 0){ LargCadRef = LargCadRef+diffRigth; } if(diffBotton < 0){ HautCadRef = HautCadRef+diffBotton; } if(newTop > btCadRef){ newTop = btCadRef; LargCadRef = 0; HautCadRef = 0; } if(newLeft > rigthCadRef){ newLeft = rigthCadRef; LargCadRef = 0; HautCadRef = 0; } if(LargCadRef+HautCadRef<15){ croix = true ; if(openDiv)cadreRefClassCroix.style.display = "block"; cadreRefClass.style.display = "none"; cadreRefClassCroix.style.left =parseInt((LargCadRef/2+newLeft)-15)+"px"; cadreRefClassCroix.style.top =parseInt((HautCadRef/2+newTop)-15)+"px"; } else{ croix = false ; cadreRefClassCroix.style.display = "none"; if(openDiv)cadreRefClass.style.display = "block"; cadreRefClass.style.width = LargCadRef+"px"; cadreRefClass.style.height = HautCadRef+"px"; cadreRefClass.style.left =parseInt(newLeft)+"px"; cadreRefClass.style.top =parseInt(newTop)+"px"; } } function inserer_cartereference(){ divHead = id2element('refhead'); divminicarte = id2element(refDivId); cartex = parseInt(visualisationDiv.offsetLeft); cartey = parseInt(visualisationDiv.offsetTop) ; divminicarte.style.left = cartex ; divminicarte.style.top = cartey ; if(openDiv == true)divHead.style.left = parseInt(divminicarte.style.left)+parseInt(divminicarte.style.width); else divHead.style.left = parseInt(divminicarte.style.left); divHead.style.top = cartey; divHead.style.display = 'block'; } function refMouseDown(e){ drag_begin = true ; } function refMouseMouve(e) { if(drag_begin){ mousEvent = getReferencePosition(e); pointx = mousEvent[0]; pointy = mousEvent[1]; if(!croix){ wCadreRef = parseInt(cadreRefClass.style.width); hCadreRef = parseInt(cadreRefClass.style.height); refminx = parseInt(pointx-(wCadreRef/2)); refminy = parseInt(pointy-(hCadreRef/2)); newleft = xRef+refminx; newtop = yRef+refminy; newrigth = newleft+wCadreRef; newbottom = newtop+hCadreRef; if(newleft>xRef && newtop>yRef && newrigth<(xRef+wRef) && newbottom<(yRef+hRef)) { cadreRefClass.style.left = newleft; cadreRefClass.style.top = newtop; } return false; }else{ refminx = parseInt(pointx-15); refminy = parseInt(pointy-15); newleft = xRef+refminx; newtop = yRef+refminy; newrigth = newleft+30; newbottom = newtop+30; if(newleft>xRef && newtop>yRef && newrigth<(xRef+wRef) && newbottom<(yRef+hRef)){ cadreRefClassCroix.style.left = newleft; cadreRefClassCroix.style.top = newtop; } return false; } } return true ; } function refMouseUp(e){ drag_begin = false ; mousEvent = getReferencePosition(e); pointx = mousEvent[0]; pointy = mousEvent[1]; if(!croix){ wCadreRef = parseInt(cadreRefClass.style.width); hCadreRef = parseInt(cadreRefClass.style.height); refminx = parseInt(Math.abs(pointx-(wCadreRef/2))); refminy = parseInt(pointy-(hCadreRef/2)); refmaxx = parseInt(pointx+(wCadreRef/2)); refmaxy = parseInt(pointy+(hCadreRef/2)); } else{ wCadreRef = 3; hCadreRef = 3; refminx = parseInt(Math.abs(pointx-(wCadreRef/2))); refminy = parseInt(pointy-(hCadreRef/2)); refmaxx = parseInt(pointx+(wCadreRef/2)); refmaxy = parseInt(pointy+(hCadreRef/2)); } parURLzoom = 'drawMap.php?xInit='+refminx+'&yInit='+refminy+'&xFin='+refmaxx+'&yFin='+refmaxy+'&wimgRef='+wRef+'&himgRef='+hRef+'&carte_state=zoomref'; mapDiv = document.getElementById("visualisation"); redrawMap(parURLzoom); carte_state = 'zoomin'; } function getReferencePosition(e) { var retour = new Array(); var posx = 0; var posy = 0; if (!e) var e = window.event; if(e.pageX || e.pageY){ posx = e.pageX; posy = e.pageY; }else if (e.clientX || e.clientY){ posx = e.clientX + document.body.scrollLeft ; posy = e.clientY + document.body.scrollTop; } coinleft = getLeft(refDiv);//parseInt(refDiv.offsetLeft); cointop = getTop(refDiv);//parseInt(refDiv.offsetTop) ; //coinleft = parseInt(refDiv.offsetLeft); //cointop = parseInt(refDiv.offsetTop); if (browser == "Internet Explorer"){ bod = document.getElementById('body'); posx = posx - coinleft - parseInt(bod.style.borderWidth); posy = posy - cointop - parseInt(bod.style.borderWidth); }else{ posx = posx - coinleft; posy = posy - cointop ; } retour.push(posx); retour.push(posy); return retour ; } /*********************************************************************************************/ function verifMouveOver(e){ if (!e) var e = window.event; if (e.target) targ = e.target; else if (e.srcElement) targ = e.srcElement; if(targ.tagName == "IMG")targ = targ.parentNode; if(targ.id =="visualisation")return true ; else return false ; } function showInfoBulle(parX,parY){ bInfo = true; parURL = 'ajax.inc.php?carte_state=infostat&x='+parX+'&y='+parY; //toolTipStat(parURL,mousEvent[0], mousEvent[1]); if(parX < 567 && parY < 452) infoBulleDisplay(parURL,parX,parY); } function showInfoMap(parX,parY){ if(cartemouseDown == false){ prevCarte_state = carte_state; parURL = 'ajax.inc.php?x='+parX+'&y='+parY+'&showInfo=true'; //twAller(parURL) ; getInfo(parURL); } } function showInfo(sObjType,idObj,parX,parY){ parURL = 'ajax.inc.php?x='+parX+'&y='+parY+'&type='+sObjType+'&gid='+idObj+'&showInfo=true'; getInfo(parURL); } function displayInfo(parTexte,pointZoomMouveX, pointZoomMouveY){ if(parTexte != ''){ divInfo.style.left = parseInt(cartex+pointZoomMouveX+20)+"px"; divInfo.style.top = parseInt(cartey+pointZoomMouveY+20)+"px"; divInfo.style.width = "100px"; divInfo.innerHTML = parTexte ; divInfo.style.display = 'block'; }else { divInfo.style.display = 'none'; } } function remodecarte(carte_mode){ setModeState(carte_mode); if(carte_mode == 'zoomin'){ for(nav=1;nav=4){ if(navigator.appName == 'Netscape')iTouche = e.which ; else iTouche = e.keyCode ; if(iTouche == 17)touche_ctrl=true; else touche_ctrl=false; } return true ; } function enableCtrl(e){ touche_ctrl = false ; return true ; } function desactiveToolTip(){ divInfoBulle.style.display = 'none'; } function verifMouseUp(e){ if (carte_state == 'selc'){ Map_MouseUp(e); } } function getClick(parX,parY) { parURL = 'drawMap.php?x='+parX+'&y='+parY+'&carte_state='+carte_state; redrawMap(parURL); } function setModeInfo(info){ if(info == 'adm1'){ if(document.getElementById('admin').style.display == "none"){ openCadre_arc('cadre_admin_connect','Administration',130,256,100,100,'adminConnect.php'); } } if(info == 'nav1_admin'){ document.getElementById('control').style.display='none'; document.getElementById('admin').style.display='block'; } } function verifFormData(objForm){ var bVerif = true; var xpos = objForm.elements['positionX'].value; var ypos = objForm.elements['positionY'].value; var soustype = objForm.elements['soustype'].value; var valeur = objForm.elements['soustypetrav'].value; var namem = objForm.elements['name'].value; var strLayer = objForm.elements['typetrav'].value; if(namem == ''){ alert("Veuillez remplir le Nom."); bVerif =false ; } if(xpos == '' && ypos == ''){ bVerif =false ; alert("veuillez cliquer l'icone qui apparait au dessus et deplacer l'icone qui se trouve dans la carte "); } if(bVerif == true){ var soustypemap = objForm.elements['soustypemap'].value; var valeurAdresse = objForm.elements['infos_adresse_name'].value; var valeurCp = objForm.elements['infos_cp_name'].value; var valeurUrl = objForm.elements['infos_url_name'].value; document.getElementById('cadreImageClass').style.display = "none"; parURL = 'supprObj.php?x='+xpos+'&y='+ypos+'&soustype='+soustype+'&valeur='+valeur+'&namem='+namem+'&soustypemap='+soustypemap+'&valeurAdresse='+valeurAdresse+'&valeurCp='+valeurCp+'&valeurUrl='+valeurUrl+'&strLayer='+strLayer; creatObj(parURL,soustype,xpos,ypos) ; return false ; } return bVerif ; } function creatObj(parurl,soustypemap,xpos,ypos){ document.getElementById('divWait').style.display = "block"; xhrcreatObj = getXhrRetourn(); xhrcreatObj.onreadystatechange = function(){ if(xhrcreatObj.readyState == 4 && xhrcreatObj.status == 200){ eval(xhrcreatObj.responseText); } } xhrcreatObj.open("GET",parurl,true); xhrcreatObj.send(null); } function fermerAdmin(){ if(confirm("Voulez-vous fermer la session administrateur ?")){ document.getElementById('control').style.display="block"; document.getElementById('admin').style.display='none'; document.getElementById('navmeta3').className = ""; } if(document.getElementById('adminCreate').style.display == 'block'){ document.getElementById('adminCreate').style.display = 'none'; document.getElementById("admin1").className = ""; reinitChampcreat(); } if(document.getElementById('adminMove').style.display == 'block'){ document.getElementById('adminMove').style.display = 'none'; document.getElementById("admin2").className = ""; reinitdepl(); } if(document.getElementById('adminDelete').style.display == 'block'){ document.getElementById('adminDelete').style.display = 'none'; document.getElementById("admin3").className = ""; reinitsupr(); } if(document.getElementById('adminMap').style.display == 'block'){ document.getElementById('adminMap').style.display = 'none'; document.getElementById("admin4").className = ""; } document.getElementById('mapImg').useMap = '#carte'; } function pCurrent(parAction){ for(nav=1; nav <= 8; nav++){ cur = document.getElementById('sub'+nav); cur.className = "" ; } if(parAction == "admin1"){ document.getElementById("admin3").className = ""; document.getElementById("admin2").className = ""; document.getElementById("admin4").className = ""; document.getElementById("admin1").className = "current"; }else if(parAction == "admin2"){ document.getElementById("admin3").className = ""; document.getElementById("admin4").className = ""; document.getElementById("admin1").className = ""; document.getElementById("admin2").className = "current"; }else if(parAction == "admin3"){ document.getElementById("admin3").className = "current"; document.getElementById("admin1").className = ""; document.getElementById("admin2").className = ""; document.getElementById("admin4").className = ""; }else if(parAction == "admin4"){ document.getElementById("admin4").className = "current"; document.getElementById("admin1").className = ""; document.getElementById("admin2").className = ""; document.getElementById("admin3").className = ""; } } function supprlayer(){ var gid = document.getElementById('nomcouche').value; parUrlSuppr = 'supprObj.php?gid='+gid; supprimerObj(parUrlSuppr) ; return false ; } function supprimerObj(parurl){ xhrsupprimerObj = getXhrRetourn(); xhrsupprimerObj.onreadystatechange = function(){ if(xhrsupprimerObj.readyState == 4 && xhrsupprimerObj.status == 200){ eval(xhrsupprimerObj.responseText); //alert(xhrsupprimerObj.responseText) ; parURL = 'drawMap.php?carte_state=ok' ; redrawMap(parURL) ; } } xhrsupprimerObj.open("GET",parurl,true); xhrsupprimerObj.send(null); } function infostat_depl(Xinit,Yinit){ xinit = Xinit; yinit = Yinit; parURL = 'drawMap.php?x='+xinit+'&y='+yinit+'&carte_state='+carte_state; //alert(parURL); redrawMap(parURL); } function station_deplacement(initX,initY,finX,finY){ giddepl = document.getElementById('giddepl').value; soustypedepl = document.getElementById('soustypedepl').value; parURL = 'supprObj.php?finx='+finX+'&finy='+finY+'&giddepl='+giddepl; deplacerObjet(parURL,giddepl,soustypedepl) ; return false ; } function deplacerObjet(parurl,giddepl,soustypedepl){ xhrsupprimerObj = getXhrRetourn(); xhrsupprimerObj.onreadystatechange = function(){ if(xhrsupprimerObj.readyState == 4 && xhrsupprimerObj.status == 200){ eval(xhrsupprimerObj.responseText); //alert(xhrsupprimerObj.responseText) ; parURL = 'drawMap.php?carte_state=depl&giddepl='+giddepl+'&soustypedepl='+soustypedepl ; redrawMap(parURL) ; } } xhrsupprimerObj.open("GET",parurl,true); xhrsupprimerObj.send(null); } function reinitImagecadre(){ imageClass.style.display='none'; imageClass.style.top = parseInt(yRefClass)+'px' ; imageClass.style.left = parseInt(xRefClass)+'px' ; } function reinitChampcreat(){ document.getElementById('typetrav').value = ''; document.getElementById('soustypetrav').value = ''; document.getElementById('name').value = ''; document.getElementById('positionX').value = ''; document.getElementById('positionY').value = ''; document.getElementById('soustype').value = ''; document.getElementById('soustypemap').value = ''; document.getElementById('sousdisplay').style.display = 'none'; document.getElementById('soudisp').style.display = 'none'; reinitImagecadre(); } function activecreate(){ document.getElementById('adminDelete').style.display = 'none'; document.getElementById('adminCreate').style.display = 'block'; document.getElementById('adminMove').style.display = 'none'; compt = 0 ; deplStationMouve = 0 ; } function reinitdepl(){ document.getElementById('infoContent').innerHTML =""; document.getElementById('avatarImg').src="images/pictos/mairie.gif"; conte1 = document.getElementById("trdepl1"); conte1.style.display = "block"; idnotext = document.getElementById("giddepl"); idnotext.value=""; idnomval = document.getElementById("soustypedepl"); idnomval.value=""; conte2 = document.getElementById("trdepl2"); conte2.style.display = "none"; conte3 = document.getElementById("trdepl3"); conte3.style.display = "none"; conte4=document.getElementById("tddepl3"); conte4.innerHTML =""; compt = 0 ; deplStationMouve = 0; } function reinitsupr(){ document.getElementById('infoContent').innerHTML =""; document.getElementById('avatarImg').src="images/pictos/mairie.gif"; contenu1 = document.getElementById("trsuprr1"); contenu1.style.display = "block"; contenu2 = document.getElementById("trsuprr2"); contenu2.style.display = "none"; contenu3 = document.getElementById("trsuprr3"); contenu3.style.display = "none"; contenu4 = document.getElementById("trsuprr4"); contenu4.style.display = "none"; contenu5 = document.getElementById("trsuprr5"); contenu5.style.display = "none"; contenu6=document.getElementById("tdsuprr3"); contenu6.innerHTML =""; idnomtext = document.getElementById("nomcouche"); idnomtext.value=""; } function showref(show){ reference = id2element(cadreRefClassId); imgref = document.getElementById('reducerefplus'); var wnow = parseInt(refDiv.style.width.split("px")[0]); var tmpcib = 0; if(show){ tmpcib = wnow + ( wmax * vitRed / 135 ); refDiv.style.display='block'; if(croix)reference.style.display = "none"; else cadreRefCroix.style.display = "none"; } else{ tmpcib = wnow - ( wmax * vitRed / 135 ); refDiv.style.display = "none"; if(!croix)reference.style.display = "none"; else cadreRefCroix.style.display = "none"; imgref.src = "images/nav/show.gif"; tempshow = true; openDiv = false ; } if ( tmpcib >= wmin && tmpcib <= wmax ) { refDiv.style.width = tmpcib + "px"; (show) ? setTimeout("showref(true);",DurRed) : setTimeout("showref(false);",DurRed); } divHead.style.left = parseInt(refDiv.style.left) + parseInt(refDiv.style.width); if(tmpcib>0) { refDiv.style.display='block'; if(tmpcib == wmax){ if(croix)cadreRefCroix.style.display = "block"; else reference.style.display = "block"; imgref.src = "images/nav/hide.gif"; tempshow = false; openDiv = true ; } } else{ refDiv.style.display='none'; if(croix)cadreRefCroix.style.display = "none"; else reference.style.display = "none"; } } function afficheImageselect(){ var val = document.getElementById('formattype').value; urlgo="print/printmap.php?docFormat="+val; xhrafficheImagesel = getXhrRetourn(); xhrafficheImagesel.onreadystatechange = function(){ if(xhrafficheImagesel.readyState == 4 && xhrafficheImagesel.status == 200){ twAller(xhrafficheImagesel.responseText); } } xhrafficheImagesel.open("GET",urlgo,true); xhrafficheImagesel.send(null); } function invisible(){ var imgIdCur = 'mapImgSel' ; if(typeof arguments[0] != 'undefined' && arguments[0] != ''){ imgIdCur = arguments[0] ; } vitesseIE=5; vitesseFF=60; cur=document.getElementById(imgIdCur); if(!cur){ alert(imgIdCur) ; return ; } if(browser == "Internet Explorer"){ cur.filters.alpha.opacity--; if (cur.filters.alpha.opacity==0) return; else setTimeout("invisible()",vitesseIE); } else{ i=parseFloat(cur.style.MozOpacity); i-=parseFloat(0.1); cur.style.MozOpacity = i; if (i<=0) return; else setTimeout("invisible()",vitesseFF); } } function VerifyAnswer(e){ // Détéction des browsers var strUserAgent = navigator.userAgent.toLowerCase(); var isIE = strUserAgent.indexOf("msie") > -1; var isNS6 = strUserAgent.indexOf("netscape6") > -1; var isNS4 = !isIE && !isNS6 && parseFloat(navigator.appVersion) < 5; if (isIE) { iKeyCode = e.keyCode; } else { iKeyCode = e.which; } if (((iKeyCode >= 48) && (iKeyCode <=57))|| (iKeyCode == 44) || (iKeyCode == 46) || (iKeyCode == 40) || (iKeyCode == 41) || (iKeyCode == 43) || (iKeyCode == 32) || (iKeyCode == 45) || (iKeyCode == 8) || (iKeyCode == 0)){ if (isIE){ e.returnValue = true; } else{ return true; } } else{ if (isIE){ e.returnValue = false; } else{ return false; } } } function creatRefPoi(gidtext){ gidvalue = document.getElementById(gidtext).value; if(gidvalue != ""){ parurl = "drawMap.php?carte_drawPoi=drawPoi&gid="+gidvalue; }else { alert("Vous n'avez rien saisie, aucune image disponible"); return; } var top=(screen.height-500)/2; var left=(screen.width-500)/2; var w = window.open(parurl, "POI", "top="+top+",left="+left+",width=315,height=315,status=no,resizable=no,scrollbars=no,toolbar=no,location=no"); w.focus(); }