Forums / Cotonti / Extensions / [UPDATE] User Map v2

Sean
#1 2009-02-03 06:13
Hi Everyone,
Im am happy to release my first Cotonti plugin! Its a new version of my User Map plugin I released over at Neocrome a couple weeks ago. Heres the changes in the new version:

New In v2.0:

- Different coloured markers are now supported
- On the main map, the users Avatar will now be displayed on their pin
- Various security fixes
- Language file has been added
- Geocoder function has been improved

Installation:
1. Unpack the plugin into /plugin/usermap
2. Create the new SQL table:
CREATE TABLE `sed_usermap` (
  `id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL default '0',
  `lat` decimal(12,8) NOT NULL default '0.00000000',
  `lon` decimal(12,8) NOT NULL default '0.00000000',
  `description` varchar(50) NOT NULL default '',
  `username` varchar(50) NOT NULL default '',
  `colour` varchar(8) NOT NULL default 'red',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
3. Sign up for a Google Maps API key at: http://code.google.com/apis/maps/signup.html
This is important! User Map will not function with out this code!!
4. Copy your key into the configuration panel for the plugin (admin.php?m=config&n=edit&o=plug&p=usermap) Here you can also change the size of the maps to fit your site.
5. Add the tags listed on the plugin page to your TPL's (See readme.txt for some examples)
6. Add your pin to the map by editing your profile, and call the map up with plug.php?e=usermap
7. Enjoy!

To Upgrade From v1.0 to v2.0:
1. Delete the old plugin and upload the new files
2. Run the following SQL:
ALTER TABLE `sed_usermap` ADD `colour` VARCHAR(8) DEFAULT 'red' NOT NULL;
3. You're good to go!

Hope you guys find this useful. Let me know your questions & comments below!

Also: As mentioned above, Ive now included a lang file. Anyone who would like to translate would be greatly appreciated.

Also #2: I was going to try to submit this under Downloads, but I don't see a submit link any where?
esclkm
#2 2009-02-03 07:50
good job.
But I have one small advise
but download plugins like this : modcp or attach/ Open setup file/ You can see than in cotonti you can write your own install scripts and install databases automatically.
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
Trustmaster
#3 2009-02-03 16:12
Don't forget to add it to plugins section.
May the Source be with you!
Sean
#4 2009-02-04 03:26
@esclkm - Thanks, ill look into this. I didn't know that feature existed :)

@Trustmaster - I was going to add it to the plugins section, but I don't see a submit link anywhere? Maybe I don't have permissions?
Trustmaster
#5 2009-02-04 03:36
Try it now.
May the Source be with you!
sebtus
#6 2009-02-11 00:37
hello
i have a problem with this plug...
after installation no map is shown....
here is the source code from the page but nothing is shown:
      <div id="title"><a href="plug-e-usermap.html">User Map</a></div>
      <div id="subtitle">
      A Map of Our Users
      </div>
      <div style="padding:10px;">
        <script src="http://maps.google.com/maps?file=api&v=2&key=[my key]" type="text/javascript"></script>

<script type="text/javascript">
    function initialize() {
      if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GScaleControl());
	map.setCenter(new GLatLng(0.0, 0.0), 1, G_NORMAL_MAP);
	

	function createMarker(point, number, type)
	{
		var marker = new GMarker(point, customIcons[type]);
		// Show this markers index in the info window when it is clicked
		var html = number;
		GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
		return marker;
	};

    	var iconBlue = new GIcon(); 
    	iconBlue.image = 'plugins/usermap/markers/blue-dot.png';
    	iconBlue.shadow = 'plugins/usermap/markers/shadow.png';
    	iconBlue.iconSize = new GSize(32, 32);
    	iconBlue.shadowSize = new GSize(59,32);
    	iconBlue.iconAnchor = new GPoint(15, 32);
    	iconBlue.infoWindowAnchor = new GPoint(10, 40);

    	var iconGreen = new GIcon(); 
    	iconGreen.image = 'plugins/usermap/markers/green-dot.png';
    	iconGreen.shadow = 'plugins/usermap/markers/shadow.png';
    	iconGreen.iconSize = new GSize(32, 32);
    	iconGreen.shadowSize = new GSize(59,32);
    	iconGreen.iconAnchor = new GPoint(15, 32);
    	iconGreen.infoWindowAnchor = new GPoint(10, 40);

    	var iconRed = new GIcon(); 
    	iconRed.image = 'plugins/usermap/markers/red-dot.png';
    	iconRed.shadow = 'plugins/usermap/markers/shadow.png';
    	iconRed.iconSize = new GSize(32, 32);
    	iconRed.shadowSize = new GSize(59,32);
    	iconRed.iconAnchor = new GPoint(15, 32);
    	iconRed.infoWindowAnchor = new GPoint(10, 40);

    	var iconLtBlue = new GIcon(); 
    	iconLtBlue.image = 'plugins/usermap/markers/ltblue-dot.png';
    	iconLtBlue.shadow = 'plugins/usermap/markers/shadow.png';
    	iconLtBlue.iconSize = new GSize(32, 32);
    	iconLtBlue.shadowSize = new GSize(59,32);
    	iconLtBlue.iconAnchor = new GPoint(15, 32);
    	iconLtBlue.infoWindowAnchor = new GPoint(10, 40);

    	var iconPink = new GIcon(); 
    	iconPink.image = 'plugins/usermap/markers/pink-dot.png';
    	iconPink.shadow = 'plugins/usermap/markers/shadow.png';
    	iconPink.iconSize = new GSize(32, 32);
    	iconPink.shadowSize = new GSize(59,32);
    	iconPink.iconAnchor = new GPoint(15, 32);
    	iconPink.infoWindowAnchor = new GPoint(10, 40);

    	var iconPurple = new GIcon(); 
    	iconPurple.image = 'plugins/usermap/markers/purple-dot.png';
    	iconPurple.shadow = 'plugins/usermap/markers/shadow.png';
    	iconPurple.iconSize = new GSize(32, 32);
    	iconPurple.shadowSize = new GSize(59,32);
    	iconPurple.iconAnchor = new GPoint(15, 32);
    	iconPurple.infoWindowAnchor = new GPoint(10, 40);

    	var iconYellow = new GIcon(); 
    	iconYellow.image = 'plugins/usermap/markers/yellow-dot.png';
    	iconYellow.shadow = 'plugins/usermap/markers/shadow.png';
    	iconYellow.iconSize = new GSize(32, 32);
    	iconYellow.shadowSize = new GSize(59,32);
    	iconYellow.iconAnchor = new GPoint(15, 32);
    	iconYellow.infoWindowAnchor = new GPoint(10, 40);

    	var iconOrange = new GIcon(); 
    	iconOrange.image = 'plugins/usermap/markers/orange-dot.png';
    	iconOrange.shadow = 'plugins/usermap/markers/shadow.png';
    	iconOrange.iconSize = new GSize(32, 32);
    	iconOrange.shadowSize = new GSize(59,32);
    	iconOrange.iconAnchor = new GPoint(15, 32);
    	iconOrange.infoWindowAnchor = new GPoint(10, 40);

    	var customIcons = [];
    	customIcons["blue"] = iconBlue;
    	customIcons["red"] = iconRed;
      customIcons["green"] = iconGreen;
      customIcons["ltblue"] = iconLtBlue;
      customIcons["pink"] = iconPink;
      customIcons["purple"] = iconPurple;
      customIcons["yellow"] = iconYellow;
      customIcons["orange"] = iconOrange;

	
      var point = new GLatLng(39.45215000,-74.72751100);
var marker = createMarker(point, '<div style=\"width:200px;\"><a href=\"users.php?m=details&amp;id=1\">sebtus</a>  United States<br><img src=\"datas/defaultav/acpb_avatar1.gif\"></div>','');
map.addOverlay(marker);

var point = new GLatLng(39.36033400,-74.43725800);
var marker = createMarker(point, '<div style=\"width:200px;\"><a href=\"users.php?m=details&amp;id=323\">acpb</a> - United States<br><img src=\"datas/avatars/323-avatar.gif\"></div>','red');
map.addOverlay(marker);

var point = new GLatLng(42.26086300,-79.43089300);
var marker = createMarker(point, '<div style=\"width:200px;\"><a href=\"users.php?m=details&amp;id=1003\">PHACE22</a> United States<br><img src=\"datas/defaultav/eopa_avatar.gif\"></div>','red');
map.addOverlay(marker);


	
      }
    }
    </script>
[/]
alphaphoenix
#7 2009-08-15 01:36
Is it possible to use the google map api to do a radius search for members in a specific distance from where you are?
Lombi
#8 2009-08-15 01:43
# alphaphoenix : Is it possible to use the google map api to do a radius search for members in a specific distance from where you are?

Think that's possible, yea. Since you have specific lang and lat you can do just about all of the operations. The problem however would be that you're limited to a specific number of API calls per day (last time I checked the site). Geocoding and other complex mathematical operations had this limit.
<a href="http://www.domenlo.com">Surreal Art</a>
alphaphoenix
#9 2009-08-15 02:01
What I am thinking is that I can use the google api to get the coordinates then use a simple drop down search form in the search plug in to show me a list of users or users pages by radius distance. Do you know how this could be accomplished?
CorpQuid
#10 2009-12-13 14:10
This is working good on one of our clan sites however we have the following requests and need to know if this can be done.

1. Can we include the map on our index page via tags?
2. Can we have it show the location of all users based on their group
3. Can it display the location of users even if they are not online? Or does it do this and the users must set this up in their profile first? Currently we only see the people who are online.

Thank You
Kingsley
#11 2010-06-17 20:33
After installing no map is shown.

plug-in seems to work all right though, can alter info and it is saved, but no map is shown.

http://www.x-ecutionerz.com/site/plug.php?e=usermap
urlkiller
#12 2010-06-18 20:46
@Kingsley

i guess if ound the bug:

	<div class="mboxBody">

	
		<div id="subtitle">A Map of Our Users</div>

		<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA3yEIYOYgH2dhSGxfk0rY-RThJwBHKWWgjnxCOmE66p23dSkf3hRBswvJ2rSfjA58My0_PfyTmgDhPw" type="text/javascript"></script>

<script type="text/javascript">
    function initialize() {
      if (GBrowserIsCompatible()) {
	var map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GScaleControl());
	map.setCenter(new GLatLng(0.0, 0.0), 1, G_NORMAL_MAP);
	

	function createMarker(point, number, type)
	{
		var marker = new GMarker(point, customIcons[type]);
		// Show this markers index in the info window when it is clicked
		var html = number;
		GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
		return marker;
	};

    	var iconBlue = new GIcon(); 
    	iconBlue.image = 'plugins/usermap/markers/blue-dot.png';
    	iconBlue.shadow = 'plugins/usermap/markers/shadow.png';
    	iconBlue.iconSize = new GSize(32, 32);
    	iconBlue.shadowSize = new GSize(59,32);
    	iconBlue.iconAnchor = new GPoint(15, 32);
    	iconBlue.infoWindowAnchor = new GPoint(10, 40);

    	var iconGreen = new GIcon(); 
    	iconGreen.image = 'plugins/usermap/markers/green-dot.png';
    	iconGreen.shadow = 'plugins/usermap/markers/shadow.png';
    	iconGreen.iconSize = new GSize(32, 32);
    	iconGreen.shadowSize = new GSize(59,32);
    	iconGreen.iconAnchor = new GPoint(15, 32);
    	iconGreen.infoWindowAnchor = new GPoint(10, 40);

    	var iconRed = new GIcon(); 
    	iconRed.image = 'plugins/usermap/markers/red-dot.png';
    	iconRed.shadow = 'plugins/usermap/markers/shadow.png';
    	iconRed.iconSize = new GSize(32, 32);
    	iconRed.shadowSize = new GSize(59,32);
    	iconRed.iconAnchor = new GPoint(15, 32);
    	iconRed.infoWindowAnchor = new GPoint(10, 40);

    	var iconLtBlue = new GIcon(); 
    	iconLtBlue.image = 'plugins/usermap/markers/ltblue-dot.png';
    	iconLtBlue.shadow = 'plugins/usermap/markers/shadow.png';
    	iconLtBlue.iconSize = new GSize(32, 32);
    	iconLtBlue.shadowSize = new GSize(59,32);
    	iconLtBlue.iconAnchor = new GPoint(15, 32);
    	iconLtBlue.infoWindowAnchor = new GPoint(10, 40);

    	var iconPink = new GIcon(); 
    	iconPink.image = 'plugins/usermap/markers/pink-dot.png';
    	iconPink.shadow = 'plugins/usermap/markers/shadow.png';
    	iconPink.iconSize = new GSize(32, 32);
    	iconPink.shadowSize = new GSize(59,32);
    	iconPink.iconAnchor = new GPoint(15, 32);
    	iconPink.infoWindowAnchor = new GPoint(10, 40);

    	var iconPurple = new GIcon(); 
    	iconPurple.image = 'plugins/usermap/markers/purple-dot.png';
    	iconPurple.shadow = 'plugins/usermap/markers/shadow.png';
    	iconPurple.iconSize = new GSize(32, 32);
    	iconPurple.shadowSize = new GSize(59,32);
    	iconPurple.iconAnchor = new GPoint(15, 32);
    	iconPurple.infoWindowAnchor = new GPoint(10, 40);

    	var iconYellow = new GIcon(); 
    	iconYellow.image = 'plugins/usermap/markers/yellow-dot.png';
    	iconYellow.shadow = 'plugins/usermap/markers/shadow.png';
    	iconYellow.iconSize = new GSize(32, 32);
    	iconYellow.shadowSize = new GSize(59,32);
    	iconYellow.iconAnchor = new GPoint(15, 32);
    	iconYellow.infoWindowAnchor = new GPoint(10, 40);

    	var iconOrange = new GIcon(); 
    	iconOrange.image = 'plugins/usermap/markers/orange-dot.png';
    	iconOrange.shadow = 'plugins/usermap/markers/shadow.png';
    	iconOrange.iconSize = new GSize(32, 32);
    	iconOrange.shadowSize = new GSize(59,32);
    	iconOrange.iconAnchor = new GPoint(15, 32);
    	iconOrange.infoWindowAnchor = new GPoint(10, 40);

    	var customIcons = [];
    	customIcons["blue"] = iconBlue;
    	customIcons["red"] = iconRed;
      customIcons["green"] = iconGreen;
      customIcons["ltblue"] = iconLtBlue;
      customIcons["pink"] = iconPink;
      customIcons["purple"] = iconPurple;
      customIcons["yellow"] = iconYellow;
      customIcons["orange"] = iconOrange;

	
      var point = new GLatLng(52.13263300,5.29126600);
var marker = createMarker(point, '<div style=\"width:200px;\"><a href=\"users.php?m=details&amp;id=1\">Kingsley</a> - Netherlands<br><img src=\"./datas/avatars/1-avatar.gif\"></div>','yellow');
map.addOverlay(marker);


	
      }
    }
    </script>
  </head>
  
  <center>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map" style="width: 550px; height: 500px"></div> 
  </body>

  <center>




	</div>

this code is copied from your site and if you take a look in it carefully you'll see that it has another <body>, <head> tag in it. so most likely this is causing the error!

Added 39 seconds later:

and double head and body is most likely not w3c compatible...
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
Kingsley
#13 2010-06-19 00:14
If you're talking about the last part:

# <center>
# <body onload="initialize()" onunload="GUnload()">
# <div id="map" style="width: 550px; height: 500px"></div>
# </body>
#
# <center>

that's actually in the usermap.php file itself. Don't know how to change that..
urlkiller
#14 2010-06-19 07:11
iam not 100% sure but i think this is pretty messy using a body and unclosed head tag in the code, whoever made that... there are at least 10 different ways of loading the java instead of the body tag.

1. but i would say this could make some trouble.

2. another thoughtcould be that some other java interfering with the usermap java...

3. some other idea could be to load it with the internal jquery part of cot...

4. debug with the firefox plugin firebug and check the logs.

5. also the webdeveolper toolbar helps you determine errors.

maybe it helps ya!
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>