2010-03-11 01:39:22 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
2012-06-19 00:00:07 +00:00
|
|
|
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
|
2010-03-11 01:39:22 +00:00
|
|
|
<script type="text/javascript">
|
2012-06-19 00:00:07 +00:00
|
|
|
<?
|
|
|
|
if (module::get_var("exif_gps", "googlemap_api_key", "") != "") {
|
|
|
|
print "google.load(\"maps\", \"3\", {other_params:\"key=" . module::get_var("exif_gps", "googlemap_api_key") . "&sensor=false\"});";
|
|
|
|
} else {
|
|
|
|
print "google.load(\"maps\", \"3\", {other_params:\"sensor=false\"});";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
2010-03-26 00:48:40 +00:00
|
|
|
var google_zoom_hack = false;
|
2012-06-19 00:00:07 +00:00
|
|
|
var map = null;
|
|
|
|
var infoWindow = null;
|
|
|
|
|
|
|
|
$.ajaxSetup({
|
|
|
|
error: function(xhr, status, error) {
|
|
|
|
var status_text = document.getElementById('exif-gps-status');
|
|
|
|
status_text.innerHTML = "<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-03-11 01:39:22 +00:00
|
|
|
function initialize() {
|
2012-06-19 00:00:07 +00:00
|
|
|
var myLatlng = new google.maps.LatLng(0, 0);
|
2010-03-11 01:39:22 +00:00
|
|
|
var myOptions = {
|
|
|
|
zoom: 1,
|
2012-06-19 00:00:07 +00:00
|
|
|
center: myLatlng,
|
2010-03-18 00:05:30 +00:00
|
|
|
mapTypeId: google.maps.MapTypeId.<?=$map_type; ?>
|
2012-06-19 00:00:07 +00:00
|
|
|
}
|
|
|
|
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
|
|
|
|
2010-03-11 04:02:19 +00:00
|
|
|
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
|
2012-06-19 00:00:07 +00:00
|
|
|
infoWindow = new google.maps.InfoWindow();
|
|
|
|
|
|
|
|
var map_markers = [];
|
|
|
|
var str_marker_html = "";
|
|
|
|
var current_latlng = null;
|
|
|
|
|
|
|
|
jQuery.get("<?=url::abs_site("exif_gps/xml/{$query_type}/{$query_id}"); ?>", {}, function(data) {
|
|
|
|
jQuery(data).find("marker").each(function() {
|
|
|
|
var xmlmarker = jQuery(this);
|
|
|
|
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
|
|
|
parseFloat(xmlmarker.attr("lng")));
|
|
|
|
|
|
|
|
if (!latlng.equals(current_latlng)) {
|
|
|
|
if (current_latlng != null) {
|
|
|
|
var fn = markerClickFunction(str_marker_html, current_latlng);
|
|
|
|
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
|
|
|
}
|
|
|
|
|
|
|
|
current_latlng = latlng;
|
|
|
|
str_marker_html = "";
|
|
|
|
glatlngbounds.extend(latlng);
|
|
|
|
var marker = new google.maps.Marker({position: latlng});
|
|
|
|
map_markers.push(marker);
|
|
|
|
}
|
|
|
|
|
|
|
|
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
|
|
|
str_thumb_html = str_thumb_html.replace("<", "<");
|
|
|
|
str_thumb_html = str_thumb_html.replace(">", ">");
|
|
|
|
str_thumb_html = str_thumb_html.replace("'", "\'");
|
|
|
|
str_thumb_html = str_thumb_html.replace(""", "\"");
|
|
|
|
str_thumb_html = str_thumb_html.replace("&", "&");
|
|
|
|
|
|
|
|
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
|
|
|
|
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
|
|
|
|
str_marker_html += str_thumb_html;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var fn = markerClickFunction(str_marker_html, current_latlng);
|
|
|
|
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
|
|
|
|
|
|
|
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
|
|
|
|
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
|
|
|
|
google_zoom_hack = true;
|
|
|
|
map.fitBounds(glatlngbounds);
|
|
|
|
document.getElementById('over_map').style.display = 'none';
|
2010-03-11 01:39:22 +00:00
|
|
|
});
|
2010-03-26 00:48:40 +00:00
|
|
|
|
2011-04-25 19:05:54 +00:00
|
|
|
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
|
2010-04-02 00:59:36 +00:00
|
|
|
// If there is a maximum auto-zoom value, then set up an event to check the zoom
|
|
|
|
// level the first time it is changed, and adjust it if necessary.
|
|
|
|
// (if we call map.getZoom right after .fitBounds, getZoom will return the initial
|
|
|
|
// zoom level, not the auto zoom level, this way we get the auto zoomed value).
|
2010-03-26 00:48:40 +00:00
|
|
|
google.maps.event.addListener(map, 'zoom_changed', function() {
|
|
|
|
if (google_zoom_hack) {
|
2011-04-25 19:05:54 +00:00
|
|
|
if (map.getZoom() > <?= $max_autozoom ?>) map.setZoom(<?= $max_autozoom ?>);
|
2010-03-26 00:48:40 +00:00
|
|
|
google_zoom_hack = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
<? endif ?>
|
2010-03-11 01:39:22 +00:00
|
|
|
}
|
|
|
|
|
2012-06-19 00:00:07 +00:00
|
|
|
markerClickFunction = function(str_thumb_html, latlng) {
|
|
|
|
return function(e) {
|
|
|
|
e.cancelBubble = true;
|
|
|
|
e.returnValue = false;
|
|
|
|
if (e.stopPropagation) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
|
|
|
}
|
|
|
|
|
|
|
|
infoWindow.setContent(str_thumb_html);
|
|
|
|
infoWindow.setPosition(latlng);
|
|
|
|
infoWindow.open(map);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2010-03-11 01:39:22 +00:00
|
|
|
google.setOnLoadCallback(initialize);
|
|
|
|
</script>
|
2010-03-16 20:27:24 +00:00
|
|
|
|
2012-06-19 00:00:07 +00:00
|
|
|
<style>
|
|
|
|
#wrapper { position: relative; }
|
|
|
|
#over_map { position: absolute; top: 0px; left: 0px; z-index: 99; }
|
|
|
|
</style>
|
|
|
|
|
2010-03-16 20:27:24 +00:00
|
|
|
<div id="g-exif-map-header">
|
|
|
|
<div id="g-exif-map-header-buttons">
|
|
|
|
<?= $theme->dynamic_top() ?>
|
|
|
|
</div>
|
|
|
|
<h1><?= html::clean($title) ?></h1>
|
|
|
|
</div>
|
|
|
|
<br />
|
2012-06-19 00:00:07 +00:00
|
|
|
<div id="wrapper">
|
|
|
|
<div id="map_canvas" style="width:690px; height:480px;"></div>
|
|
|
|
<div id="over_map" style="width:690px; height:480px;">
|
|
|
|
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
|
|
|
|
<font size="6" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
|
|
|
|
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2010-03-18 00:24:28 +00:00
|
|
|
<?= $theme->dynamic_bottom() ?>
|