Skip to content

Commit

Permalink
TagsMap fix for Firefox.
Browse files Browse the repository at this point in the history
Signed-off-by: Bharat Mediratta <bharat@menalto.com>
  • Loading branch information
rWatcher authored and bharat committed Aug 14, 2009
1 parent 5974476 commit c5071ef
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions modules/tagsmap/views/tagsmap_googlemap.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,45 @@
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(<?=$google_map_latitude ?>,
<?=$google_map_longitude ?>));
map.setZoom(<?=$google_map_zoom ?>);
map.setUIToDefault();

// Make Google Earth an Option.
map.addMapType(G_SATELLITE_3D_MAP);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);


// Set map defaults.
map.setCenter(new GLatLng(<?=$google_map_latitude ?>,
<?=$google_map_longitude ?>));
map.setZoom(<?=$google_map_zoom ?>);
map.setUIToDefault();
map.setMapType(<?=$google_map_type ?>);

<? foreach ($tags_gps as $oneGPS): ?>
{

var myGeographicCoordinates = new GLatLng(<?= $oneGPS->latitude ?>,
<?= $oneGPS->longitude ?>);
map.addOverlay(createMarker(myGeographicCoordinates,
"<?= $oneGPS->description ?>",
"<?= url::site("tags/$oneGPS->tag_id")?>",
"<?= ORM::factory("tag", $oneGPS->tag_id)->name ?>"
));
}
<? endforeach ?>


// Function for making the clickable markers.
function createMarker(point, description, tagURL, tagName) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
var myHtml = description + "<br/><br/>" +
"Tag: <a href=\"" + tagURL + "\">" + tagName + "</a>";
map.openInfoWindowHtml(point, myHtml);
});

return marker;
}

// Create markers for each tag with GPS coordinates.
<? $counter = 0; ?>
<? foreach ($tags_gps as $oneGPS): ?>
var myGeographicCoordinates<?=$counter; ?> = new GLatLng(<?= $oneGPS->latitude ?>,
<?= $oneGPS->longitude ?>);
map.addOverlay(createMarker(myGeographicCoordinates<?=$counter; ?>,
"<?= $oneGPS->description ?>",
"<?= url::site("tags/$oneGPS->tag_id")?>",
"<?= ORM::factory("tag", $oneGPS->tag_id)->name ?>"
));
<? $counter++; ?>
<? endforeach ?>
}
}

google.setOnLoadCallback(initialize);
</script>

Expand Down

0 comments on commit c5071ef

Please sign in to comment.