CRM 2011 - FORMA GOOGLE MAPS EKLEME (Display Google Maps in CRM 2011)


Bu yazımda ,Html webresource kullanarak crm 2011 de google maps gösterecegiz.

Client

<html>
<head>
    <title>Map</title>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"> </script>
    <script type="text/javascript" src="../WebResources/crm_googleMap.js"></script>
</head>
<body onload="InitializeMap()">
    <div id="map_canvas" style="width: 100%; height: 380px;">
    </div>
</body>
</html>

Javascript metotları

var geocoder = null;
var map = null;
function InitializeMap() {
    if (typeof google !== "undefined") {
        geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(17.384509, 78.486156);
        var myOptions = {
            zoom: 15,
            center: latlng,
            scaleControl: true,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        codeLatLng(latlng);
    }
}

function codeLatLng(latlng) {
    geocoder.geocode({ 'latLng': latlng }, function (results, status) {
        if (results != null && status != null) {
            if (status == google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                });
            }
            map.setZoom(10);
        }
    });
}

Hiç yorum yok:

Yorum Gönder