Google Map

Author Message

Franck Fortineau

Tuesday 20 April 2010 2:46:21 am

Good morning,

I would like to embed a google map on my ez-publish website but first, I'd like to ask you a few questions :

¤ After having embedded my google map, can users add a new point with its icon or can they add a new direction/itinerary in the back office ?

¤ Is it possible, in the front office of the website, to propose a form to users thanks to which they could propose photographs or commentaries linked with a point ?

Thank you,

Frink

Abdelkader RHOUATI

Thursday 22 April 2010 3:36:35 am

hi,

there is an extension that integrates GoogleMap in a site ezpublish (GIS). but you can only put the flag according to altitude and longitude.

You must make your own extension module and to add these features, I think it will not be easy :)

Tks

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

Abdelkader RHOUATI

Friday 23 April 2010 1:53:20 am

hello,

another extension that uses version 3 of the api googlemap: http://ez.no/developer/contribs/datatypes/google_maps_version_3

tks

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

Doug Brethower

Friday 23 April 2010 7:27:54 am

Another google maps contribution that may be of benefit.

http://ez.no/developer/contribs/datatypes/include_google_maps_online_editor

An example output from the above..

http://webportalmaster.com/index.php/eng/Contact/Preston-MO

An article RE google maps that includes install details for the above contribution.

http://webportalmaster.com/index.php/eng/eZ/HowTo/eZ-Publish-4.2-How-I-use-Google-Maps

Cheers!

Doug Brethower
Apple Certified Technical Consultant, Southwest, MO USA
http://share.ez.no/directory/companies/lakedata.net

Paul Leclercq

Wednesday 05 May 2010 8:52:08 am

There actually already is an extension for this included in the latest ezpublish install, if you select the ezflow installation.

The official extension is this one:
http://projects.ez.no/ezgmaplocation

The only problem is made for v2, in the backoffice which means you need a key to see the map, but you can easily resolve this by replacing the code to display the map which is in these 2 files:

ezgmaplocation/design/standard/templates/content/datatype/edit/ezgmaplocation.tpl
ezgmaplocation/design/standard/templates/content/datatype/view/ezgmaplocation.tpl

with this code:
--------------------------------

{if is_set( $attribute_base )|not}
{def $attribute_base = 'ContentObjectAttribute'}
{/if}
<div class="block">
{def $gmaplocal = ezini('RegionalSettings', 'ContentObjectLocale', 'site.ini')}
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&region={$gmaplocal|extract_left(2)}&language={$gmaplocal|extract_left(2)}"></script>
{undef $gmaplocal}
<div class="element">
<div class="block">
<label>{'Latitude'|i18n('extension/ezgmaplocation/datatype')}:</label>
<input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_latitude" class="ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier} ezcc-{$attribute.object.content_class.identifier} box" type="text" name="{$attribute_base}_data_gmaplocation_latitude_{$attribute.id}" value="{$attribute.content.latitude}" />
</div>

<div class="block">
<label>{'Longitude'|i18n('extension/ezgmaplocation/datatype')}:</label>
<input id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_longitude" class="ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier} ezcc-{$attribute.object.content_class.identifier} box" type="text" name="{$attribute_base}_data_gmaplocation_longitude_{$attribute.id}" value="{$attribute.content.longitude}" />
</div>
<div class="block">
<label>{'Update Location'|i18n('extension/ezgmaplocation/datatype')}:</label>
<input class="defaultbutton" type="button" id="ezgml-update-button-{$attribute.id}" value="{'Update values'|i18n('extension/ezgmaplocation/datatype')}" onclick="javascript:void( null ); return false" />
</div>
</div>
<div class="element">
{run-once}
{*<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={ezini('SiteSettings','GMapsKey')}" type="text/javascript"></script>*}
<script type="text/javascript">
{literal}
/*
Rewriten by Paul Leclercq for google API V3
Attention cette version necessite jquery
*/

var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();
var marker;
function glocate_initialize_{/literal}{$attribute.id}{literal}() {
geocoder = new google.maps.Geocoder();
{/literal}
{if and(is_set($attribute.content.latitude), $attribute.content.latitude|ne("") )}
var latlng = new google.maps.LatLng({$attribute.content.latitude}, {$attribute.content.longitude}); /* Zoom on Paris by default */
{else}
var latlng = new google.maps.LatLng(46.2276, 2.2137); /* Zoom on Paris by default */
{/if}
{literal}
var myOptions = {
zoom: 5,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas-{/literal}{$attribute.id}{literal}"), myOptions);

{/literal}
{if and(is_set($attribute.content.latitude), $attribute.content.latitude|ne(""))}
marker = new google.maps.Marker({ldelim}
map: map,
position: latlng
{rdelim});
{/if}
{literal}
}

function codeAddress_{/literal}{$attribute.id}{literal}() {
var address = $("#ezgml-address-{/literal}{$attribute.id}{literal}").val();
if (geocoder) {
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
updateLatLngFields( results[0].geometry.location );
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}

function updateLatLngFields( point )
{
{/literal}
$("#ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_latitude").val( point.lat() );
$("#ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}_longitude").val( point.lng() );
{literal}
};
{/literal}
</script>
{/run-once}
<script type="text/javascript">
$().ready(function() {ldelim}
glocate_initialize_{$attribute.id}();
{rdelim});

</script>
<div id="map_canvas-{$attribute.id}" style="width: 700px; height: 280px;"></div>
<input type="text" id="ezgml-address-{$attribute.id}" size="54" name="{$attribute_base}_data_gmaplocation_address_{$attribute.id}" value="{$attribute.content.address}"/>
<input class="defaultbutton" type="button" id="ezgml-address-button-{$attribute.id}" value="{'Find address'|i18n('extension/ezgmaplocation/datatype')}" onclick="codeAddress_{$attribute.id}(); return false;"/>
</div>
<div class="break"></div>
</div>

------------------------------------

 

or else create overrides for your backoffice siteaccess design by creating on override of these files in these folders:

ezgmaplocation/design/admin/templates/content/datatype/edit/ezgmaplocation.tpl
ezgmaplocation/design/admin/templates/content/datatype/view/ezgmaplocation.tpl

This should normaly work. But feedback would be welcome.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 00:46:33
Script start
Timing: Jan 30 2025 00:46:33
Module start 'layout'
Timing: Jan 30 2025 00:46:33
Module start 'content'
Timing: Jan 30 2025 00:46:33
Module end 'content'
Timing: Jan 30 2025 00:46:33
Script end

Main resources:

Total runtime0.0136 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 588.0000151.1953
Module start 'layout' 0.00420.0026 739.195336.5938
Module start 'content' 0.00680.0049 775.7891102.1719
Module end 'content' 0.01170.0018 877.960941.9922
Script end 0.0135  919.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002316.7807140.0002
Check MTime0.00117.7912140.0001
Mysql Total
Database connection0.00054.017510.0005
Mysqli_queries0.002014.686030.0007
Looping result0.00000.221110.0000
Template Total0.00128.710.0012
Template load0.00096.768410.0009
Template processing0.00031.845610.0003
Override
Cache load0.00064.319310.0006
General
dbfile0.00032.461480.0000
String conversion0.00000.064940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs