Gmap styled views ignore "Marker action" setting
| Project: | GMap Module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
On the Gmap settings page, you may set the marker action (the action performed when a marker is clicked). This setting has no effect on the rendering of a Gmap view. The view only creates markers whose action is "Open info window."
Steps to repeat:
1) install Gmap, Gmap location and dependent modules.
2) create a Gmap styled view that displays markers.
3) go to Site Configuration -> Gmap and set the "Marker action" to "Open link."
4) go to the page where your Gmap is displayed and click on a marker.
Expected result:
User is directed to that node's page.
Actual result:
An info window opens.
If you set the marker action to "Do nothing" and then click on a marker, it will again open an info window when you click a marker.
The attached patch checks the marker action setting (markermode) and then either adds a "text" value to markers if the default action is "Open window info", adds a "link" value to markers if the action is "Open link" or adds neither if the action should be "Do nothing." It is the presence or absence of these values that determine the what javascript onclick action will be attached to a marker (see gmap/js/marker.js).
| Attachment | Size |
|---|---|
| use_default_marker_action_in_view.diff | 1.35 KB |

#1
I tested it and seems to be working properly for both options, do nothing and open link.
#2
Works for me as well. Thanks!
#3
Great patch, just what I needed!
In future versions, a neat feature would be able to choose the action in the view, overriding the default action, so that different views could have different actions set.
#4
Thanks, that works for me. You might also be interested in http://drupal.org/node/364413 as a related fix.
#5
That's great mrb! I tested it and it works. I rolled a patch with those changes included below. It would be great to get this committed!
#6
How do I install this patch? Is it related to Drupal Core or Gmap Module?
#7
gmap.module. here's an easy guide to applying patches:
http://drupal.org/node/60108
these changes aren't too hard, so if you opened it in a text editor and figured out the syntax, you could probably even do it by hand.
just make sure to make a backup first. :)
#8
#5 worked ok on simple views, but not when the view used a relationship. Here's another patch that fixes that - it lets you choose which field to use for the tooltip text and the link.
It also lets you override the marker action on a per-view basis, as requested in #3.
Note that the patch also includes the changes from issue http://drupal.org/node/338587, which was the initial gmap-views-relationships issue.
#9
Thanks mrb. This should be implemented to the module ASAP.
Very important feature.
#10
Referencing comments# 5 & 8, do we run both patches or just the last one?
Ashford
#11
Just use #8 - it includes the changes in #5.
#12
I was having a similar problem. I am not using Gmap Views, just creating a gmap macro with some markers on it. I wanted the markers to open a link. Instead, they just open a popup info window with the html code example. I tried installing the patch in #8, but something didn't work. I received this info:
[~/public_html/sites/all/modules/gmap]# patch < gmap
-352553-8.patch
(Stripping trailing CRs from patch.)
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- \old\gmap_plugin_style_gmap.inc Thu Feb 05 15:25:23 2009
|+++ \new\gmap_plugin_style_gmap.inc Thu Feb 05 15:08:36 2009
--------------------------
File to patch: gmap_plugin_style_gmap.inc
patching file gmap_plugin_style_gmap.inc
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 12.
Hunk #3 succeeded at 84 with fuzz 1 (offset 22 lines).
Hunk #4 FAILED at 108.
Hunk #5 succeeded at 120 (offset 16 lines).
Hunk #6 FAILED at 197.
Hunk #7 succeeded at 297 (offset 60 lines).
4 out of 7 hunks FAILED -- saving rejects to file gmap_plugin_style_gmap.inc.r
ej
Gmap still seems to be working, but I'm having the same old problem. What did I do wrong? I'm pretty new at all of this. Thanks for your help.
#13
halver, I think all the patches here relate to gmap displayed via Views. So even if you get the patches to apply ok, I don't think they are going to help.
I recommend you open a new issue for the problem you're having.
#14
OK, thanks. I've posted my issue here: http://drupal.org/node/316982
#15
Any plans to update this patch for v1.1?
halver that's probably the reasons for your patch error as I got the same. Works fine when I applied it to the v1.0 version however.
Looks like a lot has changed between 1 and 1.1 otherwise I would update it myself.
Cheers
#16
This patch does not apply cleanly anymore, either to 1.1-rc1 or -dev.
Here is the error trying to patch 6.x-1.x-dev:
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 12.
Hunk #3 succeeded at 88 with fuzz 1 (offset 26 lines).
Hunk #4 FAILED at 112.
Hunk #5 succeeded at 146 (offset 42 lines).
Hunk #6 FAILED at 223.
Hunk #7 succeeded at 316 (offset 79 lines).
4 out of 7 hunks FAILED
Does anyone have this working on rc-1 or -dev and could provide a patch?
#17
#18
subscribe
#19
:subscribe:
#20
subscribe
#21
i is a-subscribing
#22
Here's an updated version of the patch. I decided that rather than including the field with the NID we should really be including a field with the URL that we want to use. This makes the system way more flexible so that a GMAP can link to something other than a NID, like another view at "location/[province]" or something. Way more flexible. Unfortunately, that doesn't work just yet ;) But, it's getting closer and hopefully soon I can post a patch that works for all of these use cases.
#23
Hey everyone,
greggles, I just applied your patch to 6.x-1.1-rc1, it applied fine but the behaviour is persisting. No matter what I set marker behaviour in either the GMap or GMap Location config, clicking on a marker opens an empty info window. This occurs in both the block view and on the full node map.
Should I revert back to an earlier version? Why has this issue hung around for so long?
Cheers.
#24
Well, that was my desired behavior so I guess that's why I didn't notice that the selection was broken. I may not have more time to work on this personally, but hopefully that patch helps move it forward.