Jump to:
| Project: | GMap Module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | bdragon |
| Status: | closed (fixed) |
Issue Summary
Even with Unique IDs multiple maps fail to appear on the same node.
It looks like the ID is not being passed properly somewhere. See source below where "id": "Frontera" but "map": is empty.
jQuery.extend(Drupal, { settings: { "gmap": { "map": { "width": "520px", "height": "350px", "zoom": 13, "maxzoom": "14", "controltype": "Small", "align": "None", "maptype": "Satellite", "mtc": "standard", "baselayers": { "Satellite": 1 }, "styles": { "line_default": [ "0000ff", "5", "45", null, null ], "poly_default": [ "000000", "3", "25", "ff0000", "45" ] }, "line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior": { "locpick": false, "nodrag": 0, "nokeyboard": 1, "nomousezoom": 0, "autozoom": 0, "dynmarkers": 0, "overview": 0, "collapsehack": 0, "scale": 0 }, "markermode": "1", "id": "Frontera", "longitude": "-109.008024", "latitude": "27.163412", "markers": [ { "options": [ ], "longitude": "-109.00857925415039", "latitude": "27.164098883655043", "markername": "small blue", "offset": 0 } ] } } } });
Comments
#1
Anybody have a fix for this yet?
#2
I have two maps in a single node (inserted using macro) and as soon as I paste the second, the first map shows up empty (only Google logo but no map). I set id for both maps but it didn't help.
http://new.omnijewelcrafters.com/2-maps-test
#3
Gosh sorry, I didn't realize I changed the issue title.
After looking at 100 map torture test here:
http://gmap.chicagotech.org/node/6
I found out that map id is not used properly. Without good knowledge of the module I came up with this patch that put map id where it should be (instead of generic 'map').
--- gmap.module 2008-08-21 17:37:16.000000000 +0200+++ gmap.module.bak 2008-07-16 01:05:15.000000000 +0200
@@ -1106,5 +1106,5 @@
// Stuff moved from expand_gmap().
// @@@ Clean this up once and for all...
- $mapid = ($element['#settings']['id'] ? $element['#settings']['id'] : 'map');
+ $mapid = 'map';
if ($element['#map']) {
$mapid = $element['#map'];
This isn't a victory though, now I'm getting "Javascript is required to view this map." for the first map.
Forgot to mention that Firefox Error console shows no JavaScript errors (only CSS error in /modules/gmap/gmap.css?y).
#4
So I fixed it (quickly, hopefully not too dirty).
The problem was that subsequent assignments to Drupal.settings.gmap didn't *add* new maps - they trashed the old map and assigned a new.
Here's a full diff (incl. the above change):
--- gmap.module 2008-08-21 19:14:42.656250000 +0200
+++ gmap.module.bak 2008-07-16 01:05:15.000000000 +0200
@@ -246,5 +246,4 @@
drupal_add_js(array(
- 'gmap' => array(),
'gmap_init' => array(
'querypath' => base_path() .'map/query',
@@ -1107,5 +1106,5 @@
// Stuff moved from expand_gmap().
// @@@ Clean this up once and for all...
- $mapid = ($element['#settings']['id'] ? $element['#settings']['id'] : 'map');
+ $mapid = 'map';
if ($element['#map']) {
$mapid = $element['#map'];
@@ -1154,5 +1153,5 @@
$o .= '<script type="text/javascript">'."\n";
$o .= "/* <![CDATA[ */\n";
- $o .= 'jQuery.extend(Drupal.settings.gmap,'. drupal_to_js(array($element['#map'] => $map)) .");\n";
+ $o .= 'jQuery.extend(Drupal, { settings: '. drupal_to_js(array('gmap' => array($element['#map'] => $map))) ." });\n";
$o .= "/* ]]> */\n";
$o .= "</script>\n";
#5
I know what's going on. There are two bugs.
A) I need to be passing boolean TRUE to jQuery.extend.
B) I broke mapid handling.
Also, keep your mitts off the "fixed" status. "fixed" is what *I* set when it's *committed!*
#6
Part 1 of the fix is in.
http://drupal.org/cvs?commit=135383
#7
And part 2.
http://drupal.org/cvs?commit=135388
#8
Automatically closed -- issue fixed for two weeks with no activity.