Hey all,
Attached is a plugin that will map (on a separate tab in your community) all of the content authors in a community. You can see the location of all bloggers, document authors, discussion authors, or all authors on a Google Map. Geo location is looked up using MaxMind's free geo lite city database which is updated every month; geo information is gathered and saved automatically each time a user logs in so it stays current. Before using the map go to the Map tab in the admin and store a Google Maps key (also free) that you can get at http://www.google.com/apis/maps/signup.html .
10/27 update: Thanks to Dawn the complete (and big) plugin and src files are attached. 99% of the size is due to the geo lite city database. To use the plugin put it in your jiveHome/plugin directory then go to the "Map" tab in the Clearspace admin and enter your Google Maps key. As authors login you'll begin seeing them on the map. Note: The plugin requires Clearspace 1.7 or higher. I had to use a couple of APIs/functions only available in this release.
Now that I'm well rested I've thought of some improvements to the plugin. Let me know what you think.
UI/function improvements:
1. Option for each user not to appear on the map. Should it be off by default?
2. Option for each user to override the latitude/longitude set automatically when they login. This would be useful for authors that want to be appear in just one location regardless of where they're really located and for use in a company intranet when everyone has one of a few IPs. Should this be configurable from the admin (Personally I wouldn't want people faking out their location in an external community)?
3. Admin option to set the default latitude/longitude of the map center and the default zoom level. That would be useful when you know your communities are located in a small geographical area.
4. Show more information in the map popup for each author. Possibly make this configurable from the admin.
I decided to go with minimal information to start with and get feedback on what users want.
Code improvements
1. Come up with a different way to get the authors in a community. Currently the plugin is using the Community getXXX methods with a filter but I don't know if this will work well in a community with 100K discussion threads. I've looked at using the search instead and also have considered starting a task on plugin init that builds up a singleton list of authors for each community and then just incrementally updates it much like how search works. I'm not sure how to do this in a cluster-aware fashion though, I think Jive forums has cluster-aware tasks and would want to use that in CS. Is this too much overhead for a map plugin and/or is it over-engineering the problem?
Thanks,
Jay
Hey Tim,
Geez, you were up late, I gave out. If you're like me it was a lot of late nights this week... I'd like to try your plugin but I don't have a local JIRA instance, can I point it to one? I don't know much about Flex, how is it?
Yep, the geo information is all based off of the user's IP. Jive bundles the Maxmind Java API (they use it to look up the country you're from) so you can just import and go. Look in GmapPlugin.java in the plugin source. Here's the code:
String fileName = JiveGlobals.getJiveHome() + File.separator + "plugins" + File.separator + "gmap" + File.separator + "resources" + File.separator + "GeoLiteCity.dat";
lookupService = new LookupService(fileName);
// Assume we have a String IP Address (in dot-decimal form)
location = lookupService.getLocation(presence.getIPAddress().trim());
// store the geo information as user properties
userProperties.put("plugin.gmap.IP", presence.getIPAddress());
if (location != null)
{ userProperties.put("plugin.gmap.latitude", String.valueOf(location.getLatitude()));
userProperties.put("plugin.gmap.longitude", String.valueOf(location.getLongitude())); }
Thanks,
Jay
RE: late nights -- yep, I have an 11 month old little girl, so it's been tough to find time. Mostly consisted of really late nights, especially this past week, into the early morning.
You don't need a local Jira instance to use the plugin. Notice the screenshot is connected to Jivesoftware's Jira server: http://www.jivesoftware.com/issues.
Unfortunately that connection took a lot of time, I had to figure out the XWork Actions with respect to Clearspace to write a proxy to retrieve the data from the external server. Looking at the solution, it seems like a simple thing, but there were a lot of bumps along the way. A lot. ![]()
One big problem that nags me is that I really wanted to cache the resulting XML Feeds. I wrote code to do it via jive properties, but ran into some issues there with the large values (the feeds can get big, over 200Kb easily) persisting into the DB.
RE: Flex -- man, I dig Flex. It has its own hurdles and bumps, but it really is amazing what can be done. And I'm no wiz at the layout, nor ActionScript, nor the components library!
For example, the datagrid (i.e. table) has a filter on it...start typing in the box and only rows with the filtertext are displayed in the grid. Could you do that in DHTML - most likely, but I bet it would take a whole lot more than a half dozen lines of code, and you'd have to test it in 5 browsers on 3 platforms.
RE: IP based lookups - it would be interesting to see how accurate they are these days. I remember in the "olden days" the weblog stats showing "geographic location", but since AOL was 60% of the traffic, everyone appeared to be from Virgina, USA. lol! ![]()
Cheers!
Timo
Jay,
Great tool!
These are my comments - (Interest level key - 5: highest, 1:lowest )
1. Option for each user not to appear on the map. Should it be off by default?
Interest level 5
2. Option for each user to override the latitude/longitude set automatically when they login. This would be useful for authors that want to be appear in just one location regardless of where they're really located and for use in a company intranet when everyone has one of a few IPs. Should this be configurable from the admin (Personally I wouldn't want people faking out their location in an external community)?
Interest Level - 4
Comment: Shoud be configurable by admin to prevent some users from users faking their location
3. Admin option to set the default latitude/longitude of the map center and the default zoom level. That would be useful when you know your communities are located in a small geographical area.
Interest Level - 4
4. Show more information in the map popup for each author. Possibly make this configurable from the admin.
I decided to go with minimal information to start with and get feedback on what users want.
Interest Level - 5
Code improvements
1. Come up with a different way to get the authors in a community. Currently the plugin is using the Community getXXX methods with a filter but I don't know if this will work well in a community with 100K discussion threads. I've looked at using the search instead and also have considered starting a task on plugin init that builds up a singleton list of authors for each community and then just incrementally updates it much like how search works. I'm not sure how to do this in a cluster-aware fashion though, I think Jive forums has cluster-aware tasks and would want to use that in CS. Is this too much overhead for a map plugin and/or is it over-engineering the problem?
Comment: This would come in very handy given the rate at which a well-designed external facing community grows these days.
Hey abakwaboy,
Thanks, I intend to get started soon on improving the plugin, stay tuned. Did you try it?
Jay
Hey Jay,
We are moving to CSX 1.7. I look forward to deploying the changes.
Thanks,
Abakwa.
Hello Jay,
I tried to use the goggle map plugin on CSX 1.10. Got the following system error message:
"The specified community does not exist"
All communities l used for testing do indeed exist. Is it possible l might have missed a step during set up?
Thx,
Abakwa
Jay,
Thanks for this plug-in. I am getting the same error that abakwaboy is:
"The specified community does not exist"
I'm using ClearspaceX 1.9.0.
Also, and I'm not yet sure this was the result of installing the plug-in, the resolution of ClearspaceX suddenly increased dramatically.
Regards,
Joe
Hey guys,
Sorry for the troubles you're having. It's a known problem and we have yet to figure it out. It appears to be a change to how plugins were rendered in 1.8 or 1.9. You can follow the thread on the problem at http://www.jivesoftware.com/community/thread/15257.
Thanks,
Jay
Hey guys,
I got the plugin working on CS 1.8, see http://www.jivesoftware.com/community/thread/15257?tstart=0 for the details. I'm going to concentrate my time on making it work on CS 2; if you would still like a build for CS 1.8 though let me know and I'd be happy to create one.
Thanks,
Jay
I am getting the same "...community does not exist" in v 2.0.3. Any thoughts?
Doh, sorry for the delay, I missed this comment! First things first, are you sure you downloaded the CS 2 version of the plugin?
Jay
Hey Peter,
Sure, let me add it to the JAR and upload again. I'll do that shortly.
Thanks,
Jay
In the source code for version 1 you have the following lines (class GmapUtils):
Iterable<JiveContentObject> contentObjects = community.getCombinedContent(resultFilter, ContentRetrieval.ALL_TYPES);
rootCommunity.getCombinedContent(resultFilter, ContentRetrieval.ContentType.THREAD);
Eclipse does not like the "getCombinedContent" part any more - is it possible that the command changed and if yes can you tell me how you did the "receive all content" part in the new version?
that would be great!
Hey Jay -- cool stuff!
When you say, "geo information is gathered and saved automatically"... are you grabbing that info based on the users incoming IP, or some other means of tracking?
I know, I know... I could download the src...but right now, brain is completely fried after submitting my plugin for JiraIssues with Flex. <grin>
Good luck, mate!
-T