Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added map stuff, single view map and multiple map
- Loading branch information
Showing
6 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
<div data-role="page"> | |||
<img src="http://maps.google.com/maps/api/staticmap?markers={{ message.latitude }},{{ message.longitude }}&zoom=14&size=320x400&sensor=false" /> | |||
<!--center={{ message.latitude }},{{ message.longitude }}--> | |||
<dl> | |||
<dt>Latitude</dt> | |||
<dd>{{ message.latitude }}</dd> | |||
<dt>Longitude</dt> | |||
<dd>{{ message.longitude }}</dd> | |||
<dt>Altitude</dt> | |||
<dd>{{ message.altitude }}</dd> | |||
<dt>Accuracy</dt> | |||
<dd>{{ message.accuracy }}</dd> | |||
</dl> | |||
<a href="docs-dialogs.html" data-role="button" data-inline="true" data-icon="check" data-rel="back" data-theme="c">Okay</a> | |||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,55 @@ | |||
{% extends "geocamTalk/base.html" %} | |||
|
|||
{% block js %} | |||
<script> | |||
$('#bodydiv').live('pageshow', function(event) { | |||
createMap({{ first_geolocation.0 }},{{ first_geolocation.1 }}); | |||
}); | |||
|
|||
function createMap(latitude, longitude) { | |||
var latlng = new google.maps.LatLng( latitude,longitude ); | |||
var myOptions = { | |||
zoom: 12, | |||
center: latlng, | |||
mapTypeControl: false, | |||
navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, | |||
mapTypeId: google.maps.MapTypeId.ROADMAP | |||
}; | |||
|
|||
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); | |||
|
|||
var messages = | |||
[{% for m in gc_msg %}{% if m.has_geolocation %} | |||
{marker:null,latitude:{{m.latitude}},longitude:{{m.longitude}},pk:{{m.pk}}}, | |||
{% endif %} | |||
{% endfor %}]; | |||
|
|||
$(messages).each(function(i,msg){ | |||
var pos = new google.maps.LatLng(msg.latitude,msg.longitude); | |||
msg.marker = new google.maps.Marker({position:pos,map:map}); | |||
}); | |||
|
|||
var infoWindow = new google.maps.InfoWindow(); | |||
$(messages).each(function(i, msg) { | |||
google.maps.event.addListener(msg.marker,"click", function() { | |||
infoWindow.close(); | |||
$.getJSON("talk/messages/details/" + msg.pk + ".json", function(data) { | |||
var messageHtml = "<strong>" + data['authorFullname'] + "</strong><br />" | |||
+ "<span>" + data['contentTimestamp'] + "</span>" | |||
+ "<p>" + data['content'] + "</p>" | |||
infoWindow.setContent(messageHtml); | |||
}); | |||
infoWindow.open(map, msg.marker); | |||
}); | |||
}); | |||
|
|||
google.maps.event.trigger(map,'resize'); | |||
} | |||
|
|||
</script> | |||
{% endblock %} | |||
|
|||
{% block content %} | |||
<section id="map_canvas" style="width: 320px; height: 400px"> | |||
</section> | |||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters