diff options
author | Zach Copley <zach@status.net> | 2009-11-24 18:47:56 +0000 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-11-24 18:47:56 +0000 |
commit | 2eae258319d5621065f9491ba4d81814c0f2b1fd (patch) | |
tree | 71305b1bee0e9b557f078f0c11ecbad3b9ee2059 /lib/noticelist.php | |
parent | 4bace8f1a5df797aead91ce802d4538e1dfed9ec (diff) | |
parent | 2da531d7d65044f3093eafd72b73a08e1cf67fd5 (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib/noticelist.php')
-rw-r--r-- | lib/noticelist.php | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/lib/noticelist.php b/lib/noticelist.php index dd97b85bd..21cec528f 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -396,22 +396,44 @@ class NoticeListItem extends Widget $lon = $this->notice->lon; $latlon = (!empty($lat) && !empty($lon)) ? $lat.';'.$lon : ''; + if (empty($name)) { + $latdms = $this->decimalDegreesToDMS(abs($lat)); + $londms = $this->decimalDegreesToDMS(abs($lon)); + $name = sprintf( + _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'), + $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')), + $londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W'))); + } + $url = $location->getUrl(); $this->out->elementStart('span', array('class' => 'location')); $this->out->text(_('at')); + if (empty($url)) { + $this->out->element('span', array('class' => 'geo', + 'title' => $latlon), + $name); + } else { + $this->out->element('a', array('class' => 'geo', + 'title' => $latlon, + 'href' => $url), + $name); + } + $this->out->elementEnd('span'); + } - $this->out->elementStart('a', array('class' => 'geo', 'href' => $url)); - $this->out->elementStart('abbr', array('class' => 'latitude', 'title' => $lat, 'style' => empty($name)?null:'display: none')); - $this->out->text($lat); //TODO translate to a prettier format, like "S 37.2 deg" instead of "-37.2" - $this->out->elementEnd('abbr'); - $this->out->elementStart('abbr', array('class' => 'longitude', 'title' => $lon, 'style' => empty($name)?null:'display: none')); - $this->out->text($lon); - $this->out->elementEnd('abbr'); - $this->out->text($name); - $this->out->elementEnd('a'); + function decimalDegreesToDMS($dec) + { - $this->out->elementEnd('span'); + $vars = explode(".",$dec); + $deg = $vars[0]; + $tempma = "0.".$vars[1]; + + $tempma = $tempma * 3600; + $min = floor($tempma / 60); + $sec = $tempma - ($min*60); + + return array("deg"=>$deg,"min"=>$min,"sec"=>$sec); } /** |