icon.js

Drupal.gmap.expandIconDef = function(c,path,files) {
...
    if (!c[0][i]) { // '0' is not an object, and the following lines also throw similar error
      c[0][i] = [ fallback[i] ];
    }
    c[0][i] = Drupal.gmap.expandArray(c[0][i],c[0][0].length);
...
}

Comments

darkodev’s picture

Title: js errors in IE6 and 7 » icon.js errors in IE6 and 7
PGiro’s picture

I have the same thing on Firefox 2 via Firebug and my markers do not get displayed. Using D6-1.0

bdragon’s picture

Could I get a list of enabled modules?

PGiro’s picture

Here is mine

cck
extra_voting_forms
feedburner
google_cse
pathauto
service_links
token
viewscarousel
activity_log
devel
facebook_status
feed_tools (#custom, no UI)
gravatar
pcp
tagadelic
twitter
views_slideshow
adsense
directory
fbconnect
flag
jcarousel
pgprod
taxonomy_image
user_activity
votingapi
advanced_help
drigg
feedapi
forward
link
popups
taxonomy_list
user_karma
websnapr
ajax_comments
drigg_external
feedapi_itemfilter
friendlist
mollom
privatemsg
taxonomy_manager
user_visits
xmlsitemap
avatar_selection
drigg_rss_feedapi (#custom, no UI)
feedapi_mapper
google_analytics
nodewords
rules
views

PGiro’s picture

I have done a little debugging and here is what I found

My setup : I have defined a location in a node and the node body is [gmap], that's all. The map gets displayed but no marker. I know it's not a filter issue because I only have a gmap filter applied

Drupal.gmap.iconSetup gets called and it iterates over the markers.

for (var ini in m[path].i) {
92 $.extend(Drupal.gmap.icons,Drupal.gmap.expandIconDef(m[path].i[ini],path,files));
93 }

results in two calls to expandIconDef, the second creates the error.

The first gets called correctly with the contents of /small.i["0"] while the second call is with /small.i["add"] => it looks as if it confuses the methods on the .i[] array and its contents

PGiro’s picture

Ok, I confirm this is the issue.

I removed all markers except the big directory and replaced

for (var ini in m[path].i) {
$.extend(Drupal.gmap.icons,Drupal.gmap.expandIconDef(m[path].i[ini],path,files));
}

with

//for (var ini in m[path].i) {
$.extend(Drupal.gmap.icons,Drupal.gmap.expandIconDef(m[path].i[0],path,files));
//}

(and yes, those are comments)

and I now get my marker (which is red)

I am not a javascript guru, can someone explain why for (var ini in m[path].i) iterates over the array's prototype functions ??

darkodev’s picture

This issue affects us in a different context: the dynamic render module fails to hide the appropriate css class, so the text appears twice, but only on pages that show the gmap.

bdragon’s picture

I am not a javascript guru, can someone explain why for (var ini in m[path].i) iterates over the array's prototype functions ??

Because someone dicked around with Object.prototype?

bdragon’s picture

Version: 5.x-1.0-rc2 » 6.x-1.x-dev
Assigned: Unassigned » bdragon

Anyway, it's been a while since I've visited that bit of code, and the Drupal coding standards have changed. Expecting people not to touch Object.prototype is a lost battle in today's world it seems, so I ended up putting if() guards in.

http://drupal.org/cvs?commit=168928
http://drupal.org/cvs?commit=168930

bdragon’s picture

Status: Active » Postponed (maintainer needs more info)

I'm pretty sure this will fix the errors, could someone check?
Rev. 1.4 can be dropped into both D5 and D6, and I'm pretty sure it's fully compatible with 1.0.

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/gmap/js/ico...

PGiro’s picture

Hi bdragon, I no longer get a javascript error.

Unfortunalty, I cannot confirm that it works as the marker does not appear using your code or my previous code at #6, sigh...

PGiro’s picture

I can confirm the fix works for me using gmap_simple_map() in Chrome, FF3 and IE. Thanks !

rooby’s picture

Status: Postponed (maintainer needs more info) » Fixed

Reported as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.