Change the format of the lat/lon output on a notice in HTML

This commit is contained in:
Craig Andrews 2009-11-20 17:40:38 -05:00
parent 38f8d3d11b
commit 83ba93e945
2 changed files with 14 additions and 14 deletions

View File

@ -392,15 +392,14 @@ class NoticeListItem extends Widget
$name = $location->getName(); $name = $location->getName();
if (empty($name)) {
// XXX: Could be a translation issue. Fall back to... something?
return;
}
$lat = $this->notice->lat; $lat = $this->notice->lat;
$lon = $this->notice->lon; $lon = $this->notice->lon;
$latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : ''; $latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : '';
if (empty($name)) {
$name = $lat . ' ' . $lon; //TODO tranform to N/S deg/min/sec format
}
$url = $location->getUrl(); $url = $location->getUrl();
$this->out->elementStart('span', array('class' => 'location')); $this->out->elementStart('span', array('class' => 'location'));

View File

@ -1,7 +1,7 @@
$(document).ready(function() { $(document).ready(function() {
notices = []; var notices = [];
$(".notice").each(function(){ $(".notice").each(function(){
notice = getNoticeFromElement($(this)); var notice = getNoticeFromElement($(this));
if(notice['geo']) if(notice['geo'])
notices.push(notice); notices.push(notice);
}); });
@ -10,8 +10,8 @@ $(document).ready(function() {
showMapstraction($("#map_canvas"), notices); showMapstraction($("#map_canvas"), notices);
} }
$('a.geo').click(function(){ $('.geo').click(function(){
noticeElement = $(this).closest(".notice"); var noticeElement = $(this).closest(".notice");
notice = getNoticeFromElement(noticeElement); notice = getNoticeFromElement(noticeElement);
$.fn.jOverlay.options = { $.fn.jOverlay.options = {
@ -23,7 +23,7 @@ $(document).ready(function() {
autoHide : true, autoHide : true,
css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'}
}; };
html="<div id='map_canvas_popup' class='gray smallmap' style='width: 542px; height: 500px' />"; var html="<div id='map_canvas_popup' class='gray smallmap' style='width: 542px; height: 500px' />";
html+="<button class='close'>&#215;</button>"; html+="<button class='close'>&#215;</button>";
html+=$("<div/>").append($(this).clone()).html(); html+=$("<div/>").append($(this).clone()).html();
$().jOverlay({ "html": html }); $().jOverlay({ "html": html });
@ -47,11 +47,12 @@ function getMicroformatValue(element)
function getNoticeFromElement(noticeElement) function getNoticeFromElement(noticeElement)
{ {
notice = {}; var notice = {};
if(noticeElement.find(".latitude").length){ if(noticeElement.find(".geo").length){
var latlon = noticeElement.find(".geo").attr('title').split(";");
notice['geo']={'coordinates': [ notice['geo']={'coordinates': [
parseFloat(getMicroformatValue(noticeElement.find(".latitude"))), parseFloat(latlon[0]),
parseFloat(getMicroformatValue(noticeElement.find(".longitude")))] }; parseFloat(latlon[1])] };
} }
notice['user']={ notice['user']={
'profile_image_url': noticeElement.find("img.avatar").attr('src'), 'profile_image_url': noticeElement.find("img.avatar").attr('src'),