From d3a9278ba81c700d926085ed5c5e02a4a93e5396 Mon Sep 17 00:00:00 2001 From: jobnomade Date: Tue, 1 Oct 2013 23:51:54 +0200 Subject: [PATCH 1/3] modified files to fix encoding issues for Vietnamese language --- represent-map/add.php | 2 +- represent-map/admin/edit.php | 2 +- represent-map/admin/header.php | 1 + represent-map/admin/index.php | 2 +- represent-map/geocode.php | 2 +- represent-map/include/db.php | 107 +++++++++++++++++++++++++++++++++ represent-map/index.php | 47 ++++++++++++++- 7 files changed, 156 insertions(+), 7 deletions(-) create mode 100644 represent-map/include/db.php diff --git a/represent-map/add.php b/represent-map/add.php index f826cc7..10e9c23 100644 --- a/represent-map/add.php +++ b/represent-map/add.php @@ -42,7 +42,7 @@ } else { // insert into db, wait for approval - $insert = mysql_query("INSERT INTO places (approved, title, type, address, uri, description, owner_name, owner_email) VALUES (null, '$title', '$type', '$address', '$uri', '$description', '$owner_name', '$owner_email')") or die(mysql_error()); + $insert = mysql_query("INSERT INTO places (approved, title, type, address, uri, description, owner_name, owner_email) VALUES (null, '$title', '$type', _utf8'$address', '$uri', '$description', _utf8'$owner_name', '$owner_email')") or die(mysql_error()); // geocode new submission $hide_geocode_output = true; diff --git a/represent-map/admin/edit.php b/represent-map/admin/edit.php index 18eeec6..2c6d784 100644 --- a/represent-map/admin/edit.php +++ b/represent-map/admin/edit.php @@ -10,7 +10,7 @@ exit; } - +mysql_query("SET NAMES 'utf8'"); // get place info $place_query = mysql_query("SELECT * FROM places WHERE id='$place_id' LIMIT 1"); if(mysql_num_rows($place_query) != 1) { exit; } diff --git a/represent-map/admin/header.php b/represent-map/admin/header.php index f9e99b9..bbff0ea 100644 --- a/represent-map/admin/header.php +++ b/represent-map/admin/header.php @@ -41,6 +41,7 @@ $admin_head = " + RepresentMap Admin diff --git a/represent-map/admin/index.php b/represent-map/admin/index.php index eaa272c..8d24946 100644 --- a/represent-map/admin/index.php +++ b/represent-map/admin/index.php @@ -1,7 +1,7 @@ +$head_html = ""; + +// attribution (must leave link intact, per our license) +$attribution = " + + Based on RepresentLA + +"; + +// add startup genome to attribution if integration enabled +if($sg_enabled) { + $attribution .= " +

+ Data from StartupGenome + "; +} + + + +?> diff --git a/represent-map/index.php b/represent-map/index.php index 29f7a24..a14c5d7 100644 --- a/represent-map/index.php +++ b/represent-map/index.php @@ -132,7 +132,7 @@ function initialize() { var myOptions = { zoom: 11, //minZoom: 10, - center: new google.maps.LatLng(34.034453,-118.341293), + center: new google.maps.LatLng(10.774036506178824,106.68582916259766), mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false, mapTypeControl: false, @@ -307,6 +307,7 @@ function initialize() { $("#search").val(""); } }); + initAddMarker(); } @@ -362,6 +363,46 @@ function markerListMouseOut(marker_id) { $("#marker"+marker_id).css("display", "none"); } + // geocode from latlng to address + window.pmaker = null; + function initAddMarker(){ + window.geocoder = new google.maps.Geocoder(); + + // prepare and add dropable marker + $('#modal_add_btn').on('click', function(){ + if(!window.pmaker){ + window.pmaker = new google.maps.Marker({ + map: map, + draggable: true, + animation: google.maps.Animation.DROP, + position: map.getCenter() + }); + + pmaker.setMap(map); + + window.geocoder.geocode({location: map.getCenter()}, function(rsp){ + $('#add_address').val(rsp[0].formatted_address); + }); + + google.maps.event.addListener(window.pmaker, 'dragend', function(e){ + window.geocoder.geocode({location: e.latLng}, function(rsp){ + $('#add_address').val(rsp[0].formatted_address); + }); + $('#glatitude').val(e.latLng.lat()); + $('#glongitude').val(e.latLng.lng()); + }); + + google.maps.event.addListener(window.pmaker, 'click', function(e){ + $('#modal_add').modal('show'); + }); + + // set lat lng when user don't move the marker + $('#glatitude').val(map.getCenter().lat()); + $('#glongitude').val(map.getCenter().lng()); + + } + }); + } google.maps.event.addDomListener(window, 'load', initialize); @@ -404,9 +445,9 @@ function markerListMouseOut(marker_id) {
About this Map - Add Something + Add Something - Add Something + Add Something