PDA

View Full Version : CFL Project - JavaScript, regexp, encodeURI advice please




Petar
01-19-2009, 04:05 PM
I am in the process of integrating a GoogleMap with a wiki system (TWiki). Each wiki entry will be associated with a GoogleMap marker, and clicking on that marker will open up said wiki entry. The whole idea is that the entire CFL can keep track of all of its activities across all of the United States this way, together, as a community. I think that this may be the most efficient way that we can hope to organize ourselves.

The site is almost finished, and I have three main areas of functionality that need to be wrapped up:


Task 1) JavaScript, Regexp.

My GoogleMap needs to be able to use the text data on this page:

http://pivcec.dyndns.org/geowiki/twiki/bin/view/Main/report

So that it will display markers associated with each entry in my wiki (current map is connected to a database for exploratory purposes).

Here is the map that I am trying to integrate:

http://www.pastie.org/364596

Line 100 shows the XMLHttpRequest that I am making to that page, and line 104 shows the first line of regexp code that I am using to parse that information.

I was told that this code will identify the div that contains the text that I need to parse (patternTopic), but I still need some regexp that will identify and format "name", "lat", and "lng", so that markers can be created with this information.


Task 2) JavaScript, encodeURI.

If you click on a marker in my test map, then a TWiki search will be performed with the following format for example:

(36.171913, -115.139977)

In order for this search to work in TWiki, then I need to encodeURI so that the following format is produced instead for example:

"36.171913" "115.139977"

(no brackets, no comma, no minus symbol, and contained within quotation marks)

The encodeURI bit is located on line 123.


Task 3) Javascript, HTML

I made an HTML form in TWiki that will create new topics, and will also place latitude and longitude information inside a table called "GeographicLocation" within each new topic:

http://pastie.org/365124

This form currently consists of three text fields, one for topic title, one for latitude, and one for longitude.

I need to replace the text fields for longitude and latitude with a GoogleMap geocode search.

I started this process by putting both of these elements on the same page:

http://pivcec.dyndns.org/geowiki/twiki/bin/view/Main/CreateTopic

This page will display the underlying code:

http://pivcec.dyndns.org/geowiki/twiki/bin/view/Main/CreateTopic?raw=on

Please help me figure out how to do all this.

Thanks

LibertyEagle
01-19-2009, 04:06 PM
Ooooh, way cool. :D