/**/ /* UTF8 encoding/decoding functions * Copyright (c) 2006 by Ali Farhadi. * released under the terms of the Gnu Public License. * see the GPL for details. * * Email: ali[at]farhadi[dot]ir * Website: http://farhadi.ir/ */ //an alias of String.fromCharCode function chr(code) { return String.fromCharCode(code); } //returns utf8 encoded charachter of a unicode value. //code must be a number indicating the Unicode value. //returned value is a string between 1 and 4 charachters. function code2utf(code) { if (code < 128) return chr(code); if (code < 2048) return chr(192+(code>>6)) + chr(128+(code&63)); if (code < 65536) return chr(224+(code>>12)) + chr(128+((code>>6)&63)) + chr(128+(code&63)); if (code < 2097152) return chr(240+(code>>18)) + chr(128+((code>>12)&63)) + chr(128+((code>>6)&63)) + chr(128+(code&63)); } //it is a private function for internal use in utf8Encode function function _utf8Encode(str) { var utf8str = new Array(); for (var i=0; i 127) code2 = utf8str.charCodeAt(i++); if (code > 223) code3 = utf8str.charCodeAt(i++); if (code > 239) code4 = utf8str.charCodeAt(i++); if (code < 128) str[j++]= chr(code); else if (code < 224) str[j++] = chr(((code-192)<<6) + (code2-128)); else if (code < 240) str[j++] = chr(((code-224)<<12) + ((code2-128)<<6) + (code3-128)); else str[j++] = chr(((code-240)<<18) + ((code2-128)<<12) + ((code3-128)<<6) + (code4-128)); } return str.join(''); } //Decodes a UTF8 formated string function utf8Decode(utf8str) { var str = new Array(); var pos = 0; var tmpStr = ''; var j=0; while ((pos = utf8str.search(/[^\x00-\x7F]/)) != -1) { tmpStr = utf8str.match(/([^\x00-\x7F]+[\x00-\x7F]{0,10})+/)[0]; str[j++]= utf8str.substr(0, pos) + _utf8Decode(tmpStr); utf8str = utf8str.substr(pos + tmpStr.length); } str[j++] = utf8str; return str.join(''); } /**/ var map = null; var listMarkers = Array(); var htmlMarkers = Array(); var timer = Array(); function maps_initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(46.75492, 1.71387), 6); map.addMapType(G_PHYSICAL_MAP); map.setMapType(G_PHYSICAL_MAP); } else { alert("Désolé, votre navigateur ne permet pas d'afficher la carte. Veuillez le mettre à jour."); } } function maps_perso_initialize(lat, lng, zoom) { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_perso")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(lat, lng), zoom); map.addMapType(G_PHYSICAL_MAP); map.setMapType(G_PHYSICAL_MAP); } else { alert("Désolé, votre navigateur ne permet pas d'afficher la carte. Veuillez le mettre à jour."); } } function saveMapPerso() { var center = map.getCenter(); //alert ("Latitude : " + + "\nLongitude : " + center.lng() + "\nZoom : " + map.getZoom()); // Création de l'objet XMLHttpRequest var xhr=null; if(window.XMLHttpRequest) // Firefox et autres xhr = new XMLHttpRequest(); else if(window.ActiveXObject){ // Internet Explorer try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e1) { xhr = null; } } } else { // XMLHttpRequest non supporté par le navigateur alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); } //on définit l'appel de la fonction au retour serveur xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { document.getElementById('message_map_ok').innerHTML = "Nouvelle position par défaut enregistrée"; document.getElementById('message_map_ok').style.display = "block"; } } // On appel le fichier xhr.open("GET",'map_ajax_save_perso.php?lat=' + center.lat() + '&lng=' + center.lng() + '&zoom=' + map.getZoom(), true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xhr.send(null); } function maps_resetMarkers() { map.clearOverlays(); } function maps_showPoints(idAct, dateDebut, dateFin, lblAct, isChecked) { maps_resetMarkers(); // Création de l'objet XMLHttpRequest var xhr=null; if(window.XMLHttpRequest) // Firefox et autres xhr = new XMLHttpRequest(); else if(window.ActiveXObject){ // Internet Explorer try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e1) { xhr = null; } } } else { // XMLHttpRequest non supporté par le navigateur alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); } //on définit l'appel de la fonction au retour serveur xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { var docXML = xhr.responseXML.documentElement; // On met en surbrillant le menu cliqué if (idAct != 0) { if (document.getElementById('menu_act_' + idAct).className == "menu " + lblAct + "_checked") document.getElementById('menu_act_' + idAct).className = "menu " + lblAct; else document.getElementById('menu_act_' + idAct).className = "menu " + lblAct + "_checked"; } // On traite le XML reçu var items = docXML.getElementsByTagName("rdv"); // On écrit le titre de la catégorie dans la colonne de droite //document.getElementById('activites_listeEntites_titre').innerHTML = docXML.getElementsByTagName("activiteNom")[0].firstChild.nodeValue; for (i=0; i' + titre + '' + '' + date + '
à ' + ville + ' (' + cp + ')
' + '
' + descrpicto + '
' + '' + ''; var icon_picto = new GIcon(); icon_picto.image = "art_categorie/" + picto; icon_picto.iconSize = new GSize(24, 24); icon_picto.iconAnchor = new GPoint(0, 5); icon_picto.infoWindowAnchor = new GPoint(5, 1); var marker = createMarker(id, point, htmlMarker, {icon: icon_picto, title: titre}); map.addOverlay(marker); } } } // On appel le fichier xhr.open("GET",'map_ajax_liste_rencontre.php?idact=' + idAct + '&date_debut=' + dateDebut + '&date_fin=' + dateFin, true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xhr.send(null); } function createMarker(idMarker, point, html, option) { var marker = new GMarker(point, option); GEvent.addListener(marker, "click", function() { //marker.setImage("images/rouge.png"); //show_detailsEntite(idMarker); marker.openInfoWindowHtml(html); });/* GEvent.addListener(marker, 'mouseover', function() { map.closeInfoWindow(); //marker.setImage("images/rouge.png"); marker.openInfoWindowHtml(html); //GLog.write("mouseOver"); }); GEvent.addListener(marker, 'mouseout', function() { //marker.setImage("images/vert.png"); timer[idMarker] = setTimeout(function() { marker.closeInfoWindow(); clearTimeout(timer[idMarker]); },200); //GLog.write("mouseOut"); }); */ return marker; } function MapInit(latitude, longitude) { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map_manif")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(latitude, longitude), 13); /* map.addMapType(G_PHYSICAL_MAP); map.setMapType(G_PHYSICAL_MAP); */ } else { alert("Désolé, votre navigateur ne permet pas d'afficher la carte. Veuillez le mettre à jour."); } } function MapAffichePoint (id, latitude, longitude, titre, texte) { if (map == null) MapInit(latitude, longitude); var point = new GLatLng(latitude, longitude); var htmlMarker = '
' + '
' + titre + '
' + '
' + texte + '
' + '
'; var marker = createMarker(id, point, htmlMarker, {title: titre}); map.addOverlay(marker); } function list_mouseOver(idPoint) { timer[idPoint] = setTimeout(function() { map.closeInfoWindow(); // listMarkers["entite_" + idPoint].setImage("images/rouge.png"); listMarkers["rdv_" + idPoint].openInfoWindowHtml(htmlMarkers["rdv_" + idPoint]); map.panTo(listMarkers["rdv_" + idPoint].getLatLng()); },500); } function list_mouseOut(idPoint) { clearTimeout(timer[idPoint]); listMarkers["rdv_" + idPoint].closeInfoWindow(); // listMarkers["rdv_" + idPoint].setImage("images/vert.png"); } function list_mouseClick(idPoint) { // listMarkers["entite_" + idPoint].setImage("images/rouge.png"); show_detailsRdv(idPoint); }