From 83ba93e945e5b933a73139f9e5db710444c99893 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 20 Nov 2009 17:40:38 -0500 Subject: [PATCH] Change the format of the lat/lon output on a notice in HTML --- lib/noticelist.php | 9 ++++----- plugins/Mapstraction/usermap.js | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/noticelist.php b/lib/noticelist.php index 5877827ff9..167ba994bc 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -392,15 +392,14 @@ class NoticeListItem extends Widget $name = $location->getName(); - if (empty($name)) { - // XXX: Could be a translation issue. Fall back to... something? - return; - } - $lat = $this->notice->lat; $lon = $this->notice->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(); $this->out->elementStart('span', array('class' => 'location')); diff --git a/plugins/Mapstraction/usermap.js b/plugins/Mapstraction/usermap.js index 19ec54c392..e667dd5790 100644 --- a/plugins/Mapstraction/usermap.js +++ b/plugins/Mapstraction/usermap.js @@ -1,7 +1,7 @@ $(document).ready(function() { - notices = []; + var notices = []; $(".notice").each(function(){ - notice = getNoticeFromElement($(this)); + var notice = getNoticeFromElement($(this)); if(notice['geo']) notices.push(notice); }); @@ -10,8 +10,8 @@ $(document).ready(function() { showMapstraction($("#map_canvas"), notices); } - $('a.geo').click(function(){ - noticeElement = $(this).closest(".notice"); + $('.geo').click(function(){ + var noticeElement = $(this).closest(".notice"); notice = getNoticeFromElement(noticeElement); $.fn.jOverlay.options = { @@ -23,7 +23,7 @@ $(document).ready(function() { autoHide : true, css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'} }; - html="
"; + var html="
"; html+=""; html+=$("
").append($(this).clone()).html(); $().jOverlay({ "html": html }); @@ -47,11 +47,12 @@ function getMicroformatValue(element) function getNoticeFromElement(noticeElement) { - notice = {}; - if(noticeElement.find(".latitude").length){ + var notice = {}; + if(noticeElement.find(".geo").length){ + var latlon = noticeElement.find(".geo").attr('title').split(";"); notice['geo']={'coordinates': [ - parseFloat(getMicroformatValue(noticeElement.find(".latitude"))), - parseFloat(getMicroformatValue(noticeElement.find(".longitude")))] }; + parseFloat(latlon[0]), + parseFloat(latlon[1])] }; } notice['user']={ 'profile_image_url': noticeElement.find("img.avatar").attr('src'),