Location: PHPKode > projects > Wiki-Map > htdocs/index.php
<?
/******************************************************************************
#   Copyright notice                                                                
#   
#   This file is part of Wiki-Map project [http://wiki-map.sourceforge.net/] 
#   Wiki-Map is free software; you can redistribute it and/or 
#   modify it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or (at your 
#   option) any later version.                                    
#
#   The GNU General Public License can be found at                        
#   http://www.gnu.org/copyleft/gpl.html.                                 
#   A copy is found in the textfile GPL and important notices to the      
#   license from the team is found in the textfile LICENSE distributed    
#   with these scripts.                                                    
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#   This copyright notice MUST APPEAR in all copies and derivatives of the script!
#*********************************************************************************/
#*********************************************************************************/
if (isset($_GET[edit]) && !isset($_COOKIE[name])){
	header("Cache-Control:no-cache");
	$go = "login.php?st=require&rt=addlocn.php";
	header("Location:".$go);
	exit();
	}
	$x = (isset($_COOKIE[x]))?$_COOKIE[x]:36.40;
	$y = (isset($_COOKIE[y]))?$_COOKIE[y]:29.58;
	$z = (isset($_COOKIE[z]))?$_COOKIE[z]:2;
	$x = (isset($_GET[x]))?$_GET[x]:$x;
	$y = (isset($_GET[y]))?$_GET[y]:$y;
	$z = (isset($_GET[z]))?$_GET[z]:$z;
	$_COOKIE[x] = $x;
	$_COOKIE[y] = $y;
	$_COOKIE[z] = $z;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<META NAME="Keywords" CONTENT="Map, wikimap, wikipedia, sharing, Google Map">
	<META NAME="Description" CONTENT="Collaborative Map building tool based on Google Map to share your location and other geo-information. A knowledge repository and collection of planning tools. Allows sharing and imbedding to other website.">
   <META NAME="Author" CONTENT="hide@address.com">   
   <title>WikiMap: The map YOU made</title>
   <link rel="stylesheet" type="text/css" href="wikimap.css">    
//
// ---------- TO DO: Replace the key with the one for your site ----------------------------
//   
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAApL1hGE-KNQcfWmK-4HpMHRSAsL_rpfnb7R6YjdHmXm9ZuwilPhTw9DUGZeCNDTsWftNOHtjvtQkLCQ"
      type="text/javascript"></script>
    <script src="wikistd.js" type="text/javascript"></script>
	<script src="icondef.js" type="text/javascript"></script>
	<script type="text/javascript">		
    //<![CDATA[

    function load() {
<? if (isset($_GET[a])){echo "alert('$_GET[a]');\n";}?>    		
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
		<?	echo "map.setCenter(new GLatLng($y, $x), $z);\n";?>
		}
       map.addControl(new GLargeMapControl());
       map.addControl(new GMapTypeControl());
       map.setMapType(G_HYBRID_MAP);
       map.addControl(new GScaleControl());
       map.addControl(new GOverviewMapControl());
		map.enableDoubleClickZoom(); // New addn ----------------
		var bounds = map.getBounds();
		var southWest = bounds.getSouthWest();
		var northEast = bounds.getNorthEast();
		var zlevel = map.getZoom();
		var omarker = new Object();
		GDownloadUrl("points.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
			show_icon(map,point,markers[i].getAttribute("type"),markers[i].getAttribute("desc"));
          }
        });
	  
		GEvent.addListener(map, "moveend", function() {
			var p = map.getCenter();
			setCookie('x',p.x);
			setCookie('y',p.y);
			setCookie('z',map.getZoom());
		});
	
	<? if (isset($_GET[edit])||isset($_GET[share])) {?>	 
		GEvent.addListener(map, "click", function(overlay, point) {
          if (overlay) {
            map.removeOverlay(overlay);
			window.status = '';
			svisibility('info','hidden');
          } else {
			if (omarker){map.removeOverlay(omarker);}  
			var tmarker =   new GMarker(point);
            map.addOverlay(tmarker);
			omarker = tmarker;
			svisibility('info','visible');			
			setCookie('y',point.lat());
			setCookie('x',point.lng());
			setCookie('z',map.getZoom());
			<? if (isset($_GET[edit])) { 
			echo "document.np.lat.value=point.lat();\n";
			echo "document.np.lng.value=point.lng();\n";
			echo "document.np.z.value = map.getZoom();\n";
			} else {
			?>
			cdmsg= "http://www.wikimap.biz/index.php?mark=1&x="+point.x;
			cdmsg=cdmsg+"&y="+point.y+"&z="+map.getZoom();
			document.cd.ref.value=cdmsg;
			<? }?>
		}
        });
		<? }
		if (isset($_GET[mark])){
			echo "\n\t\t var point = new GLatLng($y,$x);\n";
			echo "\t\t map.addOverlay(new GMarker(point));\n";
		}
		
	 ?>
    }

    //]]>
    </script>
  </head>

  <body onload="load()" onunload="GUnload()">
<!--
<? print_r ($_GET) ?>
-->
    <div id="map">
	</div>
	<div id="info">

	<TABLE width=100% bgcolor=#FFFFCC>
		<? if (isset($_GET[edit])) { ?>
		<TR>
			<TD>
				Add this point in database:<BR>
				<FORM method=POST name=np action='addpt.php'>
					Description: <INPUT type=text name=desc SIZE=80><BR>
					Type: 
					<select name='type' default=null>
						<option value='null'	  >- Select -</option>
						<option value='RdJnc' >Road Jn</option>
						<option value='FlyOv' >Fly over</option>
						<option value='Bridg' >Bridge</option>
						<option value='PetPu' >Petrol Pump</option>
						<option value='MetSt' >Metro Stn</option>
						<option value='RlySt' >Rly. Station</option>
						<option value='Park ' >Park</option>
						<option value='Collg' >College</option>
						<option value='Schol' >School</option>
						<option value='Hotel' >Hotel</option>
						<option value='Temple' >Religious</option>
						<option value='play' >Play Ground</option>
						<option value='Cbldg' >Comm Bldg</option>
						<option value='Shop' >Shopping Mall</option>
						<option value='Movie' >Movie</option>
						<option value='Hosp.'>Hospital</option>
						<option value='Monmt'>Monument</option>
						<option value='Airpt' >Airport</option>
						<option value='Other' >Other</option>
					</select>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					Importance:
					<select name=importance default=1>
						<option value=1>1. Personal </option>
						<option value=2>2. Local Landmark</option>
						<option value=3>3. City Landmark</option>
						<option value=4>4. National Monument</option>
						<option value=5>5. World Heritage Monument</option>
						<option value=6>6. Village</option>
						<option value=7>7. Town</option>
						<option value=8>8. City</option>
						<option value=9>9. Wonder of the world</option>
					</select>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<INPUT type=hidden name=lat SIZE=20> 
					<INPUT type=hidden name=lng SIZE=20>
					<INPUT type=hidden name=z>
					<INPUT type=submit name=save value=SAVE>
					<INPUT type=reset name=reset Value='RESET'>
				</FORM>
			</TD>
		</TR>
		<?} 
		if (isset($_GET[share])) { ?>
		<TR>
			<TD>
				<FORM name=cd>
				You may refer this point by following URL:<BR>
				<TEXTAREA name=ref rows=1 cols=100 READONLY>
				</TEXTAREA><BR>
				</FORM>
			</TD>
		<TR>
		<? }?>
	</TABLE>
</div>
<? include "wikifoot.php"; ?>
</body>
</html>
Return current item: Wiki-Map