Show
Ignore:
Timestamp:
02/23/2008 01:41:41 PM (9 months ago)
Author:
Shadowhand
Message:

Hooray! Gmaps module in a working (but early) form!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/gmaps/views/gmaps/api_demo.php

    r2084 r2158  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    32<html xmlns="http://www.w3.org/1999/xhtml"> 
    43<head> 
    54<meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
    65<title>Google Maps JavaScript API Example</title> 
    7 <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo Config::item('gmaps.api_key') ?>"type="text/javascript"></script> 
    8 <script type="text/javascript"> 
    9 function showmap(){ 
    10 //<![CDATA[ 
    11  
    12         if (GBrowserIsCompatible()) { 
    13                 var map = new GMap(document.getElementById("map")); 
    14                 map.centerAndZoom(new GPoint(0,35), 16); 
    15                 map.enableScrollWheelZoom(); 
    16  
    17                 // Prevents the page from scrolling 
    18                 GEvent.addDomListener(map.getContainer(), "DOMMouseScroll", wheelevent); 
    19                 // map.getContainer().onmousewheel = wheelevent; 
    20         } 
    21  
    22         var icon = new GIcon(); 
    23         icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; 
    24         icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; 
    25         icon.iconSize = new GSize(12, 20); 
    26         icon.shadowSize = new GSize(22, 20); 
    27         icon.iconAnchor = new GPoint(6, 20); 
    28         icon.infoWindowAnchor = new GPoint(5, 1); 
    29  
    30         map.addControl(new GSmallMapControl()); 
    31         map.addControl(new GMapTypeControl()); 
    32  
    33         var marker0 = new GMarker(new GPoint(-93.328379, 45.109871)); 
    34         map.addOverlay(marker0); 
    35         GEvent.addListener(marker0, "click", function() { 
    36                 marker0.openInfoWindowHtml("Minneapolis, Minnesota"); 
    37         }); 
    38  
    39         var marker1 = new GMarker(new GPoint(139.682282, 35.678451)); 
    40         map.addOverlay(marker1); 
    41         GEvent.addListener(marker1, "click", function() { 
    42                 marker1.openInfoWindowHtml("Tokyo, Japan"); 
    43         }); 
    44  
    45 //]]> 
    46 } 
    47 function wheelevent(e) { 
    48         e.preventDefault(); 
    49         e.returnValue = false; 
    50 } 
    51 window.onload = showmap; 
    52 </script> 
     6<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php echo Config::item('gmaps.api_key') ?>" type="text/javascript"></script> 
    537</head> 
    548<body> 
    559<p>You can use your scroll wheel to zoom in and out of the map.</p> 
    5610<div id="map" style="width: 600px; height: 400px"></div> 
     11<script type="text/javascript"> 
     12<?php echo $map ?> 
     13</script> 
    5714</body> 
    5815</html>