Closed (fixed)
Project:
Geobrowser
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
11 Dec 2007 at 23:19 UTC
Updated:
4 Feb 2008 at 06:12 UTC
I am trying, unsuccessfully to modify the javascript for the function node_clicked around line 249 in browser.php.
Addmittedly I am a novice when it comes to javascript, but this doesn't seem to be too hard.
What the function currently does is load up the node in the info window that coresponds to that marker being clicked.
What Id like it to do is this:
if the node type is a specific type then recenter and zoom the map on that marker.
Here is what I have written:
if (marker.tid == 1) {
map.setCenter(new GLatLng(point.lat,point.lng), 7);
}
I am sure that it is wrong however.
Thanks so much for your help.
Comments
Comment #1
phayes commentedalmost
marker.layer not marker.tid
Comment #2
emersonlenon commentedIf I want to dynamically update the geobrowser_begin_lat or lng or zoom variables based on user input how would I do that?
I tried:
but that obviously did not work.
I figured out how to display the lat and lng by using the variable_get(geobrowser_begin_lat) function, is there a variable_write() function of some kind in drupal?
Comment #3
emersonlenon commentedPatrick,
sorry to bombard you with questions, I am learning fast, but there is a lot I still don't understand.
In browser.php, around line 347 there is code to load the markers inside a for each loop.
currently it loads them in numerical order based on node id.
Can I get it to load one layer first then another layer?
For example I have one taxonomy (1) with two terms in it (1 and 2).
Can I load only the term 2s then the term 1s?
Thanks.
Comment #4
phayes commented1st question:
look to browser.php, line 480, 481, 482
2nd question:
I'm not quite sure what your trying to accomplish... All the markers are loaded at once... Every time you move the map or change the layer tree a single Ajax/SQL query is made to the database which grabs all the nodes that live within the current view and correspond to the selected layers.....
So, you move the map and have layers 1,2 and 3 selected.
The javascript sends this request to the server: geobrowser_xml_controller&function=map_node&layer0=1,2,3¤t_tree=0&lat_min=23&lat_max=45&lon_min=20&lon_max=50
The server then takes than and uses it to query the database (geobrowser.module line 447 - 525)and returns a bunch of XML with the data for the nodes requested...
The javascript then takes this XML and displays it on the map browser.php line 367- 402)
Hope that helps!
Patrick
Comment #5
phayes commented