<xsl:template name="display-geo-map">
<xsl:variable name="scheme" select="substring-before($absolute-uri-prefix, '://')"/>
<script src="{$scheme}://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script src="{ametys:pluginResourceURL('web', 'js/jquery.gmap.js')}" type="text/javascript"></script>
<script src="{ametys:pluginResourceURL('web', 'js/GmapViewer.js')}" type="text/javascript"></script>
<script type="text/javascript">
<xsl:comment>
geocode_map_<xsl:value-of select="$uniqueId"/> = [];
coordinates_<xsl:value-of select="$uniqueId"/> = {};
geocode_sorted_latlng_<xsl:value-of select="$uniqueId"/> = [];
var pinIdx = 0, lat, lng, geocode_entry, coord_entry;
<xsl:variable name="cl" select="count($colors/color)"/>;
<xsl:for-each select="/search/hits/hit[latitude != '' and longitude != '']">
lat = String(<xsl:value-of select="latitude" />);
lng = String(<xsl:value-of select="longitude" />);
<xsl:variable name="tooltip-title"><xsl:call-template name="get-tooltip-title" /></xsl:variable>
coord_entry = coordinates_<xsl:value-of select="$uniqueId"/>[lat] || {};
coord_entry = coord_entry[lng];
if (!coord_entry) // no entry at the coordinates
{
<xsl:variable name="pos" select="position()"/>
pinIdx++;
if (!coordinates_<xsl:value-of select="$uniqueId"/>[lat])
{
coordinates_<xsl:value-of select="$uniqueId"/>[lat] = {};
}
coord_entry = coordinates_<xsl:value-of select="$uniqueId"/>[lat];
coord_entry[lng] = {
number: String(pinIdx),
color: '<xsl:value-of select="$colors/color[(($pos - 1) mod $cl)+1]"/>',
titles: ['<xsl:value-of select="ametys:escapeJS($tooltip-title)"/>']
};
}
else
{
coord_entry.titles.push('<xsl:value-of select="ametys:escapeJS($tooltip-title)"/>');
}
// Keep reference to coordinates in the same order
geocode_sorted_latlng_<xsl:value-of select="$uniqueId"/>.push([lat, lng]);
</xsl:for-each>
<xsl:for-each select="/search/hits/hit[latitude != '' and longitude != '']">
coord_entry = coordinates_<xsl:value-of select="$uniqueId"/>[String(<xsl:value-of select="latitude" />)][String(<xsl:value-of select="longitude" />)];
geocode_entry = {
lat: <xsl:value-of select="latitude" />,
lng: <xsl:value-of select="longitude" />,
number: coord_entry.number,
title: coord_entry.titles.join('<br/>')
};
geocode_map_<xsl:value-of select="$uniqueId"/>.push(geocode_entry);
</xsl:for-each>
</xsl:comment>
</script>
<xsl:call-template name="display-geo-map-js-listener" />
<script type="text/javascript">
$j(document).ready(function ()
{
$j('#<xsl:value-of select="$uniqueId"/>-map').show();
var data = {
iconBase: '<xsl:value-of select="ametys:absoluteUriPrefix()"/>/plugins/web/icons/map/<xsl:value-of select="$skin"/>/',
zoomLevel: geocode_map_<xsl:value-of select="$uniqueId"/>.length > 0 ? 15 : <xsl:value-of select="$default-zoom"/>,
lat: (geocode_map_<xsl:value-of select="$uniqueId"/>[0] || {}).lat || <xsl:value-of select="$default-coord-lat"/>,
lng: (geocode_map_<xsl:value-of select="$uniqueId"/>[0] || {}).lng || <xsl:value-of select="$default-coord-lng"/>,
mapTypeId: google.maps.MapTypeId.ROADMAP,
markers: geocode_map_<xsl:value-of select="$uniqueId"/>,
polygons: []
};
var gmapViewer = new GmapViewer();
gmapViewer.setUp('#<xsl:value-of select="$uniqueId"/>-map', data, true);
// onAfterGmapViewerSetup hook.
if ($j.isFunction(window.onAfterGmapViewerSetup))
{
window.onAfterGmapViewerSetup(gmapViewer, geocode_sorted_latlng_<xsl:value-of select="$uniqueId"/>, coordinates_<xsl:value-of select="$uniqueId"/>);
}
});
</script>
<div id="{$uniqueId}-map" class="map" style="height: {$map-height}px; display: none;">
</div>
</xsl:template>
Waiting for a release version with the fix you need to override the template "display-geo-map" in your skin with following: