2 * Affiche les données de l'appart soit en mode éditable soit en mode de consultation.
4 function rafraichirFormulaire()
6 var mode
= document
.getElementById("modeFormulaire")
8 var edition
= mode
.value
== "enEdition"
10 document
.getElementById("urlConsultation").style
.display
= edition
? "none" : "inline";
11 document
.getElementById("urlEdition").style
.display
= edition
? "inline" : "none";
13 //document.getElementById("urlmapConsultation").style.display = edition ? "none" : "inline";
14 //document.getElementById("urlmapEdition").style.display = edition ? "inline" : "none";
16 document
.getElementById("boutonsEdition").style
.display
= edition
? "block" : "none";
18 var tab
= document
.getElementById("tableauFormulaire")
19 var inputs
= tab
.getElementsByTagName("input");
20 var areas
= tab
.getElementsByTagName("textarea");
22 for (var i
= 0; i
< inputs
.length
; i
++)
23 if (edition
) inputs
[i
].removeAttribute("readonly");
24 else inputs
[i
].setAttribute("readonly","readonly");
26 for (var i
= 0; i
< areas
.length
; i
++)
27 if (edition
) areas
[i
].removeAttribute("readonly");
28 else areas
[i
].setAttribute("readonly","readonly");
30 document
.getElementById("boutonEditer").style
.display
= edition
? "none" : "inline";
32 document
.getElementById("editionStatut").style
.display
= edition
? "inline" : "none";
33 document
.getElementById("consultationStatut").style
.display
= edition
? "none" : "inline";
37 * passe les données sous la forme éditable.
41 var mode
= document
.getElementById("modeFormulaire").value
= "enEdition"
42 rafraichirFormulaire()
45 function supprimer(id
, rue
)
47 return confirm("Voulez vous vraiment supprimer l'appartement n°" + id
+ " : " + rue
);
50 function endroitTrouve(position
)
52 var marker
= new GMarker(position
);
54 var map
= new GMap2(document
.getElementById("map"));
55 map
.addControl(new GSmallMapControl());
56 map
.addControl(new GMapTypeControl());
57 map
.setCenter(position
, 14);
58 map
.addOverlay(marker
)
60 var map2
= new GMap2(document
.getElementById("map2"));
61 map2
.addControl(new GSmallMapControl());
62 map2
.addControl(new GMapTypeControl());
63 map2
.setCenter(position
, 16);
64 map2
.addOverlay(marker
)
67 // voir : http://www.google.com/apis/maps/documentation/reference.html
70 if (GBrowserIsCompatible())
72 var geocoder
= new GClientGeocoder();
74 geocoder
.setViewport(new GLatLngBounds(new GLatLng(46.8333, 7.1166), new GLatLng(46.7333, 7.2166)));
75 geocoder
.getLatLng(document
.getElementById("inputRue").value
+ " " + document
.getElementById("inputLocalite").value
, endroitTrouve
);