// Set the language to use
OpenLayers.Lang.setCode(HordeMap.conf.language);
- this.map = new OpenLayers.Map(this.opts.elt, options);
+ this.map = new OpenLayers.Map((this.opts.delayed ? null : this.opts.elt), options);
// Create the vector layer for markers if requested.
if (HordeMap.conf.useMarkerLayer) {
switch (trigger.id) {
case 'kronolithEventLocation':
- if (kc == Event.KEY_RETURN) {
- this.ensureMap(true);
+ if (kc == Event.KEY_RETURN && $F('kronolithEventLocation')) {
+ this.initializeMap(true);
this.geocode($F('kronolithEventLocation'));
e.stop();
return;
break;
case 'kronolithEventGeo':
- this.ensureMap(true);
+ this.initializeMap(true);
this.geocode($F('kronolithEventLocation'));
e.stop();
break;
// Map
initializeMap: function(ignoreLL)
{
+ if (this.mapInitialized) {
+ return;
+ }
var layers = [];
if (Kronolith.conf.maps.providers) {
Kronolith.conf.maps.providers.each(function(l)
{
var p = new HordeMap[l]();
- $H(p.getLayers()).values().each(function(e) { layers.push(e); });
+ $H(p.getLayers()).values().each(function(e) {layers.push(e);});
});
}
onGeocodeError: function(r)
{
+ $('kronolithEventGeo_loading_img').toggle();
KronolithCore.showNotifications([ { type: 'horde.error', message: Kronolith.text.geocode_error + ' ' + r} ]);
},
*/
onGeocode: function(r)
{
+ $('kronolithEventGeo_loading_img').toggle();
r = r.shift();
if (r.precision) {
zoom = r.precision * 2;
} else {
zoom = null;
}
+ this.ensureMap(true);
this.placeMapMarker({ lat: r.lat, lon: r.lon }, true, zoom);
},
if (!a) {
return;
}
+ $('kronolithEventGeo_loading_img').toggle();
var gc = new HordeMap.Geocoder[Kronolith.conf.maps.geocoder](this.map.map, 'kronolithEventMap');
gc.geocode(a, this.onGeocode.bind(this), this.onGeocodeError);
},
<input type="text" name="location" id="kronolithEventLocation" size="25" />
<?php if ($GLOBALS['conf']['maps']['driver']): ?>
<span id="kronolithEventMapLink" style="display:none">
- <span class="kronolithSeparator">|</span> <span><a href="#" class="kronolithEventGeo"><?php echo _("Find in Maps") ?></a></span>
+ <span class="kronolithSeparator">|</span> <span><a href="#" class="kronolithEventGeo"><?php echo _("Find in Maps") ?></a></span> <span id="kronolithEventGeo_loading_img" style="display:none;"><?php echo Horde::img('loading.gif', _("Loading...")) ?></span>
</span>
<?php endif; ?>
</div>