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/javascript.php

    r2084 r2158  
    1 <script type="text/javascript"> 
     1if (GBrowserIsCompatible()) 
     2{ 
     3        // Initialize the GMap 
     4        <?php echo $map."\n" ?> 
     5        <?php echo $controls."\n" ?> 
     6        <?php echo $center."\n" ?> 
     7        <?php echo $zoom."\n" ?> 
     8        <?php echo $options->render(1)."\n" ?> 
    29 
    3 function showmap(){ 
    4         //<![CDATA[ 
    5  
    6         if (GBrowserIsCompatible()) { 
    7  
    8                 var map = new GMap(document.getElementById("map")); 
    9                 map.centerAndZoom(new GPoint(-77.035971,38.898590), 4); 
    10         } 
    11  
    12                 var icon = new GIcon(); 
    13                 icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; 
    14                 icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; 
    15                 icon.iconSize = new GSize(12, 20); 
    16                 icon.shadowSize = new GSize(22, 20); 
    17                 icon.iconAnchor = new GPoint(6, 20); 
    18                 icon.infoWindowAnchor = new GPoint(5, 1); 
    19  
    20                 map.addControl(new GSmallMapControl()); 
    21                 map.addControl(new GMapTypeControl()); 
    22                 var point0 = new GPoint(-77.035971,38.898590); 
    23                 var marker0 = new GMarker(point0); 
    24  
    25                 map.addOverlay(marker0) 
    26  
    27                 GEvent.addListener(marker0, "click", function() { 
    28                         marker0.openInfoWindowHtml("The White House"); 
    29                 }); 
    30         //]]> 
    31  
     10        // Show map points 
     11<?php foreach ($markers as $marker): ?> 
     12        <?php echo $marker->render(1)."\n" ?> 
     13<?php endforeach ?> 
    3214} 
    33 window.onload = showmap; 
    34 </script>