Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,38 @@
'sort_by', array( 'published', false() ),
'limit', $limit ) )
$attribute = $block.custom_attributes.attribute}

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={ezini('SiteSettings','GMapsKey')}" type="text/javascript"></script>
{ezscript_require( 'ezflgmapview.js' )}

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
<!--
var data{$block.id} = [];

{foreach $locations as $location}
data{$block.id}.push( {ldelim}
point: new GLatLng( {$location.data_map[$attribute].content.latitude}, {$location.data_map[$attribute].content.longitude} ),
address: '{$location.data_map[$attribute].content.address}'
function initialize{$block.id}() {ldelim}
var bounds = new google.maps.LatLngBounds();
var myLatlng = new google.maps.LatLng(0,0);
var myOption = {ldelim}
mapTypeId: google.maps.MapTypeId.ROADMAP
{rdelim};
var map = new google.maps.Map(document.getElementById("ezflb-map-{$block.id}"), myOption);
{foreach $locations as $index=>$location}
{if $location.data_map[$attribute].content.latitude|ne("")}
var marker{$index} = new google.maps.Marker({ldelim}
position: new google.maps.LatLng({$location.data_map[$attribute].content.latitude}, {$location.data_map[$attribute].content.longitude}),
map: map,
title:""
{rdelim});
google.maps.event.addListener(marker{$index}, 'click', function() {ldelim}
window.location.href={$location.url_alias|ezurl()};
{rdelim} );
{/if}
bounds.extend(new google.maps.LatLng({$location.data_map[$attribute].content.latitude}, {$location.data_map[$attribute].content.longitude}));
{/foreach}

eZFLGMapAddListener( window, 'load', function(){ldelim} eZFLGMapView( '{$block.id}', data{$block.id} ) {rdelim}, false );
map.fitBounds(bounds);
alert(map.getZoom());
{rdelim}
</script>
<script type="text/javascript">
<!--
if ( window.addEventListener )
window.addEventListener('load', function(){ldelim} initialize{$block.id}() {rdelim}, false);
else if ( window.attachEvent )
window.attachEvent('onload', function(){ldelim} initialize{$block.id}() {rdelim} );
-->
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
{def $key = $block.custom_attributes.key
$location = $block.custom_attributes.location}

{ezscript_require( 'ezjsc::yui3' )}

<h1>{$block.name|wash()}</h1>

<div id="map-container-{$block.id}" class="map-container"></div>

{*
Do not load GMap API if key is empty.
Option to skip loading GMap API in case when it was loaded globally e.g in <head> section
*}
{if ne( $key, '' )}
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key={$key}" type="text/javascript"></script>
{/if}

{run-once}
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
{/run-once}
{run-once}
<script type="text/javascript">
YUI(YUI3_config).use('event', function(Y) {ldelim}
Y.on('domready', function() {ldelim}
if (GBrowserIsCompatible()) {ldelim}
var mapContainer = document.getElementById("map-container-{$block.id}");
var map = new GMap2(mapContainer);
var geocoder = new GClientGeocoder();
geocoder.getLatLng("{$location}", function(point) {ldelim}
if (point) {ldelim}
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml("{$location}");
{rdelim}
{rdelim});
{rdelim}
function eZGmapLocation_MapView( attributeId, location ){ldelim}
var myLatlng = new google.maps.LatLng(0,0);
var myOptions = {ldelim}
zoom: 0,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
{rdelim}
var mapgmap = new google.maps.Map(document.getElementById( attributeId ), myOptions);
geocoder = new google.maps.Geocoder();
geocoder.geocode({ldelim} 'address': location{rdelim}, function(results, status) {ldelim}
if (status == google.maps.GeocoderStatus.OK) {ldelim}
mapgmap.setCenter(results[0].geometry.location);
mapgmap.setZoom(13);
var marker = new google.maps.Marker({ldelim}
map: mapgmap,
position: results[0].geometry.location
{rdelim});
{rdelim}
{rdelim});
{rdelim});
google.maps.event.addListener(marker, 'click', function() {ldelim}
window.location.href={$location.url_alias|ezurl()};
{rdelim});
{rdelim}
</script>
{/run-once}
<script type="text/javascript">
<!--
if ( window.addEventListener )
window.addEventListener('load', function(){ldelim} eZGmapLocation_MapView( "map-container-{$block.id}","{$location}" ) {rdelim}, false);
else if ( window.attachEvent )
window.attachEvent('onload', function(){ldelim} eZGmapLocation_MapView( "map-container-{$block.id}", "{$location}" ) {rdelim} );
-->
</script>

{undef $key $location}
<div id="map-container-{$block.id}" class="map-container"></div>